Methods Summary |
---|
protected void | configureEditor(){@inheritDoc}
super.configureEditor();
if (XPStyle.getXP() != null) {
editor.addMouseListener(rolloverListener);
}
|
protected javax.swing.JButton | createArrowButton()Creates an button which will be used as the control to show or hide
the popup portion of the combo box.
if (XPStyle.getXP() != null) {
return new XPComboBoxButton();
} else {
return super.createArrowButton();
}
|
protected javax.swing.ComboBoxEditor | createEditor()Creates the default editor that will be used in editable combo boxes.
A default editor will be used only if an editor has not been
explicitly set with setEditor .
return new WindowsComboBoxEditor();
|
protected java.awt.LayoutManager | createLayoutManager()Creates a layout manager for managing the components which make up the
combo box.
return new BasicComboBoxUI.ComboBoxLayoutManager() {
public void layoutContainer(Container parent) {
super.layoutContainer(parent);
if (XPStyle.getXP() != null && arrowButton != null) {
Dimension d = parent.getSize();
Insets insets = getInsets();
int buttonWidth = arrowButton.getPreferredSize().width;
arrowButton.setBounds(WindowsGraphicsUtils.isLeftToRight((JComboBox)parent)
? (d.width - insets.right - buttonWidth)
: insets.left,
insets.top,
buttonWidth, d.height - insets.top - insets.bottom);
}
}
};
|
protected javax.swing.plaf.basic.ComboPopup | createPopup()
return super.createPopup();
|
protected javax.swing.ListCellRenderer | createRenderer(){@inheritDoc}
XPStyle xp = XPStyle.getXP();
if (xp != null && xp.isSkinDefined(comboBox, Part.CP_READONLY)) {
return new WindowsComboBoxRenderer();
} else {
return super.createRenderer();
}
|
public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent c)
return new WindowsComboBoxUI();
|
public java.awt.Dimension | getPreferredSize(javax.swing.JComponent c)
Dimension d = super.getPreferredSize(c);
if (XPStyle.getXP() != null) {
d.width += 5;
} else {
d.width += 4;
}
d.height += 2;
return d;
|
com.sun.java.swing.plaf.windows.TMSchema.State | getXPComboBoxState(javax.swing.JComponent c)
State state = State.NORMAL;
if (!c.isEnabled()) {
state = State.DISABLED;
} else if (isPopupVisible(comboBox)) {
state = State.PRESSED;
} else if (isRollover) {
state = State.HOT;
}
return state;
|
protected void | installKeyboardActions()
super.installKeyboardActions();
|
protected void | installListeners(){@inheritDoc}
super.installListeners();
XPStyle xp = XPStyle.getXP();
//button glyph for LTR and RTL combobox might differ
if (xp != null
&& xp.isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT)) {
comboBox.addPropertyChangeListener("componentOrientation",
componentOrientationListener);
}
|
public void | installUI(javax.swing.JComponent c)
super.installUI( c );
isRollover = false;
comboBox.setRequestFocusEnabled( true );
if (XPStyle.getXP() != null && arrowButton != null) {
//we can not do it in installListeners because arrowButton
//is initialized after installListeners is invoked
comboBox.addMouseListener(rolloverListener);
arrowButton.addMouseListener(rolloverListener);
}
|
public void | paint(java.awt.Graphics g, javax.swing.JComponent c){@inheritDoc}
if (XPStyle.getXP() != null) {
paintXPComboBoxBackground(g, c);
}
super.paint(g, c);
|
public void | paintCurrentValue(java.awt.Graphics g, java.awt.Rectangle bounds, boolean hasFocus)If necessary paints the currently selected item.
XPStyle xp = XPStyle.getXP();
if ( xp != null) {
bounds.x += 2;
bounds.y += 2;
bounds.width -= 4;
bounds.height -= 4;
} else {
bounds.x += 1;
bounds.y += 1;
bounds.width -= 2;
bounds.height -= 2;
}
if (! comboBox.isEditable()
&& xp != null
&& xp.isSkinDefined(comboBox, Part.CP_READONLY)) {
// On vista for READNLY ComboBox
// color for currentValue is the same as for any other item
// mostly copied from javax.swing.plaf.basic.BasicComboBoxUI.paintCurrentValue
ListCellRenderer renderer = comboBox.getRenderer();
Component c;
if ( hasFocus && !isPopupVisible(comboBox) ) {
c = renderer.getListCellRendererComponent(
listBox,
comboBox.getSelectedItem(),
-1,
true,
false );
} else {
c = renderer.getListCellRendererComponent(
listBox,
comboBox.getSelectedItem(),
-1,
false,
false );
}
c.setFont(comboBox.getFont());
if ( comboBox.isEnabled() ) {
c.setForeground(comboBox.getForeground());
c.setBackground(comboBox.getBackground());
} else {
c.setForeground(DefaultLookup.getColor(
comboBox, this, "ComboBox.disabledForeground", null));
c.setBackground(DefaultLookup.getColor(
comboBox, this, "ComboBox.disabledBackground", null));
}
boolean shouldValidate = false;
if (c instanceof JPanel) {
shouldValidate = true;
}
currentValuePane.paintComponent(g, c, comboBox, bounds.x, bounds.y,
bounds.width, bounds.height, shouldValidate);
} else {
super.paintCurrentValue(g, bounds, hasFocus);
}
|
public void | paintCurrentValueBackground(java.awt.Graphics g, java.awt.Rectangle bounds, boolean hasFocus){@inheritDoc}
if (XPStyle.getXP() == null) {
super.paintCurrentValueBackground(g, bounds, hasFocus);
}
|
private void | paintXPComboBoxBackground(java.awt.Graphics g, javax.swing.JComponent c)
XPStyle xp = XPStyle.getXP();
State state = getXPComboBoxState(c);
Skin skin = null;
if (! comboBox.isEditable()
&& xp.isSkinDefined(c, Part.CP_READONLY)) {
skin = xp.getSkin(c, Part.CP_READONLY);
}
if (skin == null) {
skin = xp.getSkin(c, Part.CP_COMBOBOX);
}
skin.paintSkin(g, 0, 0, c.getWidth(), c.getHeight(), state);
|
protected void | unconfigureEditor(){@inheritDoc}
super.unconfigureEditor();
editor.removeMouseListener(rolloverListener);
|
protected void | uninstallListeners(){@inheritDoc}
super.uninstallListeners();
comboBox.removePropertyChangeListener("componentOrientation",
componentOrientationListener);
|
public void | uninstallUI(javax.swing.JComponent c)
comboBox.removeMouseListener(rolloverListener);
if(arrowButton != null) {
arrowButton.removeMouseListener(rolloverListener);
}
super.uninstallUI( c );
|