java swing 登陆界面

 

 

布局设成null,其中的组件都设定位置

 
import javax.swing.*;

public class LoadDialog extends javax.swing.JDialog {
 private JPanel outer;
 private JLabel one;
 private JLabel three;
 private JPasswordField pw3;
 private JPasswordField pw2;
 private JPasswordField pw1;
 private JLabel two;
 public static void main(String[] args) {
  SwingUtilities.invokeLater(new Runnable() {
   public void run() {
    LoadDialog inst = new LoadDialog(null);
    inst.setResizable(false);
    inst.setLocationRelativeTo(null);
    inst.setVisible(true);
   }
  });
 }
 
 public LoadDialog(JFrame frame) {
  super(frame);
  initGUI();
 }
 
 private void initGUI() {
  try {
   setTitle("修改密码:");
   getContentPane().setLayout(null);
   {
    outer = new JPanel();
    getContentPane().add(outer);
    outer.setBounds(41, 34, 313, 194);
    outer.setBorder(BorderFactory.createTitledBorder("修改信息:"));
    outer.setLayout(null);
    {
     one = new JLabel();
     outer.add(one);
     one.setText("输入原密码:");
     one.setBounds(44, 56, 69, 15);
    }
    {
     two = new JLabel();
     outer.add(two);
     two.setText("输入新密码:");
     two.setBounds(44, 90, 69, 15);
    }
    {
     three = new JLabel();
     outer.add(three);
     three.setText("重复原密码:");
     three.setBounds(44, 126, 69, 15);
    }
    {
     pw1 = new JPasswordField();
     outer.add(pw1);
     pw1.setText("");
     pw1.setBounds(119, 52, 133, 22);
    }
    {
     pw2 = new JPasswordField();
     outer.add(pw2);
     pw2.setText("");
     pw2.setBounds(119, 86, 133, 22);
    }
    {
     pw3 = new JPasswordField();
     outer.add(pw3);
     pw3.setText("");
     pw3.setBounds(119, 122, 133, 22);
    }
   }
   setSize(400, 300);
  } catch (Exception e) {
   e.printStackTrace();
  }
 
 }

}
  
  
 
   
 
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值