导航:首页 > 编程语言 > javajuid

javajuid

发布时间:2021-11-09 23:12:28

java BoxLayout使用中的问题

我稍微改了一下 用的不是BoxLayout方法,换了一个你看看运行下

import javax.swing.*;
import java.awt.*;
class Login extends JFrame {
private JLabel jLabel1, jLabel2, jLabel3;
private JButton jConnect, jCancel;
private JTextField jUID;
private JPasswordField jPwd;

Login() {
super("登录界面");
jLabel1 = new JLabel("家庭收入管理系统");
jLabel2 = new JLabel("用户名");
jLabel3 = new JLabel("密码");
jConnect = new JButton("连接");
jCancel = new JButton("取消");
jUID = new JTextField(15);
jPwd = new JPasswordField(15);

Box title = Box.createHorizontalBox();
Box userName = Box.createHorizontalBox();
Box password = Box.createHorizontalBox();
Box submitButton = Box.createHorizontalBox();
title.add(jLabel1);
userName.add(jLabel2);
userName.add(jUID);
password.add(jLabel3);
password.add(jPwd);
submitButton.add(jConnect);
submitButton.add(jCancel);
this.setLayout(new FlowLayout());
this.add(title);
this.add(userName);
this.add(password);
this.add(submitButton);
title.setVisible(true);
userName.setVisible(true);
password.setVisible(true);
submitButton.setVisible(true);
this.setLocation(50, 50);
this.setSize(500, 500);
this.setVisible(true);

this.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String[] args) {
// TODO code application logic here
new Login();

}
}

如果你飞要用Box的话 就得先获得这个容器组件
this.setLayout(new BoxLayout(this.getContentPane(),BoxLayout.Y_AXIS));

阅读全文

与javajuid相关的资料

热点内容
网络中常用的传输介质 浏览:518
文件如何使用 浏览:322
同步推密码找回 浏览:865
乐高怎么才能用电脑编程序 浏览:65
本机qq文件为什么找不到 浏览:264
安卓qq空间免升级 浏览:490
linux如何删除模块驱动程序 浏览:193
at89c51c程序 浏览:329
怎么创建word大纲文件 浏览:622
袅袅朗诵文件生成器 浏览:626
1054件文件是多少gb 浏览:371
高州禁养区内能养猪多少头的文件 浏览:927
win8ico文件 浏览:949
仁和数控怎么编程 浏览:381
项目文件夹图片 浏览:87
怎么在东芝电视安装app 浏览:954
plc显示数字怎么编程 浏览:439
如何辨别假网站 浏览:711
宽带用别人的账号密码 浏览:556
新app如何占有市场 浏览:42

友情链接