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

📄 mainbasepanel.java

📁 打印管理程序,测试完全通过.windows开发环境.
💻 JAVA
字号:
package jp.co.ntl.swing.ext;

import java.awt.AWTEventMulticaster;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;

import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JPanel;

import jp.co.ntl.Net;
import jp.co.ntl.server.ServerInfo;
import jp.co.ntl.Util;

public class MainBasePanel extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public static final int			ADMIN		= 0;
	public static final int			USER		= 1;
	public static final int			CPP			= 2;
	
	public static final String		ACTCMD_CLOSE_DIALOG = "closeDialog";
	public static final String		ACTCMD_REFRESH_SCREEN = "Refresh.Screen";
	
	protected	JFrame					frame;
	protected	JApplet					applet;
	
	protected Net						net;
	protected ServerInfo				serverInfo;
	protected boolean					admin = false;
	protected int						kind = ADMIN;
	
	protected static DialogManager	dlgMan;
	
	protected String					actionCommand = ACTCMD_CLOSE_DIALOG;
	transient ActionListener			actionListener;
	
	protected MainBasePanel(JFrame frame, int kind) {
		this.frame = frame;
		commonConstractor(kind);
	}
	
	protected MainBasePanel(JApplet applet, int kind) {
		this.applet = applet;
		commonConstractor(kind);
	}
	
	private void commonConstractor(int kind) {
		this.kind = kind;
		dlgMan = new DialogManager(this);
///		buildComponents();
	}
	
	protected void buildComponents() {
		Resource.load(Util.getCurrentLocale());

		serverInfo = new ServerInfo();
/*		try {
			serverInfo.readFromFile();
		} catch (IOException e) {
			;
		}
*/		
		if (applet == null) {
			net = Net.makeInstance(serverInfo.getDocBase());
		} else {
			net = Net.makeInstance(applet);
		}
	}
	
	public ServerInfo getServerInfo() {
		return serverInfo;
	}
	
	public void setActionCommand(String command) {
		actionCommand = command;
	}
	
	public String getActionCommand() {
		return actionCommand;
	}
	
	public synchronized void addActionListener(ActionListener al) {
		actionListener = AWTEventMulticaster.add(actionListener, al);
	}
	
	public synchronized void removeActionListener(ActionListener al) {
		actionListener = AWTEventMulticaster.remove(actionListener, al);
	}
	
    public void sendActionEvent(String command) {
    	if (actionListener != null) {
    		actionCommand = command;
			actionListener.actionPerformed(
					new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand));
    	}
    }
}

⌨️ 快捷键说明

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