?? jframe.java
字號:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/*
<APPLET
CODE = jframe.class
WIDTH = 350
HEIGHT = 280>
</APPLET>
*/
public class jframe extends JFrame
{
jpanel j;
public jframe()
{
super("Swing application");
Container contentPane = getContentPane();
j = new jpanel();
contentPane.add(j);
}
public static void main(String args[])
{
final JFrame f = new jframe();
f.setBounds(100, 100, 300, 300);
f.setVisible(true);
f.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
}
class jpanel extends JPanel
{
JTextField jtextfield = new JTextField("Hello from Swing!");
jpanel()
{
setBackground(Color.white);
add(jtextfield);
}
public void paintComponent (Graphics g)
{
super.paintComponent(g);
g.drawString("Hello from Swing!", 0, 60);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -