當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。