谁给我个Java可视化的简单例子?Eclipse

一个输入文本区和五个显示文本区,加按钮,单选,多选就可了!我用EclipseGanymede怎么实现?加swing直接import就可以了吗?swing里的类怎么用呢?我... 一个输入文本区和五个显示文本区,加按钮,单选,多选就可了!
我用Eclipse Ganymede怎么实现?
加swing直接import就可以了吗?
swing里的类怎么用呢?
我希望能直接得到一个例子,然后自己推敲
展开
 我来答
aaronswon
推荐于2016-02-04 · TA获得超过3481个赞
知道大有可为答主
回答量:1863
采纳率:0%
帮助的人:1646万
展开全部
IDE:
http://nchc.dl.sourceforge.net/sourceforge/easyeclipse/easyeclipse-
desktop-java-1.3.1.1.exe(自带VE,可视化开发GUI)

//例子

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;

public class FlagFrame extends JFrame implements Runnable{

private static final long serialVersionUID = 1L;
private int x = 125;
private int y = 460;
private int step = 1;//步阶,升旗速度
private Thread thread = new Thread(this);

public void paint(Graphics g) {
Color c = g.getColor();
g.setColor(Color.BLACK);
g.fillRect(120, 0, 5, 600);
g.setColor(Color.RED);
g.fillRect(x, y, 200, 120);
g.setColor(Color.BLUE);
g.drawString("China", x + 30, y + 30 );
g.setColor(this.getBackground());
g.fillRect(x, y + 120 + step, 200, 120);
g.setColor(c);
}

public void init() {
this.setBackground(Color.CYAN);
this.setLayout(null);
this.setBounds(300, 120, 400, 600);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thread.start();
this.setVisible(true);

}

public static void main(String[] args) {
new FlagFrame().init();
}

@SuppressWarnings("deprecation")
public void run() {
while(true) {
try {
if(y <= 28) {
thread.stop();//不安全
}
y -= step;
repaint();
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
}

}

}
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
速雪观c
2009-02-28
知道答主
回答量:12
采纳率:0%
帮助的人:0
展开全部
简单点

import java.awt.*;
public static void main(String[] arge){
JFrame jf = new JFrame("容器名 就是窗体");//声名容器对象
// 然后显示该容器 就是窗体
jf.show();
//可以给容器里加东西比如按钮 什么的 当然你要声明按钮对象
}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式