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

📄 actionscollections.java

📁 含有图形化界面
💻 JAVA
字号:
package com.zsf.manager;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;

class ActionsCollections {
}

class ButtonHandle implements ActionListener
{
	private JButton button;
	private Note note;
	public ButtonHandle(JButton button,Note note)
	{
		this.button=button;
		this.note=note;
		button.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e) {
		if(button.getText().equals("Exit")){
			JOptionPane.showMessageDialog(note, "Sure to quit?", "List",
					JOptionPane.OK_CANCEL_OPTION);
			System.exit(0);
		}else if(button.getText().equals("Save")){
			note.updateRecords();
		}else if(button.getText().equals("Refresh")){
			note.getInformation();
		}
	}
	
}

class ComboBoxHandle implements ActionListener
{
	private JComboBox combobox;
	private Note note;
	public ComboBoxHandle(JComboBox combobox,Note note)
	{
		this.combobox=combobox;
		this.note=note;
		combobox.addActionListener(this);
	}

	public void actionPerformed(ActionEvent e) {
		if("Family".equals(combobox.getSelectedItem().toString())){
			note.selectRecords("Family");
		}else if("Friends".equals(combobox.getSelectedItem().toString())){
			note.selectRecords("Friends");
		}else if("Music".equals(combobox.getSelectedItem().toString())){
			note.selectRecords("Music");
		}else if("Work".equals((String)combobox.getSelectedItem())){
			note.selectRecords("Work");
		}else{
			note.getInformation();
		}
	}
	
}

class MenuItemHandle implements ActionListener
{
	private JMenuItem menuitem;
	private Note note;
	public MenuItemHandle(JMenuItem menuitem,Note note){
		this.menuitem=menuitem;
		this.note=note;
		menuitem.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e) {
		if("Save".equals(menuitem.getText())){
			note.updateRecords();
		}else if("Exit".equals(menuitem.getText())){
			JOptionPane.showMessageDialog(note, "Sure to quit?", "List",
					JOptionPane.OK_CANCEL_OPTION);
			System.exit(0);
		}else if("Add".equals(menuitem.getText())){
			new AddInforFrame().setTitle("Add Members");
		}else if("Delete".equals(menuitem.getText())){
			note.deleteRecords();
			JOptionPane.showMessageDialog(note, "Delete Successfully!", "List",
					JOptionPane.INFORMATION_MESSAGE);
		}
	}
}

class ButtonHandleInInforFrame implements ActionListener
{
	private JButton button;
	private AddInforFrame frame;
	public ButtonHandleInInforFrame(JButton button,AddInforFrame frame) {
		this.button=button;
		this.frame=frame;
		button.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e) {
		if(button.getText().equals("Exit")){
			frame.setVisible(false);
		}else if(button.getText().equals("Save")){
			frame.Save();
		}
	}
}

class RadioButtonHandle implements ActionListener
{
	public  String role;
	public RadioButtonHandle(JRadioButton rb)
	{
		role=rb.getText();		
		rb.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e) {
		//System.out.println(this.initRole());
	}
	public String initRole(){
		return role;
	}
}

⌨️ 快捷键说明

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