java jui_求教java大神,下面这个JUI界面是怎么布局而成的

这篇博客展示了如何使用Java Swing库创建一个简单的35选7彩票选择界面。通过导入必要的组件如JLabel、JTextField、JTextArea和JButton,并采用不同的布局管理器(BorderLayout、FlowLayout和GridLayout),实现了包含号码输入、显示、添加和验证功能的界面。用户可以输入选号,查看当前号码,点击按钮进行操作。
摘要由CSDN通过智能技术生成

展开全部

按照你的JUI界面要求编写的Java布局程序如下:import java.awt.BorderLayout;

import java.awt.FlowLayout;

import java.awt.Font;

import java.awt.GridLayout;

import javax.swing.BorderFactory;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JTextArea;

import javax.swing.JTextField;

public class CCG extends JFrame{

JLabel jl1=new JLabel("35选7",JLabel.LEFT);

JLabel jl2=new JLabel("输入选号:");

JLabel jl3=new JLabel("当前选号:");

JLabel jl4=new JLabel("22,33,34");

JTextField jtf=new JTextField(5);

JTextArea jta=new JTextArea(5,20);

JButton jb1=new JButton("添加本组号码");

JButton jb2=new JButton("验证并保存32313133353236313431303231363533e78988e69d8331333361303634到文件");

JPanel jp1=new JPanel();

JPanel jp2=new JPanel();

JPanel jp3=new JPanel();

JPanel jp4=new JPanel();

JPanel jp5=new JPanel();

JPanel jp6=new JPanel();

JPanel jp7=new JPanel();

CCG(){

super("Lottery");

jl1.setFont(new Font(null,Font.BOLD,20));

jp1.setLayout(new FlowLayout(FlowLayout.LEFT));

jp1.add(jl1);

jp1.setBorder(BorderFactory.createEtchedBorder ());

jp4.setLayout(new FlowLayout(FlowLayout.LEFT));

jp4.add(jl2);jp4.add(jtf);

jp5.setLayout(new FlowLayout(FlowLayout.LEFT));

jp5.add(jl3);jp5.add(jl4);

jp6.setLayout(new FlowLayout(FlowLayout.LEFT));

jp6.add(jb1);

jp2.setLayout(new GridLayout(3,1));

jp2.add(jp4);jp2.add(jp5);jp2.add(jp6);

jp2.setBorder(BorderFactory.createEtchedBorder ());

jp3.setLayout(new FlowLayout(FlowLayout.LEFT));

jp3.add(jta);jp3.add(jb2);

jp3.setBorder(BorderFactory.createEtchedBorder ());

jp7.setLayout(new GridLayout(2,1));

jp7.add(jp2);

jp7.add(jp3);

add(jp1,BorderLayout.NORTH);

add(jp7,BorderLayout.CENTER);

setSize(400, 300);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setLocationRelativeTo(null);

setVisible(true);

}

public static void main(String[] args) {

new CCG();

}

}

运行结果:

ed8d1bcc53549db1d0574e888ea2e94d.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值