summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2006-05-04 13:12:19 +0000
committerRoman Kennke <roman@kennke.org>2006-05-04 13:12:19 +0000
commitdf5ec956858ca58dc3bf9edc55653b3188e01af5 (patch)
treeba9e870eef219062219c208e3c182a643fd752e4
parent39d877dca363b39765066e94f998fb8615887bb6 (diff)
downloadclasspath-df5ec956858ca58dc3bf9edc55653b3188e01af5.tar.gz
2006-05-04 Roman Kennke <kennke@aicas.com>
* javax/swing/AbstractButton.java (addImpl): New method. Installs an OverlayLayout if no other layout has been installed before. (setLayout): New method. Detect if a client app installs a custom layout.
-rw-r--r--ChangeLog10
-rw-r--r--javax/swing/AbstractButton.java41
2 files changed, 50 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 51897d6e0..bfa0d8a6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
2006-05-04 Roman Kennke <kennke@aicas.com>
- * javax/swing/table/DefaultTableCellModel.java
+ * javax/swing/AbstractButton.java
+ (addImpl): New method. Installs an OverlayLayout if no
+ other layout has been installed before.
+ (setLayout): New method. Detect if a client app installs a custom
+ layout.
+
+2006-05-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
(noFocusBorder): Fixed width of empty border to 1.
(getTableCellRendererComponent): Don't change the colors for
focuses cells. Fixed border for focused cells.
diff --git a/javax/swing/AbstractButton.java b/javax/swing/AbstractButton.java
index d4e35cfa3..348daece1 100644
--- a/javax/swing/AbstractButton.java
+++ b/javax/swing/AbstractButton.java
@@ -39,10 +39,12 @@ package javax.swing;
import gnu.classpath.NotImplementedException;
+import java.awt.Component;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Insets;
import java.awt.ItemSelectable;
+import java.awt.LayoutManager;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
@@ -2372,6 +2374,45 @@ public abstract class AbstractButton extends JComponent
}
/**
+ * Adds the specified component to this AbstractButton. This overrides the
+ * default in order to install an {@link OverlayLayout} layout manager
+ * before adding the component. The layout manager is only installed if
+ * no other layout manager has been installed before.
+ *
+ * @param comp the component to be added
+ * @param constraints constraints for the layout manager
+ * @param index the index at which the component is added
+ *
+ * @since 1.5
+ */
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ // We use a client property here, so that no extra memory is used in
+ // the common case with no layout manager.
+ if (getClientProperty("AbstractButton.customLayoutSet") == null)
+ setLayout(new OverlayLayout(this));
+ super.addImpl(comp, constraints, index);
+ }
+
+ /**
+ * Sets a layout manager on this AbstractButton. This is overridden in order
+ * to detect if the application sets a custom layout manager. If no custom
+ * layout manager is set, {@link #addImpl(Component, Object, int)} installs
+ * an OverlayLayout before adding a component.
+ *
+ * @param layout the layout manager to install
+ *
+ * @since 1.5
+ */
+ public void setLayout(LayoutManager layout)
+ {
+ // We use a client property here, so that no extra memory is used in
+ // the common case with no layout manager.
+ putClientProperty("AbstractButton.customLayoutSet", Boolean.TRUE);
+ super.setLayout(layout);
+ }
+
+ /**
* Helper method for
* {@link LookAndFeel#installProperty(JComponent, String, Object)}.
*