導航:首頁 > 編程語言 > 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

友情鏈接