java图形界面 关闭_用 java编写的图形用户界面运行后怎么关不掉

importjava.awt.*;importjavax.swing.*;publicclassGUIDemo{publicstaticvoidmain(String[]args){Framef=newFrame("候选人输入");Panelp1=newPanel();Panelp2=newPanel();Panelp3=new...

import java.awt.*;

import javax.swing.*;

public class GUIDemo {

public static void main(String[] args) {

Frame f=new Frame("候选人输入");

Panel p1=new Panel();

Panel p2=new Panel();

Panel p3=new Panel();

Label l1=new Label("第一候选人");

Label l2=new Label("第一候选人");

Label l3=new Label("第一候选人");

TextField t1=new TextField(30);

TextField t2=new TextField(30);

TextField t3=new TextField(30);

Button b1=new Button("输入");

Button b2=new Button("输入");

Button b3=new Button("输入");

f.setLayout(new GridLayout(4,1));

p1.setLayout(new FlowLayout());

p2.setLayout(new FlowLayout());

p3.setLayout(new FlowLayout());

p1.add(l1);

p1.add(t1);

p1.add(b1);

p1.setBackground(Color.yellow);

p2.add(l2);

p2.add(t2);

p2.add(b2);

p2.setBackground(Color.red);

p3.add(l3);

p3.add(t3);

p3.add(b3);

p3.setBackground(Color.green);

f.add(p1);

f.add(p2);

f.add(p3);

f.setSize(600,300);

f.setVisible(true);

谢谢各位

展开

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值