java课设代码 java代码教学( 二 )


}
}
真好无聊中 。。
java浏览器课程设计⑴ 怎样用Java制作一个简单浏览器解决方法
importjavax.swing.*;
importjava.awt.*;
importjava.awt.event.*;
importjava.*;
importjava.io.*;
importjavax.swing.event.*;
@SuppressWarnings("serial")
,Runnable
{
JButtonbutton;
URLurl;
JTextFieldtext;
JEditorPaneeditPane;
byteb[]=newbyte[118];
Threadthread;
publicWin3()
{
text=newJTextField(20);
editPane=newJEditorPane();
editPane.setEditable(false);
button=newJButton("确定");
button.addActionListener(this);
thread=newThread(this);
JPanelp=newJPanel();
p.add(newJLabel("输入网址:"));
p.add(text);
p.add(button);
Containercon=getContentPane();
con.add(newJScrollPane(editPane),BorderLayout.CENTER);
con.add(p,BorderLayout.NORTH);
setBounds(60,60,400,300);
setVisible(true);
validate();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
editPane.addHyperlinkListener(newHyperlinkListener()
{
publicvoidhyperlinkUpdate(HyperlinkEvente)
{
if(e.getEventType()==
HyperlinkEvent.EventType.ACTIVATED)
{
try{
editPane.setPage(e.getURL());
}
catch(IOExceptione1)
{
editPane.setText(""+e1);
}
}
}
}
);
}
publicvoidactionPerformed(ActionEvente)
{
if(!(thread.isAlive()))
thread=newThread(this);
try{
thread.start();
}
catch(Exceptionee)
{
text.setText("我正在读取"+url);
}
}
publicvoidrun()
{
try{
intn=-1;
editPane.setText(null);
url=newURL(text.getText().trim());
editPane.setPage(url);
}
catch(MalformedURLExceptione1)
{
text.setText(""+e1);
return;
}
catch(IOExceptione1)
{
text.setText(""+e1);
return;
}
}
}
publicclassExample3
{
publicstaticvoidmain(Stringargs[])
{
newWin3();
}
}
⑵ 关于用java自己做一款浏览器 。其具体的设计思路是什么java课设代码,该怎么考虑,从哪方面入手 。流程是什么 。
你还是先出入门的程序练起吧 。。。。
你提到的每一个部件都是一个比较沉重的课题 。
⑶ 用java编写简易浏览器
地址栏如果有变化就不正常java课设代码了,因为在你的代码中并没有执行更改地址栏的语句内java课设代码:
bol.setSelectedIndex() 或 bol.setSelectedItem();
用 JEditorPane 做一容个类似浏览器显示的网页效果很难看 。
有很多css,javascript无法正常解析 。
如果一个网页中只含有 div table 这样的,还好些 。
网页做的越漂亮(因为要做的漂亮就要用到css样式),显示出来越难看 。
⑷ 用java编写一个图片浏览器
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
public class ImageGallery extends JFrame implements ActionListener {
public static final int G_WIDTH = 400, G_HEIGHT = 620;
public static final int L_WIDTH = 1200, L_HEIGHT = 520;
public static final int MAX_R = 3, MAX_C = 2;
public static final int GRID = 1, LARGE = 2;
private JFileChooser chooser;
private JMenuBar toolBar;
private JMenu menu;

推荐阅读