diff options
author | Matthias Klose <doko@gcc.gnu.org> | 2007-06-03 23:18:43 +0000 |
---|---|---|
committer | Matthias Klose <doko@gcc.gnu.org> | 2007-06-03 23:18:43 +0000 |
commit | e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc (patch) | |
tree | a9c9e7d91c484d53fe154f9285fc57325572ce50 /libjava/classpath/javax/swing/plaf | |
parent | af333b9a7f9e1cc1029bec56d48f2de63acdf686 (diff) | |
download | gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.zip gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.tar.gz gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.tar.bz2 |
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com>
* javax/management/NotificationBroadcasterSupport.java
(getNotificationInfo): Add cast.
* native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include
directories.
* native/jni/qt-peer/Makefile.in: Regenerate.
libjava/ChangeLog:
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/natFileWin32.cc (setFilePermissions): New (stub only).
_access: Handle EXEC query, stub only.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Merged from classpath:
* gnu/java/nio/SelectorProviderImpl.java: Whitespace merge.
* java/lang/System.java(inheritedChannel): New.
* java/lang/Character.java: Remove stray`;'.
* java/net/MulticastSocket.java: Merged.
* java/text/DateFormatSymbols.java(getInstance): New, comment updates.
* java/text/Collator.java(getInstance): Merged.
* java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG.
getDisplayName, getDisplayNames: New.
* java/util/logging/Logger.java: Merged.
* Regenerate .class and .h files.
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/File.java: Merge with classpath-0.95, new method
setFilePermissions, new attribute EXEC.
* java/io/natFilePosix.cc (setFilePermissions): New.
_access: Handle EXEC query.
* classpath/lib/java/io/File.class, java/io/File.h: Regenerate.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Imported GNU Classpath 0.95.
* classpath/Makefile.in,
classpath/native/jni/midi-dssi/Makefile.in,
classpath/native/jni/classpath/Makefile.in,
classpath/native/jni/Makefile.in,
classpath/native/jni/gconf-peer/Makefile.in,
classpath/native/jni/java-io/Makefile.in,
classpath/native/jni/native-lib/Makefile.in,
classpath/native/jni/java-util/Makefile.in,
classpath/native/jni/midi-alsa/Makefile.in,
classpath/native/jni/java-lang/Makefile.in,
classpath/native/jni/java-nio/Makefile.in,
classpath/native/jni/java-net/Makefile.in,
classpath/native/jni/xmlj/Makefile.in,
classpath/native/jni/qt-peer/Makefile.in,
classpath/native/jni/gtk-peer/Makefile.in,
classpath/native/Makefile.in, classpath/native/jawt/Makefile.in,
classpath/native/fdlibm/Makefile.in,
classpath/native/plugin/Makefile.in,
classpath/resource/Makefile.in, classpath/scripts/Makefile.in,
classpath/tools/Makefile.in, classpath/doc/Makefile.in,
classpath/doc/api/Makefile.in, classpath/lib/Makefile.in,
classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in,
classpath/external/sax/Makefile.in,
classpath/external/w3c_dom/Makefile.in,
classpath/external/relaxngDatatype/Makefile.in,
classpath/include/Makefile.in,
classpath/examples/Makefile.in: Regenerate.
* classpath/config.guess, classpath/config.sub,
classpath/ltmain.sh : Update.
* classpath/configure, classpath/depcomp, classpath/missing,
classpath/aclocal.m4, classpath/install-sh: Regenerate.
* gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95.
* sources.am: Regenerate.
* Makefile.in: Regenerate.
* Update the .class files and generated CNI header files, add new
.class and generated CNI header files.
* Remove generated files for removed java source files:
classpath/gnu/java/net/BASE64.java,
classpath/gnu/java/security/util/Base64.java,
classpath/gnu/java/awt/peer/gtk/GThreadMutex.java,
classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java,
classpath/gnu/java/awt/font/autofit/Scaler.java,
classpath/gnu/classpath/jdwp/util/Value.java,
classpath/gnu/javax/net/ssl/Base64.java.
* Remove empty directories.
* Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc.
* java/lang/Class.java(setAccessible): Merge from classpath.
* java/util/Locale.java: Remove.
* gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java,
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New.
* gcj/javaprims.h: Update class declarations.
* scripts/classes.pl: Update usage.
* HACKING: Mention to build all peers.
From-SVN: r125302
Diffstat (limited to 'libjava/classpath/javax/swing/plaf')
11 files changed, 219 insertions, 179 deletions
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java index d98fd2a..ff636d6 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java @@ -215,6 +215,8 @@ public class BasicComboBoxUI extends ComboBoxUI isMinimumSizeDirty = true; comboBox = (JComboBox) c; installDefaults(); + popup = createPopup(); + listBox = popup.getList(); // Set editor and renderer for the combo box. Editor is used // only if combo box becomes editable, otherwise renderer is used @@ -229,14 +231,9 @@ public class BasicComboBoxUI extends ComboBoxUI currentEditor = createEditor(); comboBox.setEditor(currentEditor); } - editor = currentEditor.getEditorComponent(); installComponents(); installListeners(); - if (arrowButton != null) - configureArrowButton(); - if (editor != null) - configureEditor(); comboBox.setLayout(createLayoutManager()); comboBox.setFocusable(true); installKeyboardActions(); @@ -473,13 +470,11 @@ public class BasicComboBoxUI extends ComboBoxUI */ protected void installComponents() { - // create drop down list of items - popup = createPopup(); - listBox = popup.getList(); - // create and install arrow button arrowButton = createArrowButton(); comboBox.add(arrowButton); + if (arrowButton != null) + configureArrowButton(); if (comboBox.isEditable()) addEditor(); @@ -494,24 +489,20 @@ public class BasicComboBoxUI extends ComboBoxUI */ protected void uninstallComponents() { - // uninstall arrow button - unconfigureArrowButton(); - comboBox.remove(arrowButton); - arrowButton = null; - - popup = null; - - if (comboBox.getRenderer() instanceof UIResource) - comboBox.setRenderer(null); + // Unconfigure arrow button. + if (arrowButton != null) + { + unconfigureArrowButton(); + } - // if the editor is not an instanceof UIResource, it was not set by the - // UI delegate, so don't clear it... - ComboBoxEditor currentEditor = comboBox.getEditor(); - if (currentEditor instanceof UIResource) + // Unconfigure editor. + if (editor != null) { - comboBox.setEditor(null); - editor = null; + unconfigureEditor(); } + + comboBox.removeAll(); + arrowButton = null; } /** @@ -521,7 +512,11 @@ public class BasicComboBoxUI extends ComboBoxUI { removeEditor(); editor = comboBox.getEditor().getEditorComponent(); - comboBox.add(editor); + if (editor != null) + { + configureEditor(); + comboBox.add(editor); + } } /** @@ -572,10 +567,8 @@ public class BasicComboBoxUI extends ComboBoxUI { arrowButton.setEnabled(comboBox.isEnabled()); arrowButton.setFocusable(false); - if (popupMouseListener != null) - arrowButton.addMouseListener(popupMouseListener); - if (popupMouseMotionListener != null) - arrowButton.addMouseMotionListener(popupMouseMotionListener); + arrowButton.addMouseListener(popup.getMouseListener()); + arrowButton.addMouseMotionListener(popup.getMouseMotionListener()); // Mark the button as not closing the popup, we handle this ourselves. arrowButton.putClientProperty(BasicLookAndFeel.DONT_CANCEL_POPUP, @@ -855,9 +848,6 @@ public class BasicComboBoxUI extends ComboBoxUI */ public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) { - Object currentValue = comboBox.getSelectedItem(); - boolean isPressed = arrowButton.getModel().isPressed(); - /* Gets the component to be drawn for the current value. * If there is currently no selected item we will take an empty * String as replacement. @@ -1109,7 +1099,6 @@ public class BasicComboBoxUI extends ComboBoxUI // editable Insets i = getInsets(); int arrowSize = comboBox.getHeight() - (i.top + i.bottom); - int editorWidth = comboBox.getBounds().width - arrowSize; if (arrowButton != null) arrowButton.setBounds(comboBox.getWidth() - (i.right + arrowSize), @@ -1345,52 +1334,76 @@ public class BasicComboBoxUI extends ComboBoxUI public void propertyChange(PropertyChangeEvent e) { // Lets assume every change invalidates the minimumsize. - isMinimumSizeDirty = true; - - if (e.getPropertyName().equals("enabled")) + String propName = e.getPropertyName(); + if (propName.equals("enabled")) { - arrowButton.setEnabled(comboBox.isEnabled()); + boolean enabled = comboBox.isEnabled(); + if (editor != null) + editor.setEnabled(enabled); + if (arrowButton != null) + arrowButton.setEnabled(enabled); - if (comboBox.isEditable()) - comboBox.getEditor().getEditorComponent().setEnabled( - comboBox.isEnabled()); + comboBox.repaint(); + } + else if (propName.equals("editor") && comboBox.isEditable()) + { + addEditor(); + comboBox.revalidate(); } else if (e.getPropertyName().equals("editable")) { if (comboBox.isEditable()) { - configureEditor(); addEditor(); } else { - unconfigureEditor(); removeEditor(); } comboBox.revalidate(); - comboBox.repaint(); } - else if (e.getPropertyName().equals("dataModel")) + else if (propName.equals("model")) { // remove ListDataListener from old model and add it to new model ComboBoxModel oldModel = (ComboBoxModel) e.getOldValue(); - if (oldModel != null) + if (oldModel != null && listDataListener != null) oldModel.removeListDataListener(listDataListener); - if ((ComboBoxModel) e.getNewValue() != null) + ComboBoxModel newModel = (ComboBoxModel) e.getNewValue(); + if (newModel != null && listDataListener != null) comboBox.getModel().addListDataListener(listDataListener); + + if (editor != null) + { + comboBox.configureEditor(comboBox.getEditor(), + comboBox.getSelectedItem()); + } + isMinimumSizeDirty = true; + comboBox.revalidate(); + comboBox.repaint(); } - else if (e.getPropertyName().equals("font")) + else if (propName.equals("font")) { Font font = (Font) e.getNewValue(); - editor.setFont(font); + if (editor != null) + { + editor.setFont(font); + } listBox.setFont(font); - arrowButton.setFont(font); + isMinimumSizeDirty = true; + comboBox.revalidate(); + } + else if (propName.equals("prototypeDisplayValue")) + { + isMinimumSizeDirty = true; + comboBox.revalidate(); + } + else if (propName.equals("renderer")) + { + isMinimumSizeDirty = true; comboBox.revalidate(); - comboBox.repaint(); } - // FIXME: Need to handle changes in other bound properties. } } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java index c29829d..11f832a 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java @@ -271,9 +271,17 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup */ public void uninstallingUI() { + if (propertyChangeListener != null) + { + comboBox.removePropertyChangeListener(propertyChangeListener); + } + if (itemListener != null) + { + comboBox.removeItemListener(itemListener); + } uninstallComboBoxModelListeners(comboBox.getModel()); - uninstallListeners(); uninstallKeyboardActions(); + uninstallListListeners(); } /** @@ -466,7 +474,6 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup list.setBorder(null); list.setCellRenderer(comboBox.getRenderer()); list.setFocusable(false); - syncListSelection(); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); installListListeners(); } @@ -1010,15 +1017,6 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup // ------ private helper methods -------------------- /** - * This method uninstalls listeners installed by the UI - */ - private void uninstallListeners() - { - uninstallComboBoxListeners(); - uninstallComboBoxModelListeners(comboBox.getModel()); - } - - /** * This method uninstalls Listeners registered with combo boxes list of * items */ @@ -1031,19 +1029,6 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup listMouseMotionListener = null; } - /** - * This method uninstalls listeners listening to combo box associated with - * this popup menu - */ - private void uninstallComboBoxListeners() - { - comboBox.removeItemListener(itemListener); - itemListener = null; - - comboBox.removePropertyChangeListener(propertyChangeListener); - propertyChangeListener = null; - } - void syncListSelection() { int index = comboBox.getSelectedIndex(); diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java index 1ec020b..ae99259 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java @@ -37,13 +37,14 @@ package javax.swing.plaf.basic; -import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Insets; import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.beans.PropertyChangeEvent; @@ -58,6 +59,7 @@ import javax.swing.JLabel; import javax.swing.KeyStroke; import javax.swing.LookAndFeel; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.LabelUI; import javax.swing.text.View; @@ -80,6 +82,11 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener private Rectangle tr; /** + * A cached Insets object for reuse in the label layout methods. + */ + private Insets cachedInsets; + + /** * Creates a new BasicLabelUI object. */ public BasicLabelUI() @@ -131,7 +138,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener icon.getIconHeight() + insetsY); else { - FontMetrics fm = lab.getFontMetrics(lab.getFont()); + FontMetrics fm = getFontMetrics(lab); ir.x = 0; ir.y = 0; ir.width = 0; @@ -189,43 +196,46 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener public void paint(Graphics g, JComponent c) { JLabel b = (JLabel) c; - FontMetrics fm = g.getFontMetrics(); - - Insets i = c.getInsets(); - vr.x = i.left; - vr.y = i.right; - vr.width = c.getWidth() - i.left + i.right; - vr.height = c.getHeight() - i.top + i.bottom; - ir.x = 0; - ir.y = 0; - ir.width = 0; - ir.height = 0; - tr.x = 0; - tr.y = 0; - tr.width = 0; - tr.height = 0; Icon icon = (b.isEnabled()) ? b.getIcon() : b.getDisabledIcon(); + String text = b.getText(); + if (icon != null || (text != null && ! text.equals(""))) + { + FontMetrics fm = getFontMetrics(b); + Insets i = c.getInsets(cachedInsets); + vr.x = i.left; + vr.y = i.right; + vr.width = c.getWidth() - i.left - i.right; + vr.height = c.getHeight() - i.top - i.bottom; + ir.x = 0; + ir.y = 0; + ir.width = 0; + ir.height = 0; + tr.x = 0; + tr.y = 0; + tr.width = 0; + tr.height = 0; - String text = layoutCL(b, fm, b.getText(), icon, vr, ir, tr); + text = layoutCL(b, fm, text, icon, vr, ir, tr); - if (icon != null) - icon.paintIcon(b, g, ir.x, ir.y); + if (icon != null) + icon.paintIcon(b, g, ir.x, ir.y); - Object htmlRenderer = b.getClientProperty(BasicHTML.propertyKey); - if (htmlRenderer == null) - { - if (text != null && !text.equals("")) + if (text != null && ! text.equals("")) { - if (b.isEnabled()) - paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent()); + Object htmlRenderer = b.getClientProperty(BasicHTML.propertyKey); + if (htmlRenderer == null) + { + if (b.isEnabled()) + paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent()); + else + paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent()); + } else - paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent()); + { + ((View) htmlRenderer).paint(g, tr); + } } } - else - { - ((View) htmlRenderer).paint(g, tr); - } } /** @@ -265,8 +275,6 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener protected void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY) { - Color saved_color = g.getColor(); - g.setColor(l.getBackground().brighter()); int mnemIndex = l.getDisplayedMnemonicIndex(); @@ -283,8 +291,6 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener textY + 1); else g.drawString(s, textX + 1, textY + 1); - - g.setColor(saved_color); } /** @@ -298,9 +304,8 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener * @param textY The y coordinate of the start of the baseline. */ protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, - int textY) + int textY) { - Color saved_color = g.getColor(); g.setColor(l.getForeground()); int mnemIndex = l.getDisplayedMnemonicIndex(); @@ -310,8 +315,6 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener textY); else g.drawString(s, textX, textY); - - g.setColor(saved_color); } /** @@ -514,4 +517,27 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener "press"); } } + + /** + * Fetches a font metrics object for the specified label. This first + * tries to get it from the label object itself by calling + * {@link Component#getFontMetrics(Font)}, and if that does not work + * (for instance, when we are in the initialization and have no parent yet), + * it asks the Toolkit for a font metrics object. + * + * @param l the label + * + * @return a suitable font metrics object + */ + private FontMetrics getFontMetrics(JLabel l) + { + Font font = l.getFont(); + FontMetrics fm = l.getFontMetrics(font); + if (fm == null) + { + Toolkit tk = Toolkit.getDefaultToolkit(); + fm = tk.getFontMetrics(font); + } + return fm; + } } diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java index bfb9e98..3cea0d9 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java @@ -149,57 +149,24 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI g.setFont(f); - ButtonModel m = b.getModel(); - // This is the icon that we use for layout. Icon icon = b.getIcon(); if (icon == null) icon = getDefaultIcon(); + // Figure out the correct icon. + Icon currentIcon = getCurrentIcon(b); + // Do the layout. String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), - b.getText(), icon, + b.getText(), currentIcon == null ? getDefaultIcon() : currentIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewR, iconR, textR, b.getIconTextGap()); - // Figure out the correct icon. - icon = b.getIcon(); - if (icon == null) - icon = getDefaultIcon(); - else - { - if (! m.isEnabled()) - { - if (m.isSelected()) - icon = b.getDisabledSelectedIcon(); - else - icon = b.getDisabledIcon(); - } - else if (m.isArmed() && m.isPressed()) - { - icon = b.getPressedIcon(); - if (icon == null) - icon = b.getSelectedIcon(); - } - else if (m.isSelected()) - { - if (b.isRolloverEnabled() && m.isRollover()) - { - icon = b.getRolloverSelectedIcon(); - if (icon == null) - icon = b.getSelectedIcon(); - } - else - icon = b.getSelectedIcon(); - } - else if (b.isRolloverEnabled() && m.isRollover()) - icon = b.getRolloverIcon(); - if (icon == null) - icon = b.getIcon(); - } // .. and paint it. - icon.paintIcon(c, g, iconR.x, iconR.y); + if (currentIcon != null) + currentIcon.paintIcon(c, g, iconR.x, iconR.y); // Paint text and focus indicator. if (text != null) @@ -218,6 +185,58 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI } } + /** + * Determines the icon to be displayed for the specified radio button. + * + * @param b the radio button + * + * @return the icon + */ + private Icon getCurrentIcon(AbstractButton b) + { + ButtonModel m = b.getModel(); + Icon currentIcon = b.getIcon(); + + if (currentIcon == null) + { + currentIcon = getDefaultIcon(); + } + else + { + if (! m.isEnabled()) + { + if (m.isSelected()) + currentIcon = b.getDisabledSelectedIcon(); + else + currentIcon = b.getDisabledIcon(); + } + else if (m.isPressed() && m.isArmed()) + { + currentIcon = b.getPressedIcon(); + if (currentIcon == null) + currentIcon = b.getSelectedIcon(); + } + else if (m.isSelected()) + { + if (b.isRolloverEnabled() && m.isRollover()) + { + currentIcon = b.getRolloverSelectedIcon(); + if (currentIcon == null) + currentIcon = b.getSelectedIcon(); + } + else + currentIcon = b.getSelectedIcon(); + } + else if (b.isRolloverEnabled() && m.isRollover()) + { + currentIcon = b.getRolloverIcon(); + } + if (currentIcon == null) + currentIcon = b.getIcon(); + } + return currentIcon; + } + public Dimension getPreferredSize(JComponent c) { // This is basically the same code as in diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java index 0d1fa1e..fe36021 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java @@ -1364,7 +1364,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom; int height = 0; - int runHeight = tabAreaInsets.top + insets.top;; + int runHeight = tabAreaInsets.top + insets.top; int fontHeight = fm.getHeight(); int left = insets.left + tabAreaInsets.left; for (int i = 0; i < tabCount; i++) diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java index 5b0ffce..3952ea1 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java @@ -116,7 +116,7 @@ import javax.swing.tree.VariableHeightLayoutCache; * @author Audrius Meskauskas (audriusa@bioinformatics.org) */ public class BasicTreeUI - extends TreeUI + extends TreeUI { /** * The tree cell editing may be started by the single mouse click on the @@ -656,7 +656,18 @@ public class BasicTreeUI */ public Rectangle getPathBounds(JTree tree, TreePath path) { - return treeState.getBounds(path, new Rectangle()); + Rectangle bounds = null; + if (tree != null && treeState != null) + { + bounds = treeState.getBounds(path, null); + Insets i = tree.getInsets(); + if (bounds != null && i != null) + { + bounds.x += i.left; + bounds.y += i.top; + } + } + return bounds; } /** @@ -1561,7 +1572,6 @@ public class BasicTreeUI int startIndex = tree.getClosestRowForLocation(clip.x, clip.y); int endIndex = tree.getClosestRowForLocation(clip.x + clip.width, clip.y + clip.height); - // Also paint dashes to the invisible nodes below. // These should be painted first, otherwise they may cover // the control icons. diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java index be96079..108b3b2 100644 --- a/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java +++ b/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java @@ -174,9 +174,8 @@ public class MetalButtonUI { if (b.isContentAreaFilled()) { - Rectangle area = b.getVisibleRect(); g.setColor(getSelectColor()); - g.fillRect(area.x, area.y, area.width, area.height); + g.fillRect(0, 0, b.getWidth(), b.getHeight()); } } diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java index c24c085..53d49c3 100644 --- a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java +++ b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java @@ -48,7 +48,6 @@ import java.awt.event.MouseEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import javax.swing.CellRendererPane; import javax.swing.ComboBoxEditor; import javax.swing.Icon; import javax.swing.JButton; @@ -217,7 +216,7 @@ public class MetalComboBoxUI extends BasicComboBoxUI */ protected ComboPopup createPopup() { - return new MetalComboPopup(comboBox); + return super.createPopup(); } /** @@ -228,7 +227,7 @@ public class MetalComboBoxUI extends BasicComboBoxUI protected JButton createArrowButton() { JButton button = new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(), - new CellRendererPane(), listBox); + currentValuePane, listBox); button.setMargin(new Insets(0, 1, 1, 3)); return button; } @@ -305,7 +304,6 @@ public class MetalComboBoxUI extends BasicComboBoxUI { MetalComboBoxButton b = (MetalComboBoxButton) arrowButton; d = getDisplaySize(); - Insets insets = b.getInsets(); Insets arrowInsets = b.getInsets(); Insets comboInsets = comboBox.getInsets(); Icon icon = b.getComboIcon(); diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java index 824f1d8..9bded82 100644 --- a/libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java +++ b/libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java @@ -56,9 +56,9 @@ import java.awt.event.MouseListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; -import java.sql.Date; import java.text.DateFormat; import java.text.NumberFormat; +import java.util.Date; import java.util.List; import javax.swing.AbstractAction; @@ -441,7 +441,7 @@ public class MetalFileChooserUI filechooser.revalidate(); filechooser.repaint(); } - }; + } /** * A combo box model containing the selected directory and all its parent diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java b/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java index a9a6790..25c624b 100644 --- a/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java +++ b/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java @@ -75,9 +75,6 @@ public class MetalLookAndFeel extends BasicLookAndFeel /** The current theme. */ private static MetalTheme theme; - /** The look and feel defaults. */ - private UIDefaults LAF_defaults; - /** * Creates a new instance of the Metal look and feel. */ @@ -151,17 +148,10 @@ public class MetalLookAndFeel extends BasicLookAndFeel public UIDefaults getDefaults() { createDefaultTheme(); - if (LAF_defaults == null) - { - LAF_defaults = super.getDefaults(); + UIDefaults def = super.getDefaults(); - // add custom theme entries to the table - if (theme != null) - theme.addCustomEntriesToTable(LAF_defaults); - } - - // Returns the default values for this look and feel. - return LAF_defaults; + theme.addCustomEntriesToTable(def); + return def; } /** diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalMenuBarUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalMenuBarUI.java index 4066194..2cc52ed 100644 --- a/libjava/classpath/javax/swing/plaf/metal/MetalMenuBarUI.java +++ b/libjava/classpath/javax/swing/plaf/metal/MetalMenuBarUI.java @@ -82,7 +82,7 @@ public class MetalMenuBarUI extends BasicMenuBarUI && c.getBackground() instanceof UIResource && height > 2) { - MetalUtils.paintGradient(g, 0, 0, c.getWidth(), height - 2, + MetalUtils.paintGradient(g, 0, 0, c.getWidth(), height, SwingConstants.VERTICAL, "MenuBar.gradient"); paint(g, c); |