?? delfriendgui.java
字號:
package chatDog;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class delFriendGUI extends JFrame implements Const{
private JCheckBox[] toDel;
public JButton btnDelFriendOK=new JButton("確認");
private JButton cancel=new JButton("取消");
private JMenuItem par;
delFriendGUI(JMenuItem p){
this.setSize(400,500);
this.setLocation(500,30);
this.setLayout(new BorderLayout());
par=p;
cancel.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
hideGUI();
}
});
btnDelFriendOK.setActionCommand(BTN_DELFRIENDOK);
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
hideGUI();
}
});
}
public void showGUI(Friend[] friend,int fNum){
this.getContentPane().removeAll();
JPanel temp=null;
JPanel tempbk=new JPanel();
toDel=new JCheckBox[fNum];
tempbk.setLayout(new GridLayout(fNum,1));
for(int i=0;i<=fNum-1;i++){
temp=new JPanel();
toDel[i]=new JCheckBox();
toDel[i].setSelected(true);
temp.add(toDel[i]);
temp.add(new JLabel(friend[i].name+"("+friend[i].IP+")"));
tempbk.add(temp);
}
JScrollPane bk=new JScrollPane(tempbk);
temp=new JPanel();
temp.setLayout(new FlowLayout());
temp.add(btnDelFriendOK);
temp.add(cancel);
this.getContentPane().add(bk,"Center");
this.getContentPane().add(temp,"South");
this.setVisible(true);
par.setEnabled(false);
this.repaint();
}
public void hideGUI(){
this.setVisible(false);
par.setEnabled(true);
}
public boolean isFriendSelect(int ID){
return toDel[ID].isSelected();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -