HiRISE

HiRISE.HiVali
Class SwingFactory

java.lang.Object
  extended by HiRISE.HiVali.SwingFactory

public class SwingFactory
extends Object

Collection of utility methods for Swing applications.

Version:
1.7
Author:
guym

Field Summary
static String ID
          CVS ID
 
Constructor Summary
SwingFactory()
           
 
Method Summary
static JComponent addBorderTitle(String title, JComponent component)
          Wrap a component with a titled border, returning the component.
static void constrain(Container container, Component component, int row, int col)
           
static void constrain(Container container, Component component, int row, int col, int rspan, int cspan)
           
static void constrain(Container container, Component component, int row, int col, int rspan, int cspan, int anchor, int fill)
           
static void constrain(Container container, Component component, int row, int col, int rspan, int cspan, int anchor, int fill, double wx, double wy)
           
static void constrain(Container container, Component component, int row, int col, int rspan, int cspan, int anchor, int fill, double wx, double wy, int padx, int pady)
           
static void constrain(Container container, Component component, int row, int col, int rspan, int cspan, int anchor, int fill, double wx, double wy, int mx, int padx, int pady, int my, int mt, int mb)
           
static Box createHorizontalBox(Component... components)
          Create a box, stacking all components horizontally, and making sure each will stretch fill all of the height in the box.
static Box createVerticalBox(Component... components)
          Create a box, stacking all components vertically, and making sure each will stretch fill all of the width in the box.
static JDialog createWarningDialog(JFrame frame, String message)
          Create a warning dialog for display from a given frame.
static void expand(JTree tree, TreePath treePath)
          Make sure that a TreePath in a JTree is expanded and visible.
static Dimension getScreenSize()
          Return pixel dimensions of screen (desktop).
static JComponent setBorderTitle(String title, JComponent component)
          Give a component a titled border, returning the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
CVS ID

See Also:
Constant Field Values
Constructor Detail

SwingFactory

public SwingFactory()
Method Detail

getScreenSize

public static Dimension getScreenSize()
Return pixel dimensions of screen (desktop).

Returns:
screen size

setBorderTitle

public static JComponent setBorderTitle(String title,
                                        JComponent component)
Give a component a titled border, returning the component. If the component already has a border, it will be replaced.

Parameters:
title - Short title for display
component - The swing component
Returns:
The component

addBorderTitle

public static JComponent addBorderTitle(String title,
                                        JComponent component)
Wrap a component with a titled border, returning the component. The additional border will surround the components current border (if any).

Parameters:
title - Short title for display
component - The swing component
Returns:
The component

createVerticalBox

public static Box createVerticalBox(Component... components)
Create a box, stacking all components vertically, and making sure each will stretch fill all of the width in the box.

Parameters:
components - Components for box
Returns:
The vertical box

createHorizontalBox

public static Box createHorizontalBox(Component... components)
Create a box, stacking all components horizontally, and making sure each will stretch fill all of the height in the box.

Parameters:
components - Components for box
Returns:
The vertical box

createWarningDialog

public static JDialog createWarningDialog(JFrame frame,
                                          String message)
Create a warning dialog for display from a given frame. Calling setVisible(true) will display the dialog.

Parameters:
frame - The parent frame of the dialog
message - Warning text for display
Returns:
The warning dialog

expand

public static void expand(JTree tree,
                          TreePath treePath)
Make sure that a TreePath in a JTree is expanded and visible.

Parameters:
tree - The tree
treePath - Path to TreeNode

constrain

public static void constrain(Container container,
                             Component component,
                             int row,
                             int col)
Parameters:
container -
component -
row -
col -

constrain

public static void constrain(Container container,
                             Component component,
                             int row,
                             int col,
                             int rspan,
                             int cspan)
Parameters:
container -
component -
row -
col -
rspan -
cspan -

constrain

public static void constrain(Container container,
                             Component component,
                             int row,
                             int col,
                             int rspan,
                             int cspan,
                             int anchor,
                             int fill)
Parameters:
container -
component -
row -
col -
rspan -
cspan -
anchor -
fill -

constrain

public static void constrain(Container container,
                             Component component,
                             int row,
                             int col,
                             int rspan,
                             int cspan,
                             int anchor,
                             int fill,
                             double wx,
                             double wy)
Parameters:
container -
component -
row -
col -
rspan -
cspan -
anchor -
fill -
wx -
wy -

constrain

public static void constrain(Container container,
                             Component component,
                             int row,
                             int col,
                             int rspan,
                             int cspan,
                             int anchor,
                             int fill,
                             double wx,
                             double wy,
                             int padx,
                             int pady)
Parameters:
container -
component -
row -
col -
rspan -
cspan -
anchor -
fill -
wx -
wy -
padx -
pady -

constrain

public static void constrain(Container container,
                             Component component,
                             int row,
                             int col,
                             int rspan,
                             int cspan,
                             int anchor,
                             int fill,
                             double wx,
                             double wy,
                             int mx,
                             int padx,
                             int pady,
                             int my,
                             int mt,
                             int mb)
Parameters:
container -
component -
row -
col -
rspan -
cspan -
anchor -
fill -
wx -
wy -
mx -
padx -
pady -
my -
mt -
mb -

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona