summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/javax/swing
diff options
context:
space:
mode:
authordoko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-03 23:18:43 +0000
committerdoko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-03 23:18:43 +0000
commit5bf762459121cc397663d22498d62d71fa179ef6 (patch)
treea9c9e7d91c484d53fe154f9285fc57325572ce50 /libjava/classpath/javax/swing
parent6d7301dc346a198a89ac987c1008aac09f191ee6 (diff)
downloadppe42-gcc-5bf762459121cc397663d22498d62d71fa179ef6.tar.gz
ppe42-gcc-5bf762459121cc397663d22498d62d71fa179ef6.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125302 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/javax/swing')
-rw-r--r--libjava/classpath/javax/swing/DefaultDesktopManager.java30
-rw-r--r--libjava/classpath/javax/swing/JComponent.java21
-rw-r--r--libjava/classpath/javax/swing/JEditorPane.java2
-rw-r--r--libjava/classpath/javax/swing/JFormattedTextField.java2
-rw-r--r--libjava/classpath/javax/swing/JScrollBar.java4
-rw-r--r--libjava/classpath/javax/swing/JToolTip.java2
-rw-r--r--libjava/classpath/javax/swing/JViewport.java30
-rw-r--r--libjava/classpath/javax/swing/TransferHandler.java136
-rw-r--r--libjava/classpath/javax/swing/colorchooser/DefaultHSBChooserPanel.java1
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java115
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java33
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java104
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java97
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java16
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java3
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java6
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java16
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalMenuBarUI.java2
-rw-r--r--libjava/classpath/javax/swing/table/JTableHeader.java2
-rw-r--r--libjava/classpath/javax/swing/text/AbstractDocument.java28
-rw-r--r--libjava/classpath/javax/swing/text/AsyncBoxView.java2
-rw-r--r--libjava/classpath/javax/swing/text/DefaultStyledDocument.java4
-rw-r--r--libjava/classpath/javax/swing/text/FieldView.java2
-rw-r--r--libjava/classpath/javax/swing/text/InternationalFormatter.java5
-rw-r--r--libjava/classpath/javax/swing/text/JTextComponent.java2
-rw-r--r--libjava/classpath/javax/swing/text/html/CSSParser.java5
28 files changed, 420 insertions, 256 deletions
diff --git a/libjava/classpath/javax/swing/DefaultDesktopManager.java b/libjava/classpath/javax/swing/DefaultDesktopManager.java
index 11f03a715c4..cad88186f22 100644
--- a/libjava/classpath/javax/swing/DefaultDesktopManager.java
+++ b/libjava/classpath/javax/swing/DefaultDesktopManager.java
@@ -293,21 +293,35 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
public void activateFrame(JInternalFrame frame)
{
JDesktopPane p = frame.getDesktopPane();
-
+ JInternalFrame active = null;
if (p != null)
- p.setSelectedFrame(frame);
- else
+ active = p.getSelectedFrame();
+ if (active == null)
{
- try
+ if (p != null)
{
- frame.setSelected(true);
+ p.setSelectedFrame(frame);
}
- catch (PropertyVetoException e)
+ }
+ else if (active != frame)
+ {
+ if (active.isSelected())
{
- // Do nothing if attempt is vetoed.
+ try
+ {
+ active.setSelected(false);
+ }
+ catch (PropertyVetoException ex)
+ {
+ // Not allowed.
+ }
}
+ if (p != null)
+ {
+ p.setSelectedFrame(frame);
+ }
+
}
-
frame.toFront();
}
diff --git a/libjava/classpath/javax/swing/JComponent.java b/libjava/classpath/javax/swing/JComponent.java
index 5ec5079223e..a22a92e3b06 100644
--- a/libjava/classpath/javax/swing/JComponent.java
+++ b/libjava/classpath/javax/swing/JComponent.java
@@ -1022,21 +1022,6 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Fires a property change for a primitive character property.
- *
- * @param property the name of the property
- * @param oldValue the old value of the property
- * @param newValue the new value of the property
- */
- public void firePropertyChange(String property, char oldValue,
- char newValue)
- {
- // FIXME - This method is already public in awt Component, but
- // is included here to work around a compilation bug in gcj 4.1.
- super.firePropertyChange(property, oldValue, newValue);
- }
-
- /**
* Get the value of the accessibleContext property for this component.
*
* @return the current value of the property
@@ -1942,7 +1927,8 @@ public abstract class JComponent extends Container implements Serializable
int i = getComponentCount() - 1;
if (paintChild != null && paintChild.isOpaque())
{
- for (; i >= 0 && getComponent(i) != paintChild; i--);
+ for (; i >= 0 && getComponent(i) != paintChild; i--)
+ ;
}
for (; i >= 0; i--)
{
@@ -2203,7 +2189,8 @@ public abstract class JComponent extends Container implements Serializable
{
int count = c.getComponentCount();
int i = 0;
- for (; i < count && c.getComponent(i) != child; i++);
+ for (; i < count && c.getComponent(i) != child; i++)
+ ;
if (jc.isCompletelyObscured(i, paintX, paintY, paintW,
paintH))
diff --git a/libjava/classpath/javax/swing/JEditorPane.java b/libjava/classpath/javax/swing/JEditorPane.java
index 38b0761f00f..d6b87764fec 100644
--- a/libjava/classpath/javax/swing/JEditorPane.java
+++ b/libjava/classpath/javax/swing/JEditorPane.java
@@ -712,7 +712,7 @@ public class JEditorPane extends JTextComponent
public JEditorPane(URL url) throws IOException
{
init();
- setEditorKit(createEditorKitForContentType("text/html"));;
+ setEditorKit(createEditorKitForContentType("text/html"));
setPage(url);
}
diff --git a/libjava/classpath/javax/swing/JFormattedTextField.java b/libjava/classpath/javax/swing/JFormattedTextField.java
index 05475255038..36554857ead 100644
--- a/libjava/classpath/javax/swing/JFormattedTextField.java
+++ b/libjava/classpath/javax/swing/JFormattedTextField.java
@@ -415,7 +415,7 @@ public class JFormattedTextField extends JTextField
// to create a new formatter.
Object oldValue = this.value;
- this.value = formatter.stringToValue(getText());;
+ this.value = formatter.stringToValue(getText());
editValid = true;
firePropertyChange("value", oldValue, this.value);
diff --git a/libjava/classpath/javax/swing/JScrollBar.java b/libjava/classpath/javax/swing/JScrollBar.java
index 1f21aa13ff5..f55feb3f22a 100644
--- a/libjava/classpath/javax/swing/JScrollBar.java
+++ b/libjava/classpath/javax/swing/JScrollBar.java
@@ -371,7 +371,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
*/
public int getUnitIncrement(int direction)
{
- return direction * unitIncrement;
+ return unitIncrement;
}
/**
@@ -401,7 +401,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
*/
public int getBlockIncrement(int direction)
{
- return direction * blockIncrement;
+ return blockIncrement;
}
/**
diff --git a/libjava/classpath/javax/swing/JToolTip.java b/libjava/classpath/javax/swing/JToolTip.java
index 3153894da81..16bdd2d7e73 100644
--- a/libjava/classpath/javax/swing/JToolTip.java
+++ b/libjava/classpath/javax/swing/JToolTip.java
@@ -181,7 +181,7 @@ public class JToolTip extends JComponent implements Accessible
{
StringBuffer sb = new StringBuffer(super.paramString());
sb.append(",tiptext=");
- if (text != null);
+ if (text != null)
sb.append(text);
return sb.toString();
}
diff --git a/libjava/classpath/javax/swing/JViewport.java b/libjava/classpath/javax/swing/JViewport.java
index d90da1d157b..023948032fb 100644
--- a/libjava/classpath/javax/swing/JViewport.java
+++ b/libjava/classpath/javax/swing/JViewport.java
@@ -574,8 +574,12 @@ public class JViewport extends JComponent implements Accessible
Component view = getView();
if (view == null)
return;
-
+
Point pos = getViewPosition();
+ // We get the contentRect in the viewport coordinates. But we want to
+ // calculate with view coordinates.
+ int contentX = contentRect.x + pos.x;
+ int contentY = contentRect.y + pos.y;
Rectangle viewBounds = getView().getBounds();
Rectangle portBounds = getBounds();
@@ -584,20 +588,20 @@ public class JViewport extends JComponent implements Accessible
// If the bottom boundary of contentRect is below the port
// boundaries, scroll up as necessary.
- if (contentRect.y + contentRect.height + viewBounds.y > portBounds.height)
- pos.y = contentRect.y + contentRect.height - portBounds.height;
- // If contentRect.y is above the port boundaries, scroll down to
- // contentRect.y.
- if (contentRect.y + viewBounds.y < 0)
- pos.y = contentRect.y;
+ if (contentY + contentRect.height + viewBounds.y > portBounds.height)
+ pos.y = contentY + contentRect.height - portBounds.height;
+ // If contentY is above the port boundaries, scroll down to
+ // contentY.
+ if (contentY + viewBounds.y < 0)
+ pos.y = contentY;
// If the right boundary of contentRect is right from the port
// boundaries, scroll left as necessary.
- if (contentRect.x + contentRect.width + viewBounds.x > portBounds.width)
- pos.x = contentRect.x + contentRect.width - portBounds.width;
- // If contentRect.x is left from the port boundaries, scroll right to
+ if (contentX + contentRect.width + viewBounds.x > portBounds.width)
+ pos.x = contentX + contentRect.width - portBounds.width;
+ // If contentX is left from the port boundaries, scroll right to
// contentRect.x.
- if (contentRect.x + viewBounds.x < 0)
- pos.x = contentRect.x;
+ if (contentX + viewBounds.x < 0)
+ pos.x = contentX;
setViewPosition(pos);
}
@@ -834,7 +838,7 @@ public class JViewport extends JComponent implements Accessible
int dy = viewPosition.y - lastPaintPosition.y;
boolean canBlit = computeBlit(dx, dy, cachedBlitFrom, cachedBlitTo,
cachedBlitSize, cachedBlitPaint);
- if (canBlit)
+ if (canBlit && isPaintRoot)
{
// Copy the part that remains visible during scrolling.
if (cachedBlitSize.width > 0 && cachedBlitSize.height > 0)
diff --git a/libjava/classpath/javax/swing/TransferHandler.java b/libjava/classpath/javax/swing/TransferHandler.java
index d594a8244bb..2e5963f443f 100644
--- a/libjava/classpath/javax/swing/TransferHandler.java
+++ b/libjava/classpath/javax/swing/TransferHandler.java
@@ -38,15 +38,23 @@ exception statement from your version. */
package javax.swing;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragGestureRecognizer;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DragSourceContext;
+import java.awt.dnd.DragSourceDragEvent;
+import java.awt.dnd.DragSourceDropEvent;
+import java.awt.dnd.DragSourceEvent;
+import java.awt.dnd.DragSourceListener;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
@@ -210,7 +218,101 @@ public class TransferHandler implements Serializable
}
}
}
-
+
+ private static class SwingDragGestureRecognizer extends DragGestureRecognizer
+ {
+
+ protected SwingDragGestureRecognizer(DragGestureListener dgl)
+ {
+ super(DragSource.getDefaultDragSource(), null, NONE, dgl);
+ }
+
+ void gesture(JComponent c, MouseEvent e, int src, int drag)
+ {
+ setComponent(c);
+ setSourceActions(src);
+ appendEvent(e);
+ fireDragGestureRecognized(drag, e.getPoint());
+ }
+
+ protected void registerListeners()
+ {
+ // Nothing to do here.
+ }
+
+ protected void unregisterListeners()
+ {
+ // Nothing to do here.
+ }
+
+ }
+
+ private static class SwingDragHandler
+ implements DragGestureListener, DragSourceListener
+ {
+
+ private boolean autoscrolls;
+
+ public void dragGestureRecognized(DragGestureEvent e)
+ {
+ JComponent c = (JComponent) e.getComponent();
+ TransferHandler th = c.getTransferHandler();
+ Transferable t = th.createTransferable(c);
+ if (t != null)
+ {
+ autoscrolls = c.getAutoscrolls();
+ c.setAutoscrolls(false);
+ try
+ {
+ e.startDrag(null, t, this);
+ return;
+ }
+ finally
+ {
+ c.setAutoscrolls(autoscrolls);
+ }
+ }
+ th.exportDone(c, t, NONE);
+ }
+
+ public void dragDropEnd(DragSourceDropEvent e)
+ {
+ DragSourceContext ctx = e.getDragSourceContext();
+ JComponent c = (JComponent) ctx.getComponent();
+ TransferHandler th = c.getTransferHandler();
+ if (e.getDropSuccess())
+ {
+ th.exportDone(c, ctx.getTransferable(), e.getDropAction());
+ }
+ else
+ {
+ th.exportDone(c, ctx.getTransferable(), e.getDropAction());
+ }
+ c.setAutoscrolls(autoscrolls);
+ }
+
+ public void dragEnter(DragSourceDragEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ public void dragExit(DragSourceEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ public void dragOver(DragSourceDragEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ public void dropActionChanged(DragSourceDragEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ }
+
private static final long serialVersionUID = -967749805571669910L;
private static final String COMMAND_COPY = "copy";
@@ -235,6 +337,11 @@ public class TransferHandler implements Serializable
*/
private String propertyName;
+ /**
+ * The DragGestureRecognizer for Swing.
+ */
+ private SwingDragGestureRecognizer recognizer;
+
public static Action getCopyAction()
{
return copyAction;
@@ -331,10 +438,27 @@ public class TransferHandler implements Serializable
return transferable;
}
- public void exportAsDrag(JComponent c, InputEvent e, int action)
- throws NotImplementedException
+ public void exportAsDrag(JComponent c, InputEvent e, int action)
{
- // TODO: Implement this properly
+ int src = getSourceActions(c);
+ int drag = src & action;
+ if (! (e instanceof MouseEvent))
+ {
+ drag = NONE;
+ }
+ if (drag != NONE)
+ {
+ if (recognizer == null)
+ {
+ SwingDragHandler ds = new SwingDragHandler();
+ recognizer = new SwingDragGestureRecognizer(ds);
+ }
+ recognizer.gesture(c, (MouseEvent) e, src, drag);
+ }
+ else
+ {
+ exportDone(c, null, NONE);
+ }
}
/**
diff --git a/libjava/classpath/javax/swing/colorchooser/DefaultHSBChooserPanel.java b/libjava/classpath/javax/swing/colorchooser/DefaultHSBChooserPanel.java
index 71d6c75b5f9..112d02166b1 100644
--- a/libjava/classpath/javax/swing/colorchooser/DefaultHSBChooserPanel.java
+++ b/libjava/classpath/javax/swing/colorchooser/DefaultHSBChooserPanel.java
@@ -778,7 +778,6 @@ class DefaultHSBChooserPanel extends AbstractColorChooserPanel
if (locked == HLOCKED)
{
slider.setMaximum(359);
- ;
slider.setValue(((Number) hSpinner.getValue()).intValue());
slider.setInverted(true);
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
index d98fd2afe38..ff636d684c1 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 c29829d777d..11f832ae890 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 1ec020b1c0b..ae992594d6b 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 bfb9e98dbc9..3cea0d926d2 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 0d1fa1eed9b..fe360214c2f 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 5b0ffce09b6..3952ea18d17 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 be9607927ba..108b3b225de 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 c24c0850560..53d49c3dc4f 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 824f1d8021b..9bded823204 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 a9a6790931f..25c624b7427 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 40661946b1a..2cc52ed7389 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);
diff --git a/libjava/classpath/javax/swing/table/JTableHeader.java b/libjava/classpath/javax/swing/table/JTableHeader.java
index 482317ff0ad..4661748d0a8 100644
--- a/libjava/classpath/javax/swing/table/JTableHeader.java
+++ b/libjava/classpath/javax/swing/table/JTableHeader.java
@@ -570,7 +570,7 @@ public class JTableHeader extends JComponent
if (comp != null)
comp.setVisible(b);
}
- };
+ }
public AccessibleRole getAccessibleRole()
{
diff --git a/libjava/classpath/javax/swing/text/AbstractDocument.java b/libjava/classpath/javax/swing/text/AbstractDocument.java
index eead8de5261..72178f840f3 100644
--- a/libjava/classpath/javax/swing/text/AbstractDocument.java
+++ b/libjava/classpath/javax/swing/text/AbstractDocument.java
@@ -1,5 +1,5 @@
/* AbstractDocument.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -2093,7 +2093,7 @@ public abstract class AbstractDocument implements Document, Serializable
/**
* The child elements of this BranchElement.
*/
- private Element[] children;;
+ private Element[] children;
/**
* The number of children in the branch element.
@@ -2450,8 +2450,6 @@ public abstract class AbstractDocument implements Document, Serializable
*/
public boolean addEdit(UndoableEdit edit)
{
- // XXX - Fully qualify ElementChange to work around gcj bug #2499.
-
// Start using Hashtable when we pass a certain threshold. This
// gives a good memory/performance compromise.
if (changes == null && edits.size() > THRESHOLD)
@@ -2461,19 +2459,17 @@ public abstract class AbstractDocument implements Document, Serializable
for (int i = 0; i < count; i++)
{
Object o = edits.elementAt(i);
- if (o instanceof DocumentEvent.ElementChange)
+ if (o instanceof ElementChange)
{
- DocumentEvent.ElementChange ec =
- (DocumentEvent.ElementChange) o;
+ ElementChange ec = (ElementChange) o;
changes.put(ec.getElement(), ec);
}
}
}
- if (changes != null && edit instanceof DocumentEvent.ElementChange)
+ if (changes != null && edit instanceof ElementChange)
{
- DocumentEvent.ElementChange elEdit =
- (DocumentEvent.ElementChange) edit;
+ ElementChange elEdit = (ElementChange) edit;
changes.put(elEdit.getElement(), elEdit);
}
return super.addEdit(edit);
@@ -2527,13 +2523,12 @@ public abstract class AbstractDocument implements Document, Serializable
* @return the changes for <code>elem</code> or <code>null</code> if
* <code>elem</code> has not been changed
*/
- public DocumentEvent.ElementChange getChange(Element elem)
+ public ElementChange getChange(Element elem)
{
- // XXX - Fully qualify ElementChange to work around gcj bug #2499.
- DocumentEvent.ElementChange change = null;
+ ElementChange change = null;
if (changes != null)
{
- change = (DocumentEvent.ElementChange) changes.get(elem);
+ change = (ElementChange) changes.get(elem);
}
else
{
@@ -2541,10 +2536,9 @@ public abstract class AbstractDocument implements Document, Serializable
for (int i = 0; i < count && change == null; i++)
{
Object o = edits.get(i);
- if (o instanceof DocumentEvent.ElementChange)
+ if (o instanceof ElementChange)
{
- DocumentEvent.ElementChange ec =
- (DocumentEvent.ElementChange) o;
+ ElementChange ec = (ElementChange) o;
if (elem.equals(ec.getElement()))
change = ec;
}
diff --git a/libjava/classpath/javax/swing/text/AsyncBoxView.java b/libjava/classpath/javax/swing/text/AsyncBoxView.java
index 90447f86e6a..327c2b895d9 100644
--- a/libjava/classpath/javax/swing/text/AsyncBoxView.java
+++ b/libjava/classpath/javax/swing/text/AsyncBoxView.java
@@ -307,7 +307,7 @@ public class AsyncBoxView
private int updateChildOffsets(float targetOffset)
{
int n = getViewCount();
- int targetIndex = n - 1;;
+ int targetIndex = n - 1;
int pos = lastValidOffset.getChildView().getStartOffset();
int startIndex = getViewIndexAtPosition(pos, Position.Bias.Forward);
float start = lastValidOffset.getMajorOffset();
diff --git a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
index 3156ca67f66..4ed8aa2d264 100644
--- a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
+++ b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
@@ -1126,7 +1126,9 @@ public class DefaultStyledDocument extends AbstractDocument implements
int p;
for (p = 0;
p < data.length && data[p].getType() == ElementSpec.EndTagType;
- p++);
+ p++)
+ ;
+
Edit edit = insertPath[insertPath.length - p - 1];
edit.index--;
edit.removed.add(0, edit.e.getElement(edit.index));
diff --git a/libjava/classpath/javax/swing/text/FieldView.java b/libjava/classpath/javax/swing/text/FieldView.java
index 0a078e53dca..e357a1e056b 100644
--- a/libjava/classpath/javax/swing/text/FieldView.java
+++ b/libjava/classpath/javax/swing/text/FieldView.java
@@ -91,7 +91,7 @@ public class FieldView extends PlainView
horizontalVisibility.addChangeListener(new ChangeListener(){
public void stateChanged(ChangeEvent event) {
getContainer().repaint();
- };
+ }
});
// It turned out that the span calculated at this point is wrong
diff --git a/libjava/classpath/javax/swing/text/InternationalFormatter.java b/libjava/classpath/javax/swing/text/InternationalFormatter.java
index d6f2359e6f7..1de5ca27126 100644
--- a/libjava/classpath/javax/swing/text/InternationalFormatter.java
+++ b/libjava/classpath/javax/swing/text/InternationalFormatter.java
@@ -1,5 +1,5 @@
/* InternationalFormatter.java --
-Copyright (C) 2005 Free Software Foundation, Inc.
+Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -329,7 +329,7 @@ public class InternationalFormatter
*
* @throws CloneNotSupportedException not thrown here, since cloning is
* supported
- * XXX - FIXME - Whole method disabled as workaround for gcj bug #22060.
+ */
public Object clone()
throws CloneNotSupportedException
{
@@ -338,7 +338,6 @@ public class InternationalFormatter
Object clone = super.clone();
return clone;
}
- */
/**
* Returns the Actions that are supported by this Formatter.
diff --git a/libjava/classpath/javax/swing/text/JTextComponent.java b/libjava/classpath/javax/swing/text/JTextComponent.java
index 68ba1f4284c..8e70fe2bb2b 100644
--- a/libjava/classpath/javax/swing/text/JTextComponent.java
+++ b/libjava/classpath/javax/swing/text/JTextComponent.java
@@ -1821,7 +1821,7 @@ public abstract class JTextComponent extends JComponent
public boolean getScrollableTracksViewportWidth()
{
- boolean res = false;;
+ boolean res = false;
Container c = getParent();
if (c instanceof JViewport)
res = ((JViewport) c).getExtentSize().width > getPreferredSize().width;
diff --git a/libjava/classpath/javax/swing/text/html/CSSParser.java b/libjava/classpath/javax/swing/text/html/CSSParser.java
index 0bf76eb809f..54a16bcc599 100644
--- a/libjava/classpath/javax/swing/text/html/CSSParser.java
+++ b/libjava/classpath/javax/swing/text/html/CSSParser.java
@@ -315,7 +315,8 @@ class CSSParser
try
{
if (!parsingDeclaration)
- while(getNextStatement());
+ while(getNextStatement())
+ ;
else
parseDeclarationBlock();
}
@@ -565,4 +566,4 @@ class CSSParser
}
}
- \ No newline at end of file
+
OpenPOWER on IntegriCloud