extraguidemo1.java

来自「JAVA程序设计课程中各章节的程序实例。」· Java 代码 · 共 45 行

JAVA
45
字号
/**
*Some other GUI demonstration program
*Here's a example using CheckBox and Choice list
*2005.1.11. xhcprince
*/

import java.awt.*;

public class extraGUIDemo1
{
	public static void main(String args[])
	{
		
		Frame f = new Frame();
		f.setTitle("My frame");
		f.setSize(300,150);
		
		Panel p1 = new Panel();
//		p1.setBackground(Color.pink);
		
		Choice ch = new Choice();
		ch.add("red");
		ch.add("green");
		ch.add("blue");
		ch.add("black");
		
		Checkbox cb = new Checkbox("Bold");
		
		p1.add(ch);
		p1.add(cb);
		
		TextArea ta = new TextArea(10,60);
//		Color cl = new Color(0,0,255);
//		ta.setForeground(cl);
		
		Font ft = new Font("System",Font.ITALIC + Font.BOLD,14);
						  //Input the System!	
		ta.setFont(ft);
		
		f.add("North",p1);
		f.add("Center",ta);
		
		f.setVisible(true);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?