?? wrc.java.txt
字號:
TestFrame.java //顯示空的窗口
import javax.swing.JFrame;
public class TestFrame extends JFrame {
/**
* @param args
*/
public static void main(String[] args) {
TestFrame tf=new TestFrame();
tf.setTitle("testframe");
tf.setSize(400,300);
tf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tf.setLocationRelativeTo(null);
tf.setVisible(true);
}
}
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel; //加按鈕
public class TestFrame extends JFrame {
/**
* @param args
*/
public TestFrame()
{
JPanel jp = new JPanel();
JButton jb = new JButton("OK");
JButton jb1 = new JButton("CANCEL");
jp.add(jb);
jp.add(jb1);
this.getContentPane().add(jp);
}
public static void main(String[] args) {
TestFrame tf=new TestFrame();
tf.setTitle("testframe");
tf.setSize(400,300);
tf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tf.setLocationRelativeTo(null);
tf.setVisible(true);
}
}
import java.awt.Color;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField; //再加彩色信息
public class TestFrame extends JFrame {
/**
* @param args
*/
public TestFrame()
{
JPanel jp = new JPanel();
JButton jb = new JButton("OK");
JButton jb1 = new JButton("CANCEL");
jp.add(jb);
jp.add(jb1);
this.getContentPane().add(jp);
JTextField jt=new JTextField("Hello World!");
jp.add(jt);
jt.setForeground(new Color(222,2,2));
}
public static void main(String[] args) {
TestFrame tf=new TestFrame();
tf.setTitle("testframe");
tf.setSize(400,300);
tf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tf.setLocationRelativeTo(null);
tf.setVisible(true);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -