?? urllocal.java
字號:
package com.test;
import java.applet.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.net.*;
public class urllocal extends JApplet implements ActionListener
{
JButton button;
URL url;
TextField text;
public void init()
{
text = new TextField(18);
button = new JButton("確定");
Container con = getContentPane();
con.setLayout(new BoxLayout(con,BoxLayout.Y_AXIS));
con.add(new JLabel("輸入網址:"));
con.add(text);
con.add(button);
button.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==button)
{
try
{
url = new URL(text.getText().trim());
}catch(MalformedURLException e1){text.setText("不正確的URL:"+url);}
getAppletContext().showDocument(url);
}
}
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -