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


Java WindowsComboBoxUI类代码示例

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


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

示例1: updateUI

import com.sun.java.swing.plaf.windows.WindowsComboBoxUI; //导入依赖的package包/类
@Override
public void updateUI() {
    ComboBoxUI cui = (ComboBoxUI) UIManager.getUI(this);
    if (cui instanceof MetalComboBoxUI) {
        cui = new MetalTreeComboBoxUI();
    } else if (cui instanceof MotifComboBoxUI) {
        cui = new MotifTreeComboBoxUI();
    } else if (cui instanceof WindowsComboBoxUI) {
        cui = new WindowsTreeComboBoxUI();
    }
    setUI(cui);
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:13,代码来源:JTreeComboBox.java

示例2: initComboBox

import com.sun.java.swing.plaf.windows.WindowsComboBoxUI; //导入依赖的package包/类
private void initComboBox(JComboBox<?> combo) {
    if (combo.getUI() instanceof WindowsComboBoxUI) {
        combo.setUI(new RightPopupWindowsComboBoxUI());
    } else {
        combo.setUI(new RightPopupBasicComboBoxUI());
    }
    combo.addPopupMenuListener(new RightPopupMenuListener());
}
 
开发者ID:aterai,项目名称:java-swing-tips,代码行数:9,代码来源:MainPanel.java

示例3: MainPanel

import com.sun.java.swing.plaf.windows.WindowsComboBoxUI; //导入依赖的package包/类
private MainPanel() {
        super(new BorderLayout());
//         Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
//             @Override public void eventDispatched(AWTEvent event) {
//                 if (event instanceof MouseWheelEvent) {
//                     Object source = event.getSource();
//                     if (source instanceof JScrollPane) {
//                         System.out.println("JScrollPane");
//                         return;
//                     }
//                     ((MouseWheelEvent) event).consume();
//                 }
//             }
//         }, AWTEvent.MOUSE_WHEEL_EVENT_MASK);

        JComboBox<String> combo1 = makeComboBox(5);
        if (combo1.getUI() instanceof WindowsComboBoxUI) {
            combo1.setUI(new WindowsComboBoxUI() {
                @Override protected ComboPopup createPopup() {
                    return new BasicComboPopup2(comboBox);
                }
            });
        } else {
            combo1.setUI(new BasicComboBoxUI() {
                @Override protected ComboPopup createPopup() {
                    return new BasicComboPopup2(comboBox);
                }
            });
        }

        JComboBox<String> combo2 = makeComboBox(20);
        if (combo2.getUI() instanceof WindowsComboBoxUI) {
            combo2.setUI(new WindowsComboBoxUI() {
                @Override protected ComboPopup createPopup() {
                    return new BasicComboPopup3(comboBox);
                }
            });
        } else {
            combo2.setUI(new BasicComboBoxUI() {
                @Override protected ComboPopup createPopup() {
                    return new BasicComboPopup3(comboBox);
                }
            });
        }

        Box box = Box.createVerticalBox();
        box.add(makeTitledPanel("default:", makeComboBox(5)));
        box.add(Box.createVerticalStrut(5));
        box.add(makeTitledPanel("default:", makeComboBox(20)));
        box.add(Box.createVerticalStrut(5));
        box.add(makeTitledPanel("disable right click in drop-down list:", combo1));
        box.add(Box.createVerticalStrut(5));
        box.add(makeTitledPanel("disable right click and scroll in drop-down list:", combo2));
        box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        add(box, BorderLayout.NORTH);
        setPreferredSize(new Dimension(320, 240));
    }
 
开发者ID:aterai,项目名称:java-swing-tips,代码行数:58,代码来源:MainPanel.java


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