operatorview.java
来自「一个企业小型固定资产系统的源代码。发布出来让刚学习java的人研究。」· Java 代码 · 共 99 行
JAVA
99 行
package project;
import javax.swing.*;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Rectangle;
/*修改密码对话框*/
public class OperatorView extends JDialog {
public OperatorPanel p1;
public OperatorView(ButPanel p2) {
JLabel lblTiTle = new JLabel("登录密码修改");
lblTiTle.setFont(new Font("隶书", Font.PLAIN, 30));
lblTiTle.setHorizontalAlignment(SwingConstants.CENTER);
getContentPane().setLayout(new BorderLayout());
p1 = new OperatorPanel();
getContentPane().add(lblTiTle,BorderLayout.NORTH);
getContentPane().add(p1,BorderLayout.CENTER);
getContentPane().add(p2,BorderLayout.SOUTH);
}
}
class OperatorPanel extends JPanel {
private Container cont;
private GridBagLayout layout;
private GridBagConstraints cons;
JLabel lblTitile = new JLabel();
JLabel lblUserID = new JLabel();
JLabel lblUP_UOP = new JLabel();
JLabel lblUP_New = new JLabel();
JTextField jtfOpUserID ;
JPasswordField jtfUP_Old ;
JPasswordField jtfUP_New ;
public OperatorPanel() {
cont = this;
layout = new GridBagLayout();
cont.setLayout(layout);
cons = new GridBagConstraints();
lblUserID = new JLabel("登录ID");
lblUP_UOP = new JLabel("原密码");
lblUP_New = new JLabel("新密码");
jtfOpUserID = new JTextField(10);
jtfUP_Old = new JPasswordField(10);
jtfUP_New = new JPasswordField(10);
addComponent( lblUserID,1,0,1,1);
addComponent(lblUP_UOP ,2,0,1,1);
addComponent(lblUP_New,3,0,1,1);
addComponent( jtfOpUserID,1,1,1,1);
addComponent( jtfUP_Old,2,1,1,1);
addComponent(jtfUP_New,3,1,1,1);
if(Share.condition>1){
jtfOpUserID.setText(Share.operator);
jtfOpUserID.setEnabled(false);
}
setVisible(true);
}
private void addComponent(Component comp,
int row,int column,int width,int height) {
cons.gridx = column;
cons.gridy = row;
cons.gridwidth = width;
cons.gridheight = height;
layout.setConstraints(comp,cons);
cont.add(comp);
}
}
class UptOperatorView extends OperatorView {
public UptOperatorView(ButPanel p) {
super(p);
setTitle("修改密码");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?