01: /*
02: * @(#)BasicJidePopupMenuUI.java 12/13/2006
03: *
04: * Copyright 2002 - 2006 JIDE Software Inc. All rights reserved.
05: */
06:
07: package com.jidesoft.plaf.basic;
08:
09: import com.jidesoft.swing.SimpleScrollPane;
10:
11: import javax.swing.*;
12: import javax.swing.plaf.ComponentUI;
13: import javax.swing.plaf.basic.BasicPopupMenuUI;
14:
15: public class BasicJidePopupMenuUI extends BasicPopupMenuUI {
16: public BasicJidePopupMenuUI() {
17: }
18:
19: public static ComponentUI createUI(JComponent c) {
20: return new BasicJidePopupMenuUI();
21: }
22:
23: @Override
24: public Popup getPopup(JPopupMenu popupMenu, int x, int y) {
25: PopupFactory popupFactory = PopupFactory.getSharedInstance();
26: SimpleScrollPane contents = new SimpleScrollPane(popupMenu,
27: SimpleScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
28: SimpleScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
29: contents.getScrollUpButton().setOpaque(true);
30: contents.getScrollDownButton().setOpaque(true);
31: contents.setBorder(BorderFactory.createEmptyBorder());
32: return popupFactory.getPopup(popupMenu.getInvoker(), contents,
33: x, y);
34: }
35: }
|