当前位置: 首页>>代码示例>>Java>>正文


Java BasicDesktopIconUI类代码示例

本文整理汇总了Java中javax.swing.plaf.basic.BasicDesktopIconUI的典型用法代码示例。如果您正苦于以下问题:Java BasicDesktopIconUI类的具体用法?Java BasicDesktopIconUI怎么用?Java BasicDesktopIconUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicDesktopIconUI类属于javax.swing.plaf.basic包,在下文中一共展示了BasicDesktopIconUI类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSetGetUI

import javax.swing.plaf.basic.BasicDesktopIconUI; //导入依赖的package包/类
public void testSetGetUI() {
    BasicDesktopIconUI ui = new BasicDesktopIconUI();
    icon.setUI(ui);
    assertTrue(icon.getUI() == ui);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:6,代码来源:JInternalFrame$JDesktopIconTest.java

示例2: WindowEx

import javax.swing.plaf.basic.BasicDesktopIconUI; //导入依赖的package包/类
WindowEx()
{
	super("", true, true, true, true);
	getDesktopIcon().setUI(new BasicDesktopIconUI()
	{
		protected void installComponents()
		{
			super.installComponents();
		}
		@Override public Dimension getPreferredSize(JComponent c)
		{
			return new Dimension(145, 25);
		}
		protected void uninstallComponents()
		{
			super.uninstallComponents();
		}        
	});
	setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
	// Dispose itself when ESC is pressed from the keyboard
	KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    rootPane.registerKeyboardAction(new ActionListener()
	    {
	    	public void actionPerformed(ActionEvent actionEvent)
	    	{
	    		dispose();
	    	}
	    }, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
    javax.swing.plaf.basic.BasicInternalFrameUI ui = new javax.swing.plaf.basic.BasicInternalFrameUI(this);
    super.setUI(ui);
    ui.getNorthPane().setPreferredSize(new Dimension(ui.getNorthPane().getPreferredSize().width, 22));
    super.setVisible(true);
    
	ModalLayer = new JComponent()
    {
		@Override
    	protected void paintComponent(Graphics g)
    	{
			g.setColor(getBackground());
			g.fillRect(0,0,getWidth(),getHeight());
    	}
		@Override
    	public void setBackground(Color background)
    	{
    		super.setBackground( background );
    	}
    };
	ModalLayer.addMouseListener(new MouseAdapter(){});
	ModalLayer.addMouseMotionListener(new MouseMotionAdapter(){});
	ModalLayer.setOpaque(true);
	ModalLayer.setVisible(false);
	ModalLayer.setEnabled(false);
	ModalLayer.setBackground(new Color(0x22, 0x22, 0x22, 0xae));
	ModalLayer.setLayout(new GridBagLayout());
	super.addComponentListener(new ComponentAdapter(){
		@Override
		public void componentResized(ComponentEvent ce) {
			ModalLayer.setBounds(1, 1, getRootPane().getWidth() - 2, getRootPane().getHeight() - 2);
			ModalLayer.doLayout();
		}
	});
    super.getLayeredPane().add(ModalLayer, JLayeredPane.PALETTE_LAYER);
    
    DataBase.addDataBaseListener(this);
}
 
开发者ID:loli10K,项目名称:doujindb,代码行数:66,代码来源:WindowEx.java


注:本文中的javax.swing.plaf.basic.BasicDesktopIconUI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。