Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.javathis.utilities.ui
Class JTCommandButtonLayout  view JTCommandButtonLayout download JTCommandButtonLayout.java

java.lang.Object
  extended byjava.awt.FlowLayout
      extended bycom.javathis.utilities.ui.JTCommandButtonLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.io.Serializable

public class JTCommandButtonLayout
extends java.awt.FlowLayout

A JTCommandButtonLayout layout is for use with a javax.swing.JPanel that contains the primary command buttons for a frame or dialog, and usually located at the bottom. Examples of the type of buttons considered command buttons would be, OK, CANCEL, APPLY, etc.

It will make al the buttons the same width as the largest button, with consistant gaps, and by default aligns them to the right. This helps managing the command buttons for an application a little easier, and conforms to current standard practices.

Note: All buttons currenly will conform to a height of 27 pixils, a horizontal gap of 5 pixils, and a vertical gap of 5 pixils.


Field Summary
private static int BUTTON_HEIGHT
           
private  java.awt.Container container
           
private static int HGAP
           
private static int VGAP
           
 
Fields inherited from class java.awt.FlowLayout
CENTER, LEADING, LEFT, RIGHT, TRAILING
 
Constructor Summary
JTCommandButtonLayout()
          Creates a JTCommandButtonLayout with a default alignment to the right.
JTCommandButtonLayout(int alignment)
          Creates a JTCommandButtonLayout with provided aligment.
 
Method Summary
 void layoutContainer(java.awt.Container target)
          Lays out the container.
static void main(java.lang.String[] args)
          Used for simple testing for this layout.
private  void moveComponents(java.awt.Container target, int x, int y, int width, int height, int rowStart, int rowEnd, boolean ltr)
          Moves the elements in the specified row according to the current alignment.
 java.awt.Dimension preferredLayoutSize(java.awt.Container target)
          Returns the preferred dimensions for this layout given the visible components in the specified target container.
private  void resizeComponents()
          Method used to resize only AbstractButton objects used in this layout manger.
 void setHgap(int hgap)
          Overridded to prevent changes to the horizontal gap.
 void setVgap(int vgap)
          Overridded to prevent changes to the vertical gap.
 
Methods inherited from class java.awt.FlowLayout
addLayoutComponent, getAlignment, getHgap, getVgap, minimumLayoutSize, removeLayoutComponent, setAlignment, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HGAP

private static final int HGAP
See Also:
Constant Field Values

VGAP

private static final int VGAP
See Also:
Constant Field Values

BUTTON_HEIGHT

private static final int BUTTON_HEIGHT
See Also:
Constant Field Values

container

private java.awt.Container container
Constructor Detail

JTCommandButtonLayout

public JTCommandButtonLayout()
Creates a JTCommandButtonLayout with a default alignment to the right.


JTCommandButtonLayout

public JTCommandButtonLayout(int alignment)
Creates a JTCommandButtonLayout with provided aligment.

Method Detail

resizeComponents

private void resizeComponents()
Method used to resize only AbstractButton objects used in this layout manger.


setHgap

public void setHgap(int hgap)
Overridded to prevent changes to the horizontal gap.


setVgap

public void setVgap(int vgap)
Overridded to prevent changes to the vertical gap.


layoutContainer

public void layoutContainer(java.awt.Container target)
Lays out the container. This method lets each component take its preferred size by reshaping the components in the target container in order to satisfy the constraints of this JTCommandButtonLayout object.


preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container target)
Returns the preferred dimensions for this layout given the visible components in the specified target container.


moveComponents

private void moveComponents(java.awt.Container target,
                            int x,
                            int y,
                            int width,
                            int height,
                            int rowStart,
                            int rowEnd,
                            boolean ltr)
Moves the elements in the specified row according to the current alignment.


main

public static void main(java.lang.String[] args)
Used for simple testing for this layout.