比这篇新的文章:
Panel小练习
比这篇旧的文章: 界面小练习
作者: firnice, 点击386次, 评论(0), 收藏者(0), , 打分:
所有评论,共0条:( 我也来说两句)
比这篇旧的文章: 界面小练习
多个窗口小练习
语言: Java, 标签: 练习 2009/02/10发布 1年前更新作者: firnice, 点击386次, 评论(0), 收藏者(0), , 打分:
Java语言: 多个窗口小练习
01 import java.awt.*;
02 public class TestMultiFrame {//多个窗口小练习
03 public static void main(String args[]){
04 MyFrame f1=
05 new MyFrame(100,100,200,200,Color.black);
06 new MyFrame(300,100,200,200,Color.yellow);
07 new MyFrame(100,300,200,200,Color.green);
08 new MyFrame(300,300,200,200,Color.magenta);
09 }
10 }
11
12 class MyFrame extends Frame{
13 static int id=0;
14 MyFrame(int x,int y,int w, int h,Color color){
15 super("MyFrame"+(++id));
16 setBackground(color);
17 setLayout(null);
18 setBounds(x,y,w,h);
19 setVisible(true);
20 }
21 }
02 public class TestMultiFrame {//多个窗口小练习
03 public static void main(String args[]){
04 MyFrame f1=
05 new MyFrame(100,100,200,200,Color.black);
06 new MyFrame(300,100,200,200,Color.yellow);
07 new MyFrame(100,300,200,200,Color.green);
08 new MyFrame(300,300,200,200,Color.magenta);
09 }
10 }
11
12 class MyFrame extends Frame{
13 static int id=0;
14 MyFrame(int x,int y,int w, int h,Color color){
15 super("MyFrame"+(++id));
16 setBackground(color);
17 setLayout(null);
18 setBounds(x,y,w,h);
19 setVisible(true);
20 }
21 }
所有评论,共0条:( 我也来说两句)
代码
