summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-14 23:12:35 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-14 23:12:35 +0000
commitffde862e033a0825e1e9972a89c0f1f80b261a8e (patch)
tree97037d2c09c8384d80531f67ec36a01205df6bdb /libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
parentb415ff10527e977c3758234fd930e2c027bfa17d (diff)
downloadppe42-gcc-ffde862e033a0825e1e9972a89c0f1f80b261a8e.tar.gz
ppe42-gcc-ffde862e033a0825e1e9972a89c0f1f80b261a8e.zip
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116139 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java')
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java50
1 files changed, 27 insertions, 23 deletions
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
index f796d9a730a..781269b2adf 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
@@ -1,5 +1,5 @@
/* BasicArrowButton.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,7 +42,6 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Polygon;
-import java.awt.Rectangle;
import javax.swing.ButtonModel;
import javax.swing.JButton;
@@ -86,7 +85,9 @@ public class BasicArrowButton extends JButton implements SwingConstants
transient Color highlight = Color.WHITE;
/**
- * Creates a new <code>BasicArrowButton</code> object.
+ * Creates a new <code>BasicArrowButton</code> object with an arrow pointing
+ * in the specified direction. If the <code>direction</code> is not one of
+ * the specified constants, no arrow is drawn.
*
* @param direction The direction the arrow points in (one of:
* {@link #NORTH}, {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
@@ -95,6 +96,7 @@ public class BasicArrowButton extends JButton implements SwingConstants
{
super();
setDirection(direction);
+ setFocusable(false);
}
/**
@@ -116,8 +118,7 @@ public class BasicArrowButton extends JButton implements SwingConstants
this.shadow = shadow;
this.darkShadow = darkShadow;
this.highlight = highlight;
- // Mark the button as not closing the popup, we handle this ourselves.
- putClientProperty(BasicLookAndFeel.DONT_CANCEL_POPUP, Boolean.TRUE);
+ setFocusable(false);
}
/**
@@ -162,28 +163,22 @@ public class BasicArrowButton extends JButton implements SwingConstants
public void paint(Graphics g)
{
super.paint(g);
- Rectangle bounds = getBounds();
- int size = bounds.height / 4;
- int x = bounds.x + (bounds.width - size) / 2;
- int y = (bounds.height - size) / 4;
+
+ int height = getHeight();
+ int size = height / 4;
+
+ int x = (getWidth() - size) / 2;
+ int y = (height - size) / 2;
+
ButtonModel m = getModel();
if (m.isArmed())
{
x++;
y++;
}
+
paintTriangle(g, x, y, size, direction, isEnabled());
}
-
- /** The preferred size for the button. */
- private static final Dimension PREFERRED_SIZE = new Dimension(16, 16);
-
- /** The minimum size for the button. */
- private static final Dimension MINIMUM_SIZE = new Dimension(5, 5);
-
- /** The maximum size for the button. */
- private static final Dimension MAXIMUM_SIZE
- = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
/**
* Returns the preferred size of the arrow button.
@@ -192,7 +187,10 @@ public class BasicArrowButton extends JButton implements SwingConstants
*/
public Dimension getPreferredSize()
{
- return PREFERRED_SIZE;
+ // since Dimension is NOT immutable, we must return a new instance
+ // every time (if we return a cached value, the caller might modify it)
+ // - tests show that the reference implementation does the same.
+ return new Dimension(16, 16);
}
/**
@@ -202,17 +200,23 @@ public class BasicArrowButton extends JButton implements SwingConstants
*/
public Dimension getMinimumSize()
{
- return MINIMUM_SIZE;
+ // since Dimension is NOT immutable, we must return a new instance
+ // every time (if we return a cached value, the caller might modify it)
+ // - tests show that the reference implementation does the same.
+ return new Dimension(5, 5);
}
/**
* Returns the maximum size of the arrow button.
*
- * @return The maximum size.
+ * @return The maximum size (always Integer.MAX_VALUE x Integer.MAX_VALUE).
*/
public Dimension getMaximumSize()
{
- return MAXIMUM_SIZE;
+ // since Dimension is NOT immutable, we must return a new instance
+ // every time (if we return a cached value, the caller might modify it)
+ // - tests show that the reference implementation does the same.
+ return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}
/**
OpenPOWER on IntegriCloud