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

📄 imageinfo.java

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

import java.awt.Dimension;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;
import java.util.Hashtable;
///import java.io.File;

import javax.swing.JLabel;

import jp.co.ntl.Util;
import jp.co.ntl.ext.GlobalContext;
import jp.co.ntl.ext.JarResources;
import jp.co.ntl.preference.PreferenceInfo;
import javax.swing.JApplet;

public class ImageInfo {
	public static final String BACKGROUND;
	public static final String BACKGROUND_MEDIA_SPOT;
	public static final String BACKGROUND_TOYOTA;
	public static final String BACKGROUND_TOUKOU;
	public static final String LOGIN_BACK;
	public static final String JOB_WAIT_BTN_1;
	public static final String JOB_WAIT_BTN_2;
	public static final String JOB_END_BTN_1;
	public static final String JOB_END_BTN_2;
	public static final String JOB_WAIT_PANEL;
	public static final String JOB_END_PANEL;
	public static final String BTN_PRINT1;
	public static final String BTN_PRINT2;
	public static final String BTN_PRINT3;
	public static final String BTN_REFRESH1;
	public static final String BTN_REFRESH2;
	public static final String BTN_REFRESH3;
	public static final String BTN_CANCEL1;
	public static final String BTN_CANCEL2;
	public static final String BTN_CANCEL3;
	// 2007.10.19 lium 堦妵報嶞儃僞儞捛壛 add start
	public static final String BTN_PRINTALL1;
	public static final String BTN_PRINTALL2;
	public static final String BTN_PRINTALL3;
	// 2007.10.19 lium 堦妵報嶞儃僞儞捛壛 add end
	public static final String BTN_DELETE1;
	public static final String BTN_DELETE2;
	public static final String BTN_DELETE3;
	public static final String BTN_DETAIL1;
	public static final String BTN_DETAIL2;
	public static final String BTN_DETAIL3;
	public static final String BTN_NEXT1;
	public static final String BTN_NEXT2;
	public static final String BTN_NEXT3;
	public static final String BTN_CLOSE_UP;
	public static final String BTN_CLOSE_DOWN;
	public static final String BTN_YES_UP;
	public static final String BTN_YES_DOWN;
	public static final String BTN_NO_UP;
	public static final String BTN_NO_DOWN;
	public static final String ICON_ADMIN_TOOL;
	public static final String ICON_ADMIN_TOOL_LARGE;
	public static final String ICON_PRINT_AUTH_TOOL;
	public static final String ICON_PRINT_AUTH_TOOL_LARGE;
	public static final String ICON_SPOOLER;
	public static final String ICON_USER;
	public static final String ICON_TERMINAL;
	public static final String ICON_PRINTER;
	public static final String ICON_HISTORY;
	public static final String ICON_LOGOUT;
	public static final String BTN_LOGIN1;
	public static final String BTN_LOGIN2;
	public static final String BTN_LOGIN3;
	public static final String BTN_LOGOUT1;
	public static final String BTN_LOGOUT2;
	public static final String BTN_LOGOUT3;
	public static JApplet apt;
	
	static {
		BACKGROUND					= "background.gif";
		BACKGROUND_MEDIA_SPOT		= "background_media_spot.gif";
		BACKGROUND_TOYOTA			= "background_toyota.gif";
		BACKGROUND_TOUKOU			= "background_toukou.gif";
		LOGIN_BACK					= "login_back.gif";
		JOB_WAIT_BTN_1				= "job_wait1.gif";
		JOB_WAIT_BTN_2				= "job_wait2.gif";
		JOB_END_BTN_1				= "job_end1.gif";
		JOB_END_BTN_2				= "job_end2.gif";
		JOB_WAIT_PANEL				= "job_bg1.gif";
		JOB_END_PANEL				= "job_bg2.gif";
		BTN_PRINT1					= "print1.gif";
		BTN_PRINT2					= "print2.gif";
		BTN_PRINT3					= "print3.gif";
		BTN_REFRESH1				= "refresh1.gif";
		BTN_REFRESH2				= "refresh2.gif";
		BTN_REFRESH3				= "refresh3.gif";
		BTN_CANCEL1					= "cancel1.gif";
		BTN_CANCEL2					= "cancel2.gif";
		BTN_CANCEL3					= "cancel3.gif";
		// 2007.10.19 lium 堦妵報嶞儃僞儞捛壛 add start
		BTN_PRINTALL1				= "printall1.gif";
		BTN_PRINTALL2				= "printall2.gif";
		BTN_PRINTALL3				= "printall3.gif";
		// 2007.10.19 lium 堦妵報嶞儃僞儞捛壛 add end
		BTN_DELETE1					= "delete1.gif";
		BTN_DELETE2					= "delete2.gif";
		BTN_DELETE3					= "delete3.gif";
		BTN_DETAIL1					= "detail1.gif";
		BTN_DETAIL2					= "detail2.gif";
		BTN_DETAIL3					= "detail3.gif";
		BTN_NEXT1					= "next1.gif";
		BTN_NEXT2					= "next2.gif";
		BTN_NEXT3					= "next3.gif";
		BTN_CLOSE_UP				= "close_up.gif";
		BTN_CLOSE_DOWN				= "close_down.gif";
		BTN_YES_UP					= "yes_up.gif";
		BTN_YES_DOWN				= "yes_down.gif";
		BTN_NO_UP					= "no_up.gif";
		BTN_NO_DOWN					= "no_down.gif";
		ICON_ADMIN_TOOL				= "icon_admin_tool.gif";
		ICON_ADMIN_TOOL_LARGE		= "icon_admin_tool_large.gif";
		ICON_PRINT_AUTH_TOOL		= "icon_print.gif";
		ICON_PRINT_AUTH_TOOL_LARGE	= "icon_print_large.gif";
		ICON_SPOOLER				= "icon_job.gif";
		ICON_USER					= "icon_user.gif";
		ICON_TERMINAL				= "icon_terminal.gif";
		ICON_PRINTER				= "icon_printer.gif";
		ICON_HISTORY				= "icon_history.gif";
		ICON_LOGOUT					= "icon_logout.gif";
		BTN_LOGIN1					= "login1.gif";
		BTN_LOGIN2					= "login2.gif";
		BTN_LOGIN3					= "login3.gif";
		BTN_LOGOUT1					= "logout1.gif";
		BTN_LOGOUT2					= "logout2.gif";
		BTN_LOGOUT3					= "logout3.gif";
	}

	private static Hashtable ht = new Hashtable();

	public static synchronized Image getImage(String name) {
/*		if (name.equals(BACKGROUND)) {
			name = GlobalContext.getInstance().getPreferenceInfo().getBackgroundImageName();
		}
		Image	image = (Image)ht.get(name); 
		if (image != null) {
			return image;
		}        
//		String	jarPath = docBasePath;
		//jarPath=jarPath.substring(6);
		String	jarPath = "images.jar";
		if (GlobalContext.getInstance().getPreferenceInfo().getClientKind() == PreferenceInfo.CLIENT_MAC) {
			jarPath = GlobalContext.getInstance().getAppName() + ".app/Contents/Resources/Java/" + jarPath;
		}
		
		JarResources	jr = new JarResources(jarPath);
		image = Toolkit.getDefaultToolkit().createImage(jr.getResource(name));
		
		MediaTracker tracker = new MediaTracker(new JLabel());
		tracker.addImage(image, 1);
		try {
			tracker.waitForID(1);
		} catch (InterruptedException e) {
			
		}
		
		ht.put(name, image);		
		return image;*/
	
		Image	image = (Image)ht.get(name); 
		if (image != null) {
			return image;
		}
		//String	jarPath = docBasePath+"images/"+name;
		ClassLoader loader =apt.getClass().getClassLoader();		
		image = apt.getImage(loader.getResource("images/"+name)); 
//		image = Toolkit.getDefaultToolkit().getImage(jarPath.substring(6));
//		image = Toolkit.getDefaultToolkit().getImage(loader.getResource("images/"+name));
		MediaTracker tracker = new MediaTracker(new JLabel());
		tracker.addImage(image, 1);
		try {
			tracker.waitForID(1);
		} catch (InterruptedException e) {			
		}
		ht.put(name, image);		
		return image;
		}
	
	public static synchronized Dimension getDimension(String name) { 
		Image image = (Image)ht.get(name); 
		if (image == null) {	
			image = getImage(name);
		}
		JLabel temp = new JLabel();
		return new Dimension(image.getWidth(temp), image.getHeight(temp));	
	}
}

⌨️ 快捷键说明

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