查看本类的 API文档即时通讯网 - 即时通讯开发者社区!
1   /*
2    * Copyright (C) 2015 Jack Jiang(cngeeker.com) The BeautyEye Project. 
3    * All rights reserved.
4    * Project URL:https://github.com/JackJiang2011/beautyeye
5    * Version 3.6
6    * 
7    * Jack Jiang PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
8    * 
9    * BeautyEyeLookAndFeelCross.java at 2015-2-1 20:25:40, original version by Jack Jiang.
10   * You can contact author with jb2011@163.com.
11   */
12  package org.jb2011.lnf.beautyeye;
13  
14  import javax.swing.UIDefaults;
15  import javax.swing.UIManager;
16  import javax.swing.plaf.metal.MetalLookAndFeel;
17  
18  // TODO: Auto-generated Javadoc
19  /**
20   *<p>
21   * BeautyEye Swing外观实现方案 - 跨平台通用外观实现主类.<br>
22   * <p>
23   * 本主题主类仅供跨平台时使用,它可用于Java支持的所有操作系统.
24   * 
25   * @author Jack Jiang(jb2011@163.com)
26   * @version 1.0
27   */
28  // * 参考源码基于JDK_1.6.0_u18.
29  //如果要继承BasicLookAndFeel实现跨平台lnf 则还需要做更多的工作,目前
30  //跨平台时干脆继承MetalLookAndFeel以便站在巨人的肩膀上,节省一些工作量
31  public class BeautyEyeLookAndFeelCross extends MetalLookAndFeel
32  {
33  	static{
34  		BeautyEyeLookAndFeelWin.initLookAndFeelDecorated();
35  	}
36  	
37  	/**
38  	 * Instantiates a new beauty eye look and feel cross.
39  	 */
40  	public BeautyEyeLookAndFeelCross()
41  	{
42  		super();
43  
44  //		//本属性仅对windows平台有效?! -> Jack Jiang最终证实没效果!!!!!!!!!!!
45  //		UIManager.put("Application.useSystemFontSettings", Boolean.TRUE);
46  		//取消Metal LNF中默认的粗体字
47  		UIManager.put("swing.boldMetal", Boolean.FALSE);
48  		//此项如是true,则将会为TabbedPane的内容面板填充天蓝色背景
49  		UIManager.put("TabbedPane.contentOpaque", Boolean.FALSE);
50  		//此项如是true,则将会为TabbedPane的标签填充天蓝色背景
51  		UIManager.put("TabbedPane.tabsOpaque", Boolean.FALSE);
52  		BeautyEyeLNFHelper.implLNF();
53  		
54  		//自定义JFileChooser的L&F实现(为了解决JFileChooser中的文件查看列表的行高问题)
55  		org.jb2011.lnf.beautyeye.ch20_filechooser.__UI__.uiImpl_cross();
56  		
57  //		JFrame.setDefaultLookAndFeelDecorated(true);
58  //		JDialog.setDefaultLookAndFeelDecorated(true);
59  	}
60  	
61  	/* (non-Javadoc)
62  	 * @see javax.swing.plaf.metal.MetalLookAndFeel#getName()
63  	 */
64  	@Override 
65  	public String getName() 
66  	{
67          return "BeautyEyeCross";
68      }
69  
70  	/* (non-Javadoc)
71  	 * @see javax.swing.plaf.metal.MetalLookAndFeel#getID()
72  	 */
73  	@Override 
74      public String getID() 
75      {
76          return "BeautyEyeCross";
77      }
78  
79  	/* (non-Javadoc)
80  	 * @see javax.swing.plaf.metal.MetalLookAndFeel#getDescription()
81  	 */
82  	@Override 
83      public String getDescription() 
84      {
85          return "BeautyEye cross-platform L&F developed by Jack Jiang(jb2011@163.com).";
86      }
87  	
88  	/**
89  	 * Gets the supports window decorations.
90  	 *
91  	 * @return the supports window decorations
92  	 * {@inheritDoc}
93  	 */
94  	@Override 
95  	public boolean getSupportsWindowDecorations() 
96  	{
97  		return true;
98  	}
99  
100 	/* (non-Javadoc)
101 	 * @see javax.swing.plaf.metal.MetalLookAndFeel#isNativeLookAndFeel()
102 	 */
103 	@Override
104 	public boolean isNativeLookAndFeel()
105 	{
106 		return false;
107 	}
108 
109 	/* (non-Javadoc)
110 	 * @see javax.swing.plaf.metal.MetalLookAndFeel#isSupportedLookAndFeel()
111 	 */
112 	@Override
113 	public boolean isSupportedLookAndFeel()
114 	{
115 		return true;
116 	}
117 	
118 	/**
119 	 * {@inheritDoc}
120 	 */
121 	protected void initComponentDefaults(UIDefaults table)
122     {
123 		super.initComponentDefaults(table);
124         initOtherResourceBundle(table);
125     }
126 	/**
127      * Initialize the defaults table with the name of the other ResourceBundle
128      * used for getting localized defaults.
129      */
130     protected void initOtherResourceBundle(UIDefaults table)
131     {
132         table.addResourceBundle( "org.jb2011.lnf.beautyeye.resources.beautyeye" );
133     }
134 }