小弟求救!!(有100分) 至少要会用java.net.*;java.io.*;要做好点的要会用java.awt.*;java.awt.event.*; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 再好点的加上javax.swing.*;javax.swing.event.*; 要什么样的浏览器?hellow world行吗? 简单的浏览器?直接用JEditorPane,JEditorPane是网页容器,支持HTML3 Jbuilder 开发Jsp+Servlet+JavaBean import java.awt.*;import java.awt.event.*;import java.io.*;import java.util.*;import javax.swing.*;import javax.swing.event.*;public class EditorPaneTest{ public static void main(String[] args) { JFrame frame = new EditorPaneFrame(); frame.show(); }}class EditorPaneFrame extends JFrame{ public EditorPaneFrame() { setTitle("EditorPaneTest"); setSize(600, 400); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); // set up text field and load button for typing in URL url = new JTextField(30); loadButton = new JButton("Load"); loadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { // remember URL for back button urlStack.push(url.getText()); editorPane.setPage(url.getText()); } catch(IOException e) { editorPane.setText("Error: " + e); } } }); // set up back button and button action backButton = new JButton("Back"); backButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (urlStack.size() <= 1) return; try { // get URL from back button urlStack.pop(); // show URL in text field String urlString = (String)urlStack.peek(); url.setText(urlString); editorPane.setPage(urlString); } catch(IOException e) { editorPane.setText("Error: " + e); } } }); // set up editor pane and hyperlink listener editorPane = new JEditorPane(); editorPane.setEditable(false); editorPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { // remember URL for back button urlStack.push(event.getURL().toString()); // show URL in text field url.setText(event.getURL().toString()); editorPane.setPage(event.getURL()); } catch(IOException e) { editorPane.setText("Error: " + e); } } } }); // set up checkbox for toggling edit mode editable = new JCheckBox(); editable.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { editorPane.setEditable(editable.isSelected()); } }); Container contentPane = getContentPane(); contentPane.add(new JScrollPane(editorPane), "Center"); // put all control components in a panel JPanel panel = new JPanel(); panel.add(new JLabel("URL")); panel.add(url); panel.add(loadButton); panel.add(backButton); panel.add(new JLabel("Editable")); panel.add(editable); contentPane.add(panel, "South"); } private JTextField url; private JCheckBox editable; private JButton loadButton; private JButton backButton; private JEditorPane editorPane; private Stack urlStack = new Stack();} thinking of java 这样的书肯定是不行了。哈哈 panel 里面显示网格 怎样往一个.jar文件中的其中的一个xml里写新值啊? java String 乱码问题 关于JAVA扫雷程序的一点点难题 送分啊....简单java 问题 如何获得Rar.exe返回值 0,THANKS.... +++一个java方法,包括了300个参数,编译时出错“too many parameter”,怎么办?? Java如何处理bmp文件,在线求解答! 用JFrame 背景色不改变,而是Frame的时候可以改变 scjp考试卷便宜卖有人要吗 求一算法(c的也行) 如何编写类似于VB、VC那样的图形化应用程序?
javax.swing.*;
javax.swing.event.*;
Jsp+Servlet+JavaBean
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;public class EditorPaneTest
{ public static void main(String[] args)
{ JFrame frame = new EditorPaneFrame();
frame.show();
}
}class EditorPaneFrame extends JFrame
{ public EditorPaneFrame()
{ setTitle("EditorPaneTest");
setSize(600, 400);
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent e)
{ System.exit(0);
}
} ); // set up text field and load button for typing in URL url = new JTextField(30); loadButton = new JButton("Load");
loadButton.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent event)
{ try
{ // remember URL for back button
urlStack.push(url.getText()); editorPane.setPage(url.getText());
}
catch(IOException e)
{ editorPane.setText("Error: " + e);
}
}
}); // set up back button and button action backButton = new JButton("Back");
backButton.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent event)
{ if (urlStack.size() <= 1) return;
try
{ // get URL from back button
urlStack.pop();
// show URL in text field
String urlString = (String)urlStack.peek();
url.setText(urlString); editorPane.setPage(urlString);
}
catch(IOException e)
{ editorPane.setText("Error: " + e);
}
}
}); // set up editor pane and hyperlink listener editorPane = new JEditorPane();
editorPane.setEditable(false);
editorPane.addHyperlinkListener(new HyperlinkListener()
{ public void hyperlinkUpdate(HyperlinkEvent event)
{ if (event.getEventType()
== HyperlinkEvent.EventType.ACTIVATED)
{ try
{ // remember URL for back button
urlStack.push(event.getURL().toString());
// show URL in text field
url.setText(event.getURL().toString()); editorPane.setPage(event.getURL());
}
catch(IOException e)
{ editorPane.setText("Error: " + e);
}
}
}
}); // set up checkbox for toggling edit mode editable = new JCheckBox();
editable.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent event)
{ editorPane.setEditable(editable.isSelected());
}
}); Container contentPane = getContentPane();
contentPane.add(new JScrollPane(editorPane), "Center"); // put all control components in a panel JPanel panel = new JPanel();
panel.add(new JLabel("URL"));
panel.add(url);
panel.add(loadButton);
panel.add(backButton);
panel.add(new JLabel("Editable"));
panel.add(editable); contentPane.add(panel, "South");
} private JTextField url;
private JCheckBox editable;
private JButton loadButton;
private JButton backButton;
private JEditorPane editorPane;
private Stack urlStack = new Stack();
}