This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: javax.swing.Box
> On Sat, 24 Jul 2004 08:57:12 +0200, Roman Kennke <roman@ontographics.com>
> wrote:
>
>> I also noticed that. If you look at my follow-up post to that you find
>> this fixed :)
>
> I see no such followup. I see:
>
> one message with a patch, which I reviewed:
> http://gcc.gnu.org/ml/java-patches/2004-q3/msg00316.html
>
> one message with a changelog:
> http://gcc.gnu.org/ml/java-patches/2004-q3/msg00317.html
>
> one message claiming to have a patch, but with no patch:
> http://gcc.gnu.org/ml/java-patches/2004-q3/msg00337.html
dammit, I forgot to attach the patch. Sorry.
/Roman
Index: javax/swing/Box.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/javax/swing/Box.java,v
retrieving revision 1.3.2.7
diff -u -r1.3.2.7 Box.java
--- javax/swing/Box.java 9 Jun 2004 03:39:10 -0000 1.3.2.7
+++ javax/swing/Box.java 23 Jul 2004 23:01:17 -0000
@@ -47,7 +47,11 @@
import java.awt.AWTError;
/**
- * Needs some work I guess....
+ * A component that uses a {@link BoxLayout} as Layout Manager.
+ *
+ * In addition to that, this class provides a set of static methods for
+ * creating some filler components ('struts' and 'glue') for use in
+ * containers that are laid out using BoxLayout.
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
@@ -70,7 +74,10 @@
return null;
}
}
-
+
+ /**
+ * A component that servers as a filler in BoxLayout controlled containers.
+ */
public static class Filler extends JComponent implements Accessible
{
private static final long serialVersionUID = -1204263191910183998L;
@@ -95,11 +102,25 @@
private transient Dimension min, pref, max;
+ /**
+ * Creates a new instance of Filler.
+ *
+ * @param min the minimum size of the filler.
+ * @param pref the preferred size of the filler.
+ * @param max the maximum size of the filler.
+ */
public Filler(Dimension min, Dimension pref, Dimension max)
{
changeShape(min, pref, max);
}
+ /**
+ * Changes the dimensions of this Filler.
+ *
+ * @param min the new minimum size of the filler.
+ * @param pref the new preferred size of the filler.
+ * @param max the new maximum size of the filler.
+ */
public void changeShape(Dimension min, Dimension pref, Dimension max)
{
this.min = min;
@@ -115,30 +136,66 @@
return accessibleContext;
}
+ /**
+ * Returns the maximum size of this Filler.
+ *
+ * @return the maximum size of this Filler.
+ */
public Dimension getMaximumSize()
{
return max;
}
+ /**
+ * Returns the minimum size of this Filler.
+ *
+ * @return the minimum size of this Filler.
+ */
public Dimension getMinimumSize()
{
return min;
}
+ /**
+ * Returns the preferred size of this Filler.
+ *
+ * @return the preferred size of this Filler.
+ */
public Dimension getPreferredSize()
{
return pref;
}
}
+ /**
+ * Creates a new Box component, that lays out its children according
+ * to the <code>axis</code> parameter.
+ *
+ * @param axis the orientation of the BoxLayout.
+ *
+ * @see BoxLayout#X_AXIS
+ * @see BoxLayout#Y_AXIS
+ * @see BoxLayout#LINE_AXIS
+ * @see BoxLayout#PAGE_AXIS
+ */
public Box(int axis)
{
setLayout(new BoxLayout(this, axis));
}
+ /**
+ * Creates a filler component which acts as glue between components.
+ * It does not take space unless some extra space is available. If extra
+ * space is available, this component can expand in both X and Y directions.
+ *
+ * @return a glue-like filler component.
+ */
public static Component createGlue()
{
- return null;
+ Filler glue = new Filler(new Dimension(0,0), new Dimension(0,0),
+ new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE)
+ );
+ return glue;
}
public static Box createHorizontalBox()
@@ -146,14 +203,32 @@
return null;
}
+ /**
+ * Creates a filler component which acts as glue between components.
+ * It does not take space unless some extra space is available. If extra
+ * space is available, this component can expand in the X direction.
+ *
+ * @return a glue-like filler component.
+ */
public static Component createHorizontalGlue()
{
- return null;
+ return createGlue();
}
+ /**
+ * Creates a filler component which acts as strut between components.
+ * It will fill exactly the specified horizontal size.
+ *
+ * @param width the width of this strut in pixels.
+ *
+ * @return a strut-like filler component.
+ */
public static Component createHorizontalStrut(int width)
{
- return null;
+ Filler strut = new Filler(new Dimension(width, 0),
+ new Dimension(width, 0),
+ new Dimension(width, Integer.MAX_VALUE));
+ return strut;
}
public static Component createRigidArea(Dimension d)
@@ -166,14 +241,32 @@
return null;
}
+ /**
+ * Creates a filler component which acts as glue between components.
+ * It does not take space unless some extra space is available. If extra
+ * space is available, this component can expand in the Y direction.
+ *
+ * @return a glue-like filler component.
+ */
public static Component createVerticalGlue()
{
- return null;
+ return createGlue();
}
+ /**
+ * Creates a filler component which acts as strut between components.
+ * It will fill exactly the specified vertical size.
+ *
+ * @param height the height of this strut in pixels.
+ *
+ * @return a strut-like filler component.
+ */
public static Component createVerticalStrut(int height)
{
- return null;
+ Filler strut = new Filler(new Dimension(0, height),
+ new Dimension(0, height),
+ new Dimension(Integer.MAX_VALUE, height));
+ return strut;
}
public void setLayout(LayoutManager l)