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

📄 contentmanager.java

📁 一个实现网络会议的软件.包含三个包.其中一个包需JMF的支持.
💻 JAVA
字号:
package clientPackage;
import mediaPackage.*;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeSupport;
import java.util.Vector;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

public class ContentManager extends JPanel implements ActionListener,ListSelectionListener{
	private JList list=new JList();
	private JButton upButton=new JButton("UP");
	private JButton downButton=new JButton("DOWN");
	private JButton importButton=new JButton("IMPORT");
	private JPanel panel=new JPanel();
	private PropertyChangeSupport propertySupport;
	private int mCategory=-1;
	private Vector listData=new Vector();
	public ContentManager(){
		super();
		upButton.addActionListener(this);
		downButton.addActionListener(this);
		importButton.addActionListener(this);
		list.setVisibleRowCount(5);
		list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		list.addListSelectionListener(this);
		propertySupport=new PropertyChangeSupport(this);
		panel.setLayout(new GridLayout(1,3));
		panel.add(upButton);
		panel.add(downButton);
		panel.add(importButton);
		setLayout(new BorderLayout());
		add(new JScrollPane(list),BorderLayout.CENTER);
		add(panel,BorderLayout.SOUTH);
		
	}
	public void addPropertyChangeListener(ClientUI clientUI) {
		propertySupport.addPropertyChangeListener(clientUI);
	}

	public void enableContentManager(boolean b, int myCategory) {
		mCategory=myCategory;
		if (mCategory==Constants.USER) this.importButton.setEnabled(false);
	}

	public void addURL(String strURL) {
		listData.add(strURL);
		list.setListData(listData);
	}
	public void actionPerformed(ActionEvent e) {
		Object o=e.getSource();
		if (o==importButton){
			propertySupport.firePropertyChange("importFired",null,null);
		}
	}
	public void valueChanged(ListSelectionEvent e) {
		// TODO Auto-generated method stub
		int i=list.getSelectedIndex();
		if (i<listData.size()&&i>=0)
			propertySupport.firePropertyChange("selectionChanged",null,listData.get(i));
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -