⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delfriendgui.java

📁 java简易在线聊天程序
💻 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 + -