本文整理汇总了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);
}
示例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);
}