liulanqi
来源:互联网 发布:数据存储 概念 编辑:程序博客网 时间:2024/05/16 02:31
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
public class ReadServerFile extends JFrame{
private JTextField enterField;
private JEditorPane contentsArea;
public ReadServerFile()
{
super("web");
Container container=getContentPane();
enterField=new JTextField("url");
enterField.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
getThePage(event.getActionCommand());
}
}
);
container.add(enterField,BorderLayout.NORTH);
contentsArea=new JEditorPane();
contentsArea.setEditable(false);
contentsArea.addHyperlinkListener(
new HyperlinkListener(){
public void hyperlinkUpdate(HyperlinkEvent event)
{
if(event.getEventType()==
HyperlinkEvent.EventType.ACTIVATED)
getThePage(event.getURL().toString());
}
});
container.add(new JScrollPane(contentsArea),
BorderLayout.CENTER);
setSize(900,700);
setVisible(true);
}
private void getThePage(String location)
{
setCursor(Cursor.getPredefinedCursor(
Cursor.WAIT_CURSOR));
try{
contentsArea.setPage(location);
enterField.setText(location);
}
catch (IOException ioException)
{
JOptionPane.showMessageDialog(this,"error retraiving",
"bad url",JOptionPane.ERROR_MESSAGE);
}
setCursor(Cursor.getPredefinedCursor(
Cursor.DEFAULT_CURSOR));
}
public static void main(String args[])
{
ReadServerFile application=new ReadServerFile();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
import java.awt.event.*;
import java.net.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
public class ReadServerFile extends JFrame{
private JTextField enterField;
private JEditorPane contentsArea;
public ReadServerFile()
{
super("web");
Container container=getContentPane();
enterField=new JTextField("url");
enterField.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
getThePage(event.getActionCommand());
}
}
);
container.add(enterField,BorderLayout.NORTH);
contentsArea=new JEditorPane();
contentsArea.setEditable(false);
contentsArea.addHyperlinkListener(
new HyperlinkListener(){
public void hyperlinkUpdate(HyperlinkEvent event)
{
if(event.getEventType()==
HyperlinkEvent.EventType.ACTIVATED)
getThePage(event.getURL().toString());
}
});
container.add(new JScrollPane(contentsArea),
BorderLayout.CENTER);
setSize(900,700);
setVisible(true);
}
private void getThePage(String location)
{
setCursor(Cursor.getPredefinedCursor(
Cursor.WAIT_CURSOR));
try{
contentsArea.setPage(location);
enterField.setText(location);
}
catch (IOException ioException)
{
JOptionPane.showMessageDialog(this,"error retraiving",
"bad url",JOptionPane.ERROR_MESSAGE);
}
setCursor(Cursor.getPredefinedCursor(
Cursor.DEFAULT_CURSOR));
}
public static void main(String args[])
{
ReadServerFile application=new ReadServerFile();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
- liulanqi
- er tong liulanqi chorme
- The serializable class XXX does not declare a static final serialVersionUID field of type long
- N的阶乘大数据高精度写法
- 动态规划1:G - 命运 (找到状态方程就行了)
- hdu 4417 Super Mario
- Django 中登入页面跳转
- liulanqi
- 【Linux】Linux Kernel-Hardware Basic
- 理解 equals,hashcode
- 部署构件至nexus
- JOIN操作实例
- Stripe Compaction
- request.getServletPath();
- 新装mac系统finder不断重启
- 【Linux】Linux Kernel--Software Basic