private Container makeMainPane(){
??? Container original=new JPanel();  //为什么不是JPanel original = new JPanel()
original.setLayout(new BoxLayout(original,BoxLayout.Y_AXIS));
??? //BoxLayout是什么布局,怎么用? JPanel numPane=new JPanel(new GridLayout(3,1));

JLabel currentAdmLabel;
if(currentAdm==null)
currentAdmLabel=new JLabel();
else
currentAdmLabel=new JLabel("Current Administrator's ID:"+currentAdm.getID());
admNumLabel=new JLabel("Number of Administrators:"+Server.getServerDatabase().getAdmNum());
admNumLabel.setHorizontalAlignment(SwingConstants.CENTER);
currentAdmLabel.setHorizontalAlignment(SwingConstants.CENTER);
statusLabel=new JLabel();
numPane.add(currentAdmLabel);
numPane.add(admNumLabel);
numPane.add(statusLabel);

JPanel idPane=new JPanel(new GridLayout(1,2));
JLabel idLabel=new JLabel("Administrator's ID:");
idField=new JFormattedTextField();
idField.setValue(new Integer(0));
idPane.add(idLabel);
idPane.add(idField);

JPanel buttonPane=new JPanel(new GridLayout(1,4));
JButton button=new JButton("Add New");  //button add
button.setMnemonic(KeyEvent.VK_A);
??? button.setActionCommand(ADD);     //是什么意思呀,为什么只用一个按钮呀
button.addActionListener(this);
button.setToolTipText("To add a new administrator.");
buttonPane.add(button);
button=new JButton("Delete");  //del button
button.setMnemonic(KeyEvent.VK_D);
button.setToolTipText("To delete an administrator from database.");
button.setActionCommand(DEL);
button.addActionListener(this);
buttonPane.add(button);
button=new JButton("Repassword"); //repassword button
button.setMnemonic(KeyEvent.VK_R);
button.setToolTipText("To change current administrator's password.");
button.setActionCommand(REPW);
button.addActionListener(this);
buttonPane.add(button);
button=new JButton("Exit");   //exit buton
button.setMnemonic(KeyEvent.VK_E);
button.setActionCommand(EXIT);
button.addActionListener(this);
buttonPane.add(button);

JPanel pwPane=new JPanel(new GridLayout(1,3));
pwLabel=new JLabel();
pwField=new JPasswordField();
pwField.setActionCommand(OK);
pwField.addActionListener(this);
pwField.setEchoChar('●');
pwField.setEnabled(false);
pwButton=new JButton("OK");
pwButton.setEnabled(false);
pwButton.setActionCommand(OK);
pwButton.addActionListener(this);
pwPane.add(pwLabel);
pwPane.add(pwField);
pwPane.add(pwButton);

original.add(numPane);
original.add(idPane);
original.add(buttonPane);
original.add(pwPane);
return original;
}frame.setDefaultLookAndFeelDecorated(true);   请问这个方法是什么意思呀????JOptionPane.showMessageDialog(frame,"ID:"+currentAdm.getID()+" Password has been changed! Please secure it!","Change Successfull",JOptionPane.INFORMATION_MESSAGE);
 请问这个方法是什么意思呀!!!pwField.requestFocusInWindow(); 还有这个是方法是意思呀。

解决方案 »

  1.   

    1.为什么不是JPanel original = new JPanel()
    Container是JPanel的父类,可以将子类对象赋值给父类变量.2.BoxLayout是什么布局,怎么用?
    象盒子一样,可以X方向排列,也可以Y方向排列.3.是什么意思呀,为什么只用一个按钮呀
    为按钮设置一个actionCommand,可以在事件处理取出,用于判断是哪个按钮被按下。4.请问这个方法是什么意思呀????
    设置窗口具有装饰效果,比普通窗口好看些(我没觉得)。5.请问这个方法是什么意思呀!!!
    弹出对话框。6.还有这个是方法是意思呀。
    pwField请求获取输入焦点。