com.jgoodies.looks.windows
Class WindowsComboBoxUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ComboBoxUI
          extended by javax.swing.plaf.basic.BasicComboBoxUI
              extended by com.sun.java.swing.plaf.windows.WindowsComboBoxUI
                  extended by com.jgoodies.looks.windows.WindowsComboBoxUI

public class WindowsComboBoxUI
extends com.sun.java.swing.plaf.windows.WindowsComboBoxUI

The JGoodies Windows Look&Feel implementation o ComboBoxUI Corrects the editor insets for editable combo boxe as well as the render insets for non-editable combos. And it ha the same height as text fields - unless you change the renderer.

Version:
$Revision: 1.26 $
Author:
Karsten Lentzsch
See Also:
Options.COMBO_POPUP_PROTOTYPE_DISPLAY_VALUE_KEY

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.java.swing.plaf.windows.WindowsComboBoxUI
com.sun.java.swing.plaf.windows.WindowsComboBoxUI.WindowsComboBoxEditor
 
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicComboBoxUI
BasicComboBoxUI.ComboBoxLayoutManager, BasicComboBoxUI.FocusHandler, BasicComboBoxUI.ItemHandler, BasicComboBoxUI.KeyHandler, BasicComboBoxUI.ListDataHandler, BasicComboBoxUI.PropertyChangeHandler
 
Field Summary
 
Fields inherited from class javax.swing.plaf.basic.BasicComboBoxUI
arrowButton, cachedMinimumSize, comboBox, currentValuePane, editor, focusListener, hasFocus, isMinimumSizeDirty, itemListener, keyListener, listBox, listDataListener, popup, popupKeyListener, popupMouseListener, popupMouseMotionListener
 
Constructor Summary
WindowsComboBoxUI()
           
 
Method Summary
protected  void configureEditor()
           
protected  JButton createArrowButton()
          Creates the arrow button that is to be used in the combo box.
protected  ComboBoxEditor createEditor()
          Creates the editor that is to be used in editable combo boxes.
protected  LayoutManager createLayoutManager()
          Creates a layout manager for managing the components whic make up the combo box.
protected  ComboPopup createPopup()
          Creates a ComboPopup that honors the optional combo popup display valu that is used to compute the popup menu width.
protected  ListCellRenderer createRenderer()
          Creates the default renderer that will be used in a non-editiable comb box.
static ComponentUI createUI(JComponent b)
           
 Dimension getMinimumSize(JComponent c)
          The minumum size is the size of the display area plus insets plus the button.
 Dimension getPreferredSize(JComponent c)
          Delegates to #getMinimumSize(Component).
protected  void installListeners()
           
 void installUI(JComponent c)
           
protected  boolean isRendererBorderRemovable(JComponent rendererComponent)
          Checks and answer whether the border of the given renderer componen can be removed temporarily, so the combo's selection background wil be consistent with the default renderer and native appearance.
 void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
          Paints the currently selected item.
protected  Rectangle rectangleForCurrentValue()
          Returns the area that is reserved for drawing the currently selected item.
protected  void uninstallListeners()
           
 
Methods inherited from class com.sun.java.swing.plaf.windows.WindowsComboBoxUI
installKeyboardActions, paint, paintCurrentValueBackground, unconfigureEditor, uninstallUI
 
Methods inherited from class javax.swing.plaf.basic.BasicComboBoxUI
addEditor, configureArrowButton, createFocusListener, createItemListener, createKeyListener, createListDataListener, createPropertyChangeListener, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getDefaultSize, getDisplaySize, getInsets, getMaximumSize, installComponents, installDefaults, isFocusTraversable, isNavigationKey, isPopupVisible, removeEditor, selectNextPossibleValue, selectPreviousPossibleValue, setPopupVisible, toggleOpenClose, unconfigureArrowButton, uninstallComponents, uninstallDefaults, uninstallKeyboardActions
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowsComboBoxUI

public WindowsComboBoxUI()
Method Detail

createUI

public static ComponentUI createUI(JComponent b)

installUI

public void installUI(JComponent c)
Overrides:
installUI in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI

installListeners

protected void installListeners()
Overrides:
installListeners in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI

uninstallListeners

protected void uninstallListeners()
Overrides:
uninstallListeners in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI

createArrowButton

protected JButton createArrowButton()
Creates the arrow button that is to be used in the combo box.

Overrides:
createArrowButton in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI

createEditor

protected ComboBoxEditor createEditor()
Creates the editor that is to be used in editable combo boxes This method only gets called if a custom editor has not alread been installed in the JComboBox.

Overrides:
createEditor in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI

createLayoutManager

protected LayoutManager createLayoutManager()
Creates a layout manager for managing the components whic make up the combo box.

Overrides:
createLayoutManager in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI
Returns:
an instance of a layout manager

configureEditor

protected void configureEditor()
Overrides:
configureEditor in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI

createPopup

protected ComboPopup createPopup()
Creates a ComboPopup that honors the optional combo popup display valu that is used to compute the popup menu width.

Overrides:
createPopup in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI

createRenderer

protected ListCellRenderer createRenderer()
Creates the default renderer that will be used in a non-editiable comb box. A default renderer will used only if a renderer has not bee explicitly set with setRenderer.

Overrides:
createRenderer in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI
Returns:
a ListCellRender used for the combo box
See Also:
JComboBox.setRenderer(javax.swing.ListCellRenderer)

getMinimumSize

public Dimension getMinimumSize(JComponent c)
The minumum size is the size of the display area plus insets plus the button.

Overrides:
getMinimumSize in class BasicComboBoxUI

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Delegates to #getMinimumSize(Component) Overridden to return the same result in JDK 1.5 as in JDK 1.4.

Overrides:
getPreferredSize in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI

paintCurrentValue

public void paintCurrentValue(Graphics g,
                              Rectangle bounds,
                              boolean hasFocus)
Paints the currently selected item.

Overrides:
paintCurrentValue in class com.sun.java.swing.plaf.windows.WindowsComboBoxUI

isRendererBorderRemovable

protected boolean isRendererBorderRemovable(JComponent rendererComponent)
Checks and answer whether the border of the given renderer componen can be removed temporarily, so the combo's selection background wil be consistent with the default renderer and native appearance This test is invoked from #paintCurrentValue.

#update, #paint and #paintBorder Since we know the default renderer, we can remove its border.

Boolean.TRUE. If this client property is set its value will be returned. If it is not set, true is returne if and only if the component's border is an EmptyBorder.

Parameters:
rendererComponent - the renderer component to check
Returns:
true if the component's border can be removed, false if not
See Also:
paintCurrentValue(Graphics, Rectangle, boolean)

rectangleForCurrentValue

protected Rectangle rectangleForCurrentValue()
Returns the area that is reserved for drawing the currently selected item.

Overrides:
rectangleForCurrentValue in class BasicComboBoxUI


Copyright © 2001-2013 JGoodies Software GmbH. All Rights Reserved.