📄 clientboard.java
字号:
//对操作面板添加内容和设置布局
oprationPanel.setLayout(null);
oprationPanel.add(newUserButton);
oprationPanel.add(changePasswordButton);
oprationPanel.add(addCoinButton);
oprationPanel.add(searchUserButton);
oprationPanel.add(searchUserText);
oprationPanel.add(searchFileButton);
oprationPanel.add(searchFileText);
oprationPanel.add(upLoadButton);
oprationPanel.add(downLoadButton);
newUserButton.setBounds(10,35,80,30);
changePasswordButton.setBounds(10,75,80,30);
addCoinButton.setBounds(10,115,80,30);
upLoadButton.setBounds(10,155,80,30);
downLoadButton.setBounds(10,195,80,30);
searchUserButton.setBounds(10,235,80,30);
searchUserText.setBounds(12,270,80,25);
searchFileButton.setBounds(10,310,80,30);
searchFileText.setBounds(12,345,80,25);
oprationPanel.setBounds(26,105,120,560);
//向当前容器添加面板
contentPane.add(loginPanel);
contentPane.add(oprationPanel);
contentPane.add(userScrollPane);
contentPane.add( fileScrollPane);
contentPane.add(userInformationPanel);
contentPane.setVisible(true);
//向登录对话框添加内容和设置布局
loginDialog.setLayout(null);
//loginDialog.
JPanel l1=new JPanel();
l1.add(nameInLabel);l1.add(userNameText);
loginDialog.add(l1);l1.setBounds(30,35,200,25);
JPanel l2=new JPanel();
l2.add(passwordInLabel);l2.add(userPasswordText);
loginDialog.add(l2);l2.setBounds(30,75,200,25);
JPanel l3=new JPanel();
l3.add(OKButton1);l3.add(cancelButton1);
loginDialog.add(l3);l3.setBounds(50,120,200,25);
l3.setLayout(null);
OKButton1.setBounds(25,8,55,25);
cancelButton1.setBounds(100,8,55,25);
//loginDialog.addWindowListener(new WL());
//向退出对话框添加内容和设置布局
quitDialog.setLayout(null);
JPanel q1=new JPanel();
JPanel q2=new JPanel();
q1.setFont(new Font("宋体",Font.BOLD,16));
q1.add(quitLabel);
q2.add(OKButton5);
q2.add(cancelButton5);
quitDialog.add(q1);
quitDialog.add(q2);
q1.setLayout(null);
q2.setLayout(null);
q1.setBounds(15,15,300,25);
q2.setBounds(60,45,160,25);
quitLabel.setBounds(25,15,250,25);
OKButton5.setBounds(10,40,60,25);
cancelButton5.setBounds(90,40,60,25);
//向用户须知对话框添加内容和设置布局
newUserReadDialog.setLayout(null);
JPanel nurd1=new JPanel();
JPanel nurd2=new JPanel();
nurd1.setLayout(new GridLayout(12,1,0,10));
nurd1.add(newUserReadLabel1);
nurd1.add(newUserReadLabel2);
nurd1.add(newUserReadLabel3);
nurd1.add(newUserReadLabel4);
nurd1.add(newUserReadLabel5);
nurd1.add(newUserReadLabel6);
nurd1.add(newUserReadLabel7);
nurd1.add(newUserReadLabel8);
nurd1.add(newUserReadLabel9);
nurd1.add(newUserReadLabel10);
nurd1.add(newUserReadLabel11);
nurd1.add(newUserReadLabel12);
nurd2.add(OKButton7);
nurd2.add(cancelButton7);
newUserReadDialog.add(nurd1);
newUserReadDialog.add(nurd2);
nurd1.setBounds(35,40,440,300);
nurd2.setBounds(80,355,300,25);
nurd2.setLayout(null);
OKButton7.setBounds(50,0,60,25);
cancelButton7.setBounds(155,0,60,25);
//向注册新用户对话框添加内容和设置布局
newUserDialog.setLayout(null);
JPanel nud1=new JPanel();
JPanel nud2=new JPanel();
JPanel nud3=new JPanel();
JPanel nud4=new JPanel();
nud1.add(newUserNameLabel);
nud1.add(newUserNameText);
nud2.add(newUserPasswordLabel1);
nud2.add(newUserPasswordText1);
nud3.add(newUserPasswordLabel2);
nud3.add(newUserPasswordText2);
nud4.add(OKButton6);
nud4.add(resetButton);
nud4.add(cancelButton6);
newUserDialog.add(nud1);
newUserDialog.add(nud2);
newUserDialog.add(nud3);
newUserDialog.add(nud4);
nud1.setBounds(10,30,240,25);
nud2.setBounds(10,70,240,25);
nud3.setBounds(10,110,240,25);
nud4.setBounds(25,150,240,25);
//nud4.setLayout(null);
//向更改密码对话框添加内容和设置布局
changePasswordDialog.setLayout(null);
JPanel c1=new JPanel();
JPanel c2=new JPanel();
JPanel c3=new JPanel();
JPanel c4=new JPanel();
c1.add(oldPasswordLabel);c1.add(oldPasswordText);
c2.add(newPasswordLabel1);c2.add(newPasswordText1);
c3.add(newPasswordLabel2);c3.add(newPasswordText2);
c4.add(OKButton2);c4.add(cancelButton2);
changePasswordDialog.add(c1);
changePasswordDialog.add(c2);
changePasswordDialog.add(c3);
changePasswordDialog.add(c4);
c1.setBounds(30,30,220,25);
c2.setBounds(30,65,220,25);
c3.setBounds(30,100,220,25);
c4.setBounds(50,135,190,25);
//向充值对话框添加内容和设置布局
addCoinDialog.setLayout(null);
JPanel a1=new JPanel();
JPanel a2=new JPanel();
a1.add(coinCardNumberInLabel);a1.add(coinCardNumberText);
a2.add(OKButton3);a2.add(cancelButton3);
addCoinDialog.add(a1);addCoinDialog.add(a2);
a1.setBounds(15,15,400,25);
a2.setBounds(60,35,180,25);
a1.setLayout(null);
coinCardNumberInLabel.setBounds(0,45,85,25);
coinCardNumberText.setBounds(95,45,300,25);
a2.setLayout(null);
OKButton3.setBounds(90,75,40,25);
cancelButton3.setBounds(165,75,40,25);
//向警示对话框添加内容和设置布局
warningDialog.setLayout(null);
JPanel w1=new JPanel();
warningDialog.add(w1);
w1.add(warningLabel);
w1.add(OKButton4);
w1.setBounds(0,30,440,80);
w1.setLayout(null);
warningLabel.setBounds(15,0,420,30);
OKButton4.setBounds(150,50,80,30);
//warningText.appendText(warningString);
//向按扭添加监听器
loginButton.addActionListener(this);
changeUserButton.addActionListener(this);
quitButton.addActionListener(this);
OKButton1.addActionListener(this);
cancelButton1.addActionListener(this);
OKButton2.addActionListener(this);
cancelButton2.addActionListener(this);
OKButton3.addActionListener(this);
cancelButton3.addActionListener(this);
OKButton4.addActionListener(this);
OKButton5.addActionListener(this);
cancelButton5.addActionListener(this);
OKButton6.addActionListener(this);
resetButton.addActionListener(this);
cancelButton6.addActionListener(this);
OKButton7.addActionListener(this);
cancelButton7.addActionListener(this);
newUserButton.addActionListener(this);
changePasswordButton.addActionListener(this);
addCoinButton.addActionListener(this);
upLoadButton.addActionListener(this);
downLoadButton.addActionListener(this);
searchUserButton.addActionListener(this);
searchFileButton.addActionListener(this);
searchUserText.addActionListener(this);
searchFileText.addActionListener(this);
systemInformationItem.addActionListener(this);
quitItem.addActionListener(this);
closeWindowItem.addActionListener(this);
changePasswordItem.addActionListener(this);
changeUserItem.addActionListener(this);
fileInserverListUp.addActionListener(this);
fileInserverListDown.addActionListener(this);
userOnlineList.addActionListener(this);
userFileText.addActionListener(this);
userFileList.addActionListener(this);
fileInserverListUp.addItemListener(this);
fileInserverListDown.addItemListener(this);
userOnlineList.addItemListener(this);
userFileList.addItemListener(this);
loginDialog.addWindowListener(new WL(loginDialog));
changePasswordDialog.addWindowListener(new WL(changePasswordDialog));
addCoinDialog.addWindowListener(new WL(addCoinDialog));
newUserDialog.addWindowListener(new WL(newUserDialog));
newUserReadDialog.addWindowListener(new WL(newUserReadDialog));
warningDialog.addWindowListener(new WL(warningDialog));
quitDialog.addWindowListener(new WL(quitDialog));
warningText.addTextListener(this);
//warningText.getDocument().addDocumentListener(new DL());
}
public void stringContent()
{
/* userOnlineString=cc.userOnlineString();
for (int i=0;i<cc.fileInserverString.length()
fileInserverStringUp[i]=cc.fileInserverString.[i];
for (int i=0;i<cc.fileInserverString.length();i++)
fileInserverStringDown[i]=cc.fileInserverString[cc.fileInserverString.length()-1-i];*/
}
public void listContent(String[] string)
{ /*fileInserverListUp.add(fileInserverStringUp);
fileInserverListDoen.add(fileInserverStringDown);
userOnlineList.add(userOnlineString);
*/
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==loginButton)
{
loginDialog.setBounds(350,315,285,180);
loginDialog.setVisible(true);
}
if(e.getSource()==OKButton1)
{
//login();
System.out.println(userNameText.getText());
System.out.println(userPasswordText.getPassword());
userNameText.setText("");
userPasswordText.setText("");
loginDialog.dispose();
//若登录成功
userName="wrh";
userMoney="4569";
userTime="0";
warningText.setText(userName+"已经登录");
userName="wrh";
userMoney="242";
userTime="01";
}
if(e.getSource()== cancelButton1)
{
userNameText.setText("");
userPasswordText.setText("");
}
if(e.getSource()== changeUserButton)
{
//quit ()
loginDialog.setBounds(350,315,285,180);
loginDialog.setVisible(true);
}
if(e.getSource()==quitButton)
{
quitDialog.setBounds(350,320,300,160);
quitDialog.setVisible(true);
}
if(e.getSource()==OKButton5)
{
//quit();
quitDialog.dispose();
warningText.setText(userName+"已经离线");
}
if(e.getSource()==cancelButton5)
{
quitDialog.dispose();
}
if(e.getSource()==newUserButton)
{
newUserReadDialog.setBounds(280,195,500,400);
newUserReadDialog.setVisible(true);
newUserReadDialog.dispose();
}
if(e.getSource()==OKButton7)
{ newUserReadDialog.dispose();
newUserDialog.setBounds(350,300,320,200);
newUserDialog.setVisible(true);
}
if(e.getSource()==cancelButton7)
{
newUserReadDialog.dispose();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -