|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.util.MenuUtil
ucar.unidata.util.LayoutUtil
ucar.unidata.util.GuiUtils
public class GuiUtils
This is a vast catchall class to old various utilities for doing GUI things.
| Nested Class Summary | |
|---|---|
static class |
GuiUtils.CardLayoutPanel
Class CardLayoutPanel is a utility that does a card layou of its components. |
static class |
GuiUtils.ColorSwatch
A color swatch panel |
static class |
GuiUtils.ProgressDialog
Class ProgressDialog _more_ |
static class |
GuiUtils.TreeSearchResults
Class TreeSearchResults Holds state from a tree search |
static class |
GuiUtils.VerticalLabelUI
Class for a vertical label |
| Field Summary | |
|---|---|
static String |
ATTR_ACTION
xml attribute name |
static String |
ATTR_ICON
xml attribute name |
static String |
ATTR_ID
xml attribute name |
static String |
ATTR_TOOLTIP
xml attribute name |
static Font |
buttonFont
Used by apps for having a common font for buttons |
static String |
CMD_APPLY
Action command used for the Apply button |
static String |
CMD_CANCEL
Action command used for the Cancel button |
static String |
CMD_CLOSE
Action command used for the Close button |
static String |
CMD_EXPORT
Action command used for the Export button |
static String |
CMD_HELP
Action command used for the Help button |
static String |
CMD_IMPORT
Action command used for the Import button |
static String |
CMD_NEW
Action command used for the New button |
static String |
CMD_NO
Action command used for the No button |
static String |
CMD_OK
Action command used for the OK button |
static String |
CMD_OPEN
Action command used for the Open button |
static String |
CMD_REMOVE
Action command used for the Remove button |
static String |
CMD_RENAME
Action command used for the Rename button |
static String |
CMD_RESET
Action command used for the Reset button |
static String |
CMD_SAVE
Action command used for the Save button |
static String |
CMD_SAVEAS
Action command used for the Saveas button |
static String |
CMD_START
Action command used for the Start button |
static String |
CMD_STOP
Action command used for the Stop button |
static String |
CMD_SUBMIT
Action command used for the Submit button |
static String |
CMD_UPDATE
Action command used for the Update button |
static String |
CMD_YES
Action command used for the Yes button |
static String[] |
COLORNAMES
Used to map named colors to color |
static Color[] |
COLORS
Used to map named colors to color |
static int[] |
FONT_SIZES
font sizes |
static String |
MISSING_IMAGE
missing image path |
static Cursor |
normalCursor
The normal cursor_ |
static TimeZone |
TIMEZONE_UTC
|
static Cursor |
waitCursor
The cursor to use when waiting |
| Fields inherited from class ucar.unidata.util.LayoutUtil |
|---|
INSETS_2, INSETS_5, tmpAnchor, tmpColFills, tmpFill, tmpInsets, WT_N, WT_NN, WT_NNN, WT_NNNY, WT_NNY, WT_NNYN, WT_NNYNY, WT_NNYNYNY, WT_NY, WT_NYN, WT_NYNY, WT_NYNYN, WT_NYY, WT_Y, WT_YN, WT_YNN, WT_YNY, WT_YNYN, WT_YY, WT_YYN, WT_YYY, ZERO_INSETS |
| Fields inherited from class ucar.unidata.util.MenuUtil |
|---|
MENU_SEPARATOR |
| Method Summary | |
|---|---|
static JComponent |
addActionListener(JComponent comp,
Object object,
String methodName,
Object arg)
Adds an action listener to the button. |
static void |
addKeyBindings(JTextComponent comp)
_more_ |
static void |
addKeyListenerRecurse(KeyListener listener,
Container c)
Add a key listener to all components of a container |
static void |
addLinkListener(JEditorPane editor)
_more_ |
static void |
addModalDialogComponent(Component comp)
Add the model dialog to the list |
static void |
addMouseListenerRecurse(MouseListener listener,
Container c)
Add a mouse listener to all components of a container |
static boolean |
anySelected(JComboBox box)
Check if there are any selected items in the combobox. |
static void |
appendText(JTextComponent fld,
String s,
String delimiter)
_more_ |
static void |
applyDefaultFont(Component comp)
_more_ |
static boolean |
askOkCancel(String title,
Object question)
Ask the user the question. |
static boolean |
askYesNo(String title,
Object question)
Ask the user the question. |
static ButtonGroup |
buttonGroup(JToggleButton b1,
JToggleButton b2)
Create a button group and add the two buttons to it. |
static ButtonGroup |
buttonGroup(JToggleButton b1,
JToggleButton b2,
JToggleButton b3)
Create a button group and add the three buttons to it. |
static int |
charToKeyCode(char ch)
Return the numeric key code of the given character. |
static int |
charToKeyCode(String s)
Take the first character of the string and return the numeric key code |
static void |
checkHeavyWeightComponents(JTabbedPane tab)
Walk the components of the tab and toggle the heavyweight components visiblity |
static boolean |
checkHeight(int height)
Check the height against a value |
static JLabel |
cLabel(String s)
Create a center aligned JLabel |
static void |
configureStepSelection(JList list)
Add a listener to the JList that pops up a menu on a right click that allos for the selection of different strides. |
static JDialog |
createDialog(String title,
boolean modal)
A utility to create a dialog. |
static JDialog |
createDialog(Window parent,
String title,
boolean modal)
Utility to create a JDialog with a parent component. |
static JFrame |
createFrame(String title)
A utility to create a frame. |
static JComboBox |
createValueBox(ActionListener listener,
String command,
int initValue,
List values,
boolean editable)
Create a combobx boxc that holds a set of integer values. |
static Color |
decodeColor(String value,
Color dflt)
This takes the given String and tries to convert it to a color. |
static void |
decorateFrame(JFrame frame,
JMenuBar menuBar)
_more_ |
static double |
distance(double[] p1,
double[] p2)
Get distance between |
static double |
distance(double x1,
double y1,
double x2,
double y2)
Calculate distance between 2 points. |
static double |
distance(double x,
double y,
Rectangle2D r)
Calculate distance between point and rectangle. |
static double |
distance(int[] p1,
int[] p2)
Get distance between |
static boolean |
doMacMenubar()
_more_ |
static JComboBox |
doMakeFontBox(Font f)
Make a font selector box |
static JComboBox |
doMakeFontSizeBox(int size)
Make a box for setting the font size |
static JComponent |
doMultiSplitPane(List comps,
boolean hsplit)
Make an evenly balanced group of split panes for the given components |
static GuiUtils.TreeSearchResults |
doTreeSearch(JTree tree,
Object lastState,
String nodeDesc,
JComponent near)
Popup a dialog and search the given tree for a tree node that matches the user provided string. |
static GuiUtils.TreeSearchResults |
doTreeSearch(JTree tree,
Object lastState,
String nodeDesc,
JComponent near,
String originalPhrase)
Search the given tree |
static void |
empty(Container c)
If non-null then removes all children and removes from parent. |
static void |
empty(Container c,
boolean doItInSwingThread)
If non-null then removes all children and removes from parent. |
static void |
enableComponents(List comps,
boolean enable)
Enable or disable the list of Components |
static void |
enableTree(Component comp,
boolean enable)
Enable or disable a whole tree's worth of components |
static void |
expandPathsAfterChange(JTree tree,
Hashtable state,
DefaultMutableTreeNode root)
Call this after the structure of a JTree changes to re-expand the paths. |
static void |
exportAsCsv(String header,
TableModel model)
Write out the given table model as a comma separated value (CSV) file prepending the header. |
static void |
exportAsCsv(String header,
TableModel model,
boolean includeColumnNames)
Write out the given table model as a comma separated value (CSV) file prepending the header. |
static void |
exportAsCsv(String header,
TableModel model,
String filename)
Export a table as csv |
static void |
exportAsCsv(String header,
TableModel model,
String filename,
boolean includeColumnNames)
Export a table as csv |
static void |
exportAsCsv(TableModel model)
Write out the given table model as a csv file |
static List |
findChildren(Node parent,
String tag)
_more_ |
static JPanel |
flow(Component[] comps)
Create a panel and do flow layout of the components |
static JPanel |
flowRight(Component[] comps)
Create a panel and do a a right align flow layout of the components |
static String |
formatDate(Date dttm)
Format the date with the default date format and timezone |
static JComponent |
formLayout(Component[] comps)
Do a 2 column layout. |
static JComponent |
formLayout(Component[] comps,
double[] widths,
double[] heights)
Do a 2 column layout. |
static JComponent |
formLayout(List objects)
Layout as a 2 column form |
static JComponent |
formLayout(List comps,
boolean rightAlignFirstColumn)
Do a 2 column layout. |
static JComponent |
formLayout(List comps,
double[] widths,
double[] heights)
Do a 2 column layout. |
static JComponent |
formLayout(List comps,
double[] widths,
double[] heights,
boolean rightAlignFirstColumn)
Do a 2 column layout. |
static JComponent |
formLayout(List objects,
Insets insets)
Do a 2 column layout of the objects with the given insets for spacing |
static JComponent |
formLayout(Object[] objects)
This does a doLayout with 2 columns. |
static JComponent |
formLayout(Object[] objects,
Insets insets)
This does a doLayout with 2 columns. |
static String |
getApplicationTitle()
_more_ |
static String |
getAttribute(NamedNodeMap attrs,
String name)
_more_ |
static boolean |
getAttribute(NamedNodeMap attrs,
String name,
boolean dflt)
_more_ |
static String |
getAttribute(NamedNodeMap attrs,
String name,
String dflt)
_more_ |
static String |
getAttribute(Node element,
String name,
String dflt)
Get the given name-d attribute from the given element. |
static int |
getBoxValue(JComboBox box)
Return the selected item in the given box as an integer. |
static ObjectListener |
getCloseDialogListener(JDialog dialog)
Create a listener that will close the given dialog. |
static String |
getColorName(Color color)
Return the name of the given color. |
static void |
getConfigureStepSelectionItems(JList list,
List items)
popup a menu to select strides |
static Font |
getDefaultFont()
Get the default font |
static int |
getDefaultIconSize()
Get the default icon size |
static JComboBox |
getEditableBox(List items,
Object selected)
Create an editable combobox with the given items. |
static JLabel |
getFixedWidthLabel(String s)
Create a JLabel with a fixed width font |
static Vector |
getFontList()
Get a list of fonts |
static Vector |
getFontSizeList()
Get a list of font sizes |
static JFrame |
getFrame(Component component)
This finds and returns the JFrame, or null if not found, that holds the given component. |
static Component[] |
getHtmlComponent(String html,
HyperlinkListener linkListener,
int width,
int height)
Make a JTextEditor component and scroller for the given html |
static boolean |
getIconsInMenus()
Do we show icons in the menus |
static Image |
getImage(Component component)
Get the screen image from the component |
static Image |
getImage(String file)
Create an Image from the given image file name. |
static Image |
getImage(String file,
Class c)
Create an Image from the given image file name. |
static Image |
getImage(String file,
Class c,
boolean cache)
Create an Image from the given image file name. |
static Image |
getImage(String file,
Class c,
boolean cache,
boolean returnNullIfNotFound)
Get an image |
static JButton |
getImageButton(ImageIcon icon)
Create a JButton that displays the given image icon |
static JButton |
getImageButton(ImageIcon icon,
int offset)
Create a JButton that displays the given image icon |
static JButton |
getImageButton(ImageIcon icon,
int hinset,
int vinset)
Create a JButton that displays the given image icon |
static JButton |
getImageButton(String icon,
Class origin)
Create a JButton that displays an image icon create from the given icon path (may be a file, resource or url). |
static JButton |
getImageButton(String icon,
Class origin,
int hInset,
int vInset)
Create a JButton that displays an image icon create from the given icon path (may be a file, resource or url). |
static ImageIcon |
getImageIcon(String file)
Create an ImageIcon from the given image file name. |
static ImageIcon |
getImageIcon(String file,
boolean cache)
Create an ImageIcon from the given image file name. |
static ImageIcon |
getImageIcon(String file,
Class c)
Create an ImageIcon from the given image file name. |
static ImageIcon |
getImageIcon(String file,
Class c,
boolean cache)
Create an ImageIcon from the given image file name. |
static JLabel |
getImageLabel(String icon)
Create a JLabel that displays an image icon create from the given icon path (may be a file, resource or url). |
static JLabel |
getImageLabel(String icon,
Class origin)
Create a JLabel that displays an image icon create from the given icon path (may be a file, resource or url). |
static String |
getInput(String question)
Ask the user the question. |
static String |
getInput(String question,
String label,
String initValue)
Ask the user the question. |
static String |
getInput(String question,
String label,
String initValue,
String trailingLabel)
Ask the user the question. |
static String |
getInput(String question,
String label,
String initValue,
String trailingLabel,
Object underLabel)
Ask the user the question. |
static String |
getInput(String question,
String label,
String initValue,
String trailingLabel,
Object underLabel,
String title)
Ask the user the question. |
static String |
getInput(String question,
String label,
String initValue,
String trailingLabel,
Object underLabel,
String title,
int fieldWidth)
Ask the user the question. |
static String |
getInput(String question,
String label,
String initValue,
String trailingLabel,
Object underLabel,
String title,
int fieldWidth,
JComponent nearComponent)
Ask the user the question. |
static int |
getInt(JTextField fld)
Get an integer value from the text field |
static List |
getItems(JComboBox box)
return the list of items held by the combo box. |
static List |
getItems(JList list)
_more_ |
static String |
getLocalName(String n,
boolean local)
_more_ |
static String |
getLocalName(String n,
boolean local,
boolean addHtml)
_more_ |
static Point |
getLocation(Component src)
Find the location of the given componet on the screen. |
static JTabbedPane |
getNestedTabbedPane()
Make a JTabbedPane without some of its border |
static JTabbedPane |
getNestedTabbedPane(int orient)
Make a JTabbedPane without some of its border |
static JTabbedPane |
getNestedTabbedPane(int orient,
int top,
int left,
int bottom,
int right)
Make a JTabbedPane without some of its border |
static JButton |
getScaledImageButton(String icon,
Class origin,
int hInset,
int vInset)
Get a scaled image button |
static ImageIcon |
getScaledImageIcon(String file,
Class c,
boolean cache)
Get a scaled image icon |
static double |
getSliderPercent(JSlider s)
Return the slider value as a percentage between its min and max |
static TimeZone |
getTimeZone()
Get the default timezone used for formatting |
static JToggleButton |
getToggleButton(ImageIcon icon,
int hinset,
int vinset)
Create a toggle button with the given image. |
static JToggleButton |
getToggleButton(String iconPath,
int hinset,
int vinset)
Create a toggle button with the given image. |
static JToggleButton |
getToggleImageButton(ImageIcon icon,
ImageIcon selectedIcon,
int hinset,
int vinset)
Create a JToggleButton with the given image and, if non-null, the given selected image. |
static JToggleButton |
getToggleImageButton(ImageIcon icon,
ImageIcon selectedIcon,
int hinset,
int vinset,
boolean addMouseOverBorder)
Create a JToggleButton with the given image and, if non-null, the given selected image. |
static JToggleButton |
getToggleImageButton(String icon,
String selectedIcon,
int hinset,
int vinset,
boolean addMouseOverBorder)
Create a JToggleButton with the given image and, if non-null, the given selected image. |
static double |
getValue(JTextField fld)
Get an double value from the text field |
static int |
getValueFromBox(JComboBox box)
Get the integer value from a JComboBox of integer items |
static Window |
getWindow(Component component)
This finds and returns the Window, or null if not found, that contains the given component. |
static void |
handleHeavyWeightComponentsInTabs(JTabbedPane tab)
Add a change listener to the tab that toggles on any heavy weight components in the selected tab and turns off any in the non-selected tabs. |
static JComponent |
hspace(int w,
int h)
Create a a minimally sized spacer |
static JSplitPane |
hsplit(Component left,
Component right)
Create a basic horizontally aligned JSplitPane |
static JSplitPane |
hsplit(Component left,
Component right,
double resizeWeight)
Create a horizontally aligned JSplitPane |
static JSplitPane |
hsplit(Component left,
Component right,
int leftSpace)
Create a horizontally aligned JSplitPane |
static JSplitPane |
hsplit(Component left,
Component right,
int leftSpace,
double resizeWeight)
Create a horizontally aligned JSplitPane. |
static Hashtable |
initializeExpandedPathsBeforeChange(JTree tree,
DefaultMutableTreeNode root)
Call this before a JTree changes. |
static void |
initLabels()
Init the fixed labels |
static void |
insertText(JTextComponent comp,
String s)
Insert text into the component |
static void |
invokeInSwingThread(Runnable runnable)
RUn the given runnable in the swing event dispatch thread |
static boolean |
isControlKey(InputEvent event)
Is the given event a control (or meta for the mac) key |
static boolean |
isControlKey(KeyEvent event,
int keyCode)
|
static boolean |
isDeleteEvent(KeyEvent e)
_more_ |
static boolean |
isMac()
Is this running on a Mac? |
static boolean |
isShowing(JDialog f)
Is the dialog showing |
static boolean |
isShowing(JFrame f)
Is the frame showing |
static Component |
italicizeFont(Component comp)
Italicize the font on the given component |
static JPanel |
label(Component widget,
String label)
Create a JPanel that holds a the given widget/JLabel |
static JPanel |
label(String label,
Component widget)
Create a JPanel that holds a JLabel/the given widget |
static void |
limitMenuSize(JMenu menu,
String name,
int size)
This ensures that there are no more than size number of items in any sub menu. |
static void |
limitMenuSize(JMenu menu,
String name,
int size,
boolean recurse)
This ensures that there are no more than size number of items in any sub menu. |
static void |
limitMenuSize(List items,
String name,
int size)
This takes the list of JMenuItems and, for each JMenu, will ensure that there are no more than size number of items in any sub menu. |
static JLabel |
lLabel(String s)
Create a left aligned JLabel |
static void |
main(String[] args)
test |
static ActionListener |
makeActionListener(Object object,
String methodName,
Object arg)
Make an ActionListener. |
static JButton |
makeApplyButton(ActionListener l)
Utility to make apply button panel |
static JPanel |
makeApplyCancelButtons(ActionListener l)
Utility to make apply/cancel button panel |
static JPanel |
makeApplyOkCancelButtons(ActionListener l)
Utility to make apply/ok/cancel button panel |
static JPanel |
makeApplyOkHelpCancelButtons(ActionListener l)
Utility to make apply/ok/help/cancel button panel |
static JPanel |
makeApplyOkResetCancelButtons(ActionListener l)
Utility to make apply/ok/reset/cancel button panel |
static JButton |
makeButton(String label,
Object object,
String methodName)
Make a JButton. |
static JButton |
makeButton(String label,
Object object,
String methodName,
Object arg)
Make a JButton. |
static JButton |
makeButton(String label,
Object object,
String methodName,
Object arg,
String tooltip)
Make a JButton. |
static JPanel |
makeButtons(ActionListener l,
String[] cmds)
Make a set of JButtons, each with a label and action command from the given cmds array. |
static JPanel |
makeButtons(ActionListener l,
String[] cmds,
Hashtable buttonMap)
Make a set of JButtons, each with a label and action command from the given cmds array. |
static JPanel |
makeButtons(ActionListener l,
String[] labels,
String[] cmds)
Make a set of JButtons, each with a label and action command from the given cmds and labels arrays. |
static JPanel |
makeButtons(ActionListener l,
String[] labels,
String[] cmds,
Hashtable buttonMap)
Make a set of JButtons, each with a label and action command from the given cmds and labels arrays. |
static JPanel |
makeButtons(ActionListener l,
String[] labels,
String[] cmds,
String[] tooltips,
Hashtable buttonMap)
Make a set of JButtons, each with a label and action command from the given cmds and labels arrays. |
static JCheckBox |
makeCheckbox(String label,
Object object,
String property)
Make a checkbox. |
static JCheckBox |
makeCheckbox(String label,
Object object,
String property,
Object arg)
Make a checkbox. |
static JComboBox |
makeColorNameComboBox(Color dflt)
A helper to make a color selector combo box |
static JComponent[] |
makeColorSwatchWidget(Color color,
String label)
This makes a color swatch and a 'Set' button that is used to set the color. |
static JComboBox |
makeComboBox(int[] values,
String[] labels,
int current)
Make a combo box from a set of values and labels |
static JComboBox |
makeComboBox(List items,
Object selected,
boolean editable,
Object listener,
String methodName)
Make a JComboBox |
static JComboBox |
makeComboBox(List items,
Object selected,
boolean editable,
Object listener,
String methodName,
boolean inAThread)
Make a JComboBox |
static int |
makeDialog(Window f,
String title,
Component contents,
Component src,
String[] buttonLabels)
Make and show a modeful dialog with the given collection of buttons. |
static JMenu |
makeDynamicMenu(String name,
Object object,
String methodName)
Create a menu and add a listener to it that removes all items and calls the given method on te given object with the menu as an argument. |
static JMenu |
makeDynamicMenu(String name,
Object object,
String methodName,
boolean doRemoveAll)
Create a menu and add a listener to it that removes all items and calls the given method on te given object with the menu as an argument. |
static JButton |
makeFileBrowseButton(JTextComponent fld)
Make a button that pops up a file browser and sets the text of the given field with the selected file |
static JButton |
makeFileBrowseButton(JTextComponent fld,
boolean chooseDirectory,
List filters)
Make a button that pops up a file browser and sets the text of the given field with the selected file |
static JButton |
makeFileBrowseButton(JTextComponent fld,
List filters)
Make a button that pops up a file browser and sets the text of the given field with the selected file |
static JComponent |
makeHeader(String label)
Utility to create a header that is a label and a line. |
static JButton |
makeImageButton(String label,
Object object,
String methodName)
Make a JButton. |
static JButton |
makeImageButton(String label,
Object object,
String methodName,
Object arg)
Make a JButton. |
static JButton |
makeImageButton(String label,
Object object,
String methodName,
Object arg,
boolean addMouseOverBorder)
Make a JButton. |
static JButton |
makeJButton(String label,
ActionListener listener)
Utility to make a JButton, adding the given listener as an ActionListener |
static JButton |
makeJButton(String label,
Object[] args)
Utility method for creating and setting various properties of a JButton args array holds a set of key value pairs: -tooltip <The tooltip text> -bg <Background color> -listener <Action listener> -command <Action command> |
static JMenuBar |
makeMenuBar(List menus)
Create a JMenuBar and add the menus contained with the menus list If no menus then return null. |
static void |
makeMouseOverBorder(JComponent b)
Make a mouse over border |
static JPanel |
makeNewOkCancelButtons(ActionListener l)
Utility to make new/ok/cancel button panel |
static JPanel |
makeNewOkCancelButtons(ActionListener l,
String newLabel,
String okLabel,
String cancelLabel)
Utility to make new/ok/cancel button panel |
static JPanel |
makeNewOkCancelHelpButtons(ActionListener l)
Utility to make new/ok/cancel/help button panel |
static JPanel |
makeOkCancelButtons(ActionListener l)
Utility to make ok/cancel button panel |
static JPanel |
makeOkCancelButtons(ActionListener l,
String okLabel,
String cancelLabel)
Utility to make ok/cancel button panel |
static JPanel |
makeOkHelpCancelButtons(ActionListener l)
Utility to make ok/help/cancel button panel |
static JRadioButton[] |
makeRadioButtons(List labels,
int selectedIndex,
Object object,
String methodName)
Make a set of radio buttons |
static void |
makeRowVisible(JTable table,
int row)
Make the given row in the table visible |
static JScrollPane |
makeScrollPane(Component c,
int xdim,
int ydim)
Make a scroll pane for the input box which may be used to hold selection buttons later; size is given; text for a title in box. |
static JSlider |
makeSlider(int min,
int max,
int value,
Object listener,
String methodName)
Make a JSlider |
static JSlider |
makeSlider(int min,
int max,
int value,
Object listener,
String methodName,
boolean updateAsMove)
Make a JSlider |
static JComponent[] |
makeSliderPopup(int min,
int max,
int value,
ChangeListener listener)
This creates a JButton and a JSlider. |
static TwoFacedObject |
makeTwoFacedFont(Font f)
Make a TwoFacedObject from a font for displaying in a combobox. |
static JLabel |
makeVerticalLabel(String text)
Make a vertical label |
static JFrame |
makeWindow(String title,
Component contents,
int x,
int y)
Create a new JFrame, add the contents to it, set its location and return it. |
static void |
moveSubtreesToTop(DefaultMutableTreeNode parent)
_more_ |
static JDialog |
packDialog(JDialog f,
Component contents)
Add the given contents into the given dialog |
static void |
packInCenter(JDialog dialog)
pack the dialog in the center of the screen |
static JFrame |
packWindow(JFrame f,
Component contents)
Add the given contents into the given frame |
static JFrame |
packWindow(JFrame f,
Component contents,
boolean andShow)
Add the given contents into the given frame |
static Component[] |
popup(String text,
int x,
int y,
boolean modal)
Popup an html widget at the given x/y that shows the text (or, if the text is a URI will read the URI). |
static void |
popupUnitMenu(JTextField fld,
JComponent comp)
This pops up a menu near the given comp and allows the user to select a unit name which gets put into the given fld |
static void |
positionAndFitToScreen(Window window,
Rectangle bounds)
Position and fit a window to the screen |
static JMenu |
processXmlMenu(Node menuNode,
ActionListener listener,
Hashtable menuItems)
Create the JMenu from the given xml. |
static JMenu |
processXmlMenu(Node menuNode,
ActionListener listener,
Hashtable menuItems,
Hashtable<String,ImageIcon> actionIcons)
Create the JMenu from the given xml. |
static JMenuBar |
processXmlMenuBar(Element root,
JMenuBar menuBar,
ActionListener listener,
Hashtable menuItems)
Create, if null, and ddd to the JMenuBar from the xml |
static JMenuBar |
processXmlMenuBar(Element root,
JMenuBar menuBar,
ActionListener listener,
Hashtable menuItems,
Hashtable<String,ImageIcon> actionIcons)
Create, if null, and ddd to the JMenuBar from the xml |
static JMenuItem |
processXmlMenuItem(Node node,
ActionListener listener,
Hashtable menuItems)
Create the JMenuItem defined by the given xml |
static JMenuItem |
processXmlMenuItem(Node node,
ActionListener listener,
Hashtable menuItems,
Hashtable<String,ImageIcon> actionIcons)
Create the JMenuItem defined by the given xml |
static void |
removeModalDialogComponent(Component comp)
Remove the model dialog from the list |
static void |
resetHeavyWeightComponents(JTabbedPane tab)
Walk the components of the tab and toggle the heavyweight components visiblity |
static JLabel |
rLabel(String s)
Create a right aligned JLabel |
static ImageIcon |
scaleImageIcon(ImageIcon icon)
This scales the image icon up to the minimum icon size if it is defined |
static void |
scrollToTop(JEditorPane editor)
Scroll the given component to the top |
static void |
setApplicationTitle(String title)
_more_ |
static void |
setBackgroundOnTree(Container c,
Color bgColor)
Recurse the Component hierarchy, setting the background color of each component. |
static void |
setCursor(Component component,
Cursor cursor)
This finds the Window the given component c is in and, if it is found, sets the cursor of the Window to the given cursor. |
static void |
setDefaultDateFormat(String fmt)
Set the default date format |
static void |
setDefaultFont(Font font)
Set the default font |
static void |
setDefaultIconSize(int size)
Set the default icon size |
static void |
setFixedWidthFont(Component comp)
Set the font on the component to be monospaced |
static void |
setFontOnTree(JComponent c,
Font f)
Recurse the Component hierarchy, setting the font. |
static void |
setForegroundOnTree(Component comp,
Color fgColor)
Recurse the Component hierarchy, setting the foreground color of each component. |
static void |
setForegroundOnTree(Component comp,
Color fgColor,
Color ifEquals)
Recurse the Component hierarchy, setting the foreground color of each component. |
static AbstractButton |
setIcon(AbstractButton button,
String iconPath)
Set the icon on the button. |
static void |
setIconsInMenus(boolean doIcons)
Do we show icons in the menus |
static void |
setListData(JComboBox box,
List items)
Procedure to set the list of items in a ComboBox |
static void |
setListData(JComboBox box,
Object[] items)
Procedure to set the list of items in a ComboBox |
static void |
setPreferredWidth(JComponent comp,
int width)
Set the preferred width on a component |
static void |
setSelectedItems(JList list,
List selected)
_more_ |
static JComponent |
setSize(JComponent comp,
int w,
int h)
Set the size and preferred size of the component and return it |
static void |
setSliderPercent(JSlider s,
double percent)
Set the slider value as a percentage between its min and max |
static void |
setTimeZone(TimeZone tz)
Set the default timezone used for formatting |
static void |
setToolTipOnTree(Container c,
String tooltip)
Recurse the Component hierarchy, setting the tooltip of each component. |
static void |
setupDirectoryChooser(JButton btn,
JTextField directoryFld)
Set up a directory chooser |
static void |
setupFileChooser(JButton btn,
JTextField directoryFld,
boolean justDirectories)
Set up a directory chooser |
static void |
setValueOfBox(JComboBox box,
int value,
int[] values,
String[] labels)
Set the value of the box |
static void |
showComponentInTabs(Component comp)
Show the component in any contained tabs |
static void |
showComponentInTabs(Component comp,
boolean andShowWindow)
Show the component in any containing tabs |
static void |
showDialog(String title,
Component comp)
Show the given component in a dialog. |
static void |
showDialog(String title,
Component comp,
Component parentComponent)
Show the given component in a dialog. |
static void |
showDialogNearSrc(Component src,
Component theWindow)
This will set the location of the theWindow component (might be A JDialog or a JFrame) at the screen location of the given src component. |
static Component[] |
showHtmlDialog(String html,
HyperlinkListener linkListener)
Show the given html in a window. |
static Component[] |
showHtmlDialog(String html,
String title,
HyperlinkListener linkListener)
Show the given html in a window with the given title. |
static Component[] |
showHtmlDialog(String html,
String title,
String label,
HyperlinkListener linkListener,
boolean modal)
Show a dialog window that contains an html editor |
static void |
showInCenter(JDialog dialog)
pack and show the dialog in the center of the screen |
static void |
showIntervalSelectionDialog(JList list)
Show the list interval selection dialog |
static boolean |
showOkCancelDialog(Window f,
String title,
Component contents,
Component src)
Show a modeful Ok/Cancel dialog. |
static boolean |
showOkCancelDialog(Window f,
String title,
Component contents,
Component src,
List actionComponents)
Show a modeful Ok/Cancel dialog. |
static boolean |
showOkCancelDialog(Window f,
String title,
Component contents,
Component src,
List actionComponents,
String okLabel)
Show a modeful Ok/Cancel dialog. |
static void |
showOkDialog(Window f,
String title,
Component contents,
Component src)
Show OK dialog |
static void |
showUrl(String s)
_more_ |
static void |
showWidget(Component c)
This will show and/or deiconify the given component. |
static int |
showYesNoCancelDialog(Window frame,
String message,
String title)
Show a modeful dialog, attached to the given frame, with the given message. |
static int |
showYesNoCancelDialog(Window frame,
String message,
String title,
String defaultCmd)
Show a modeful dialog, attached to the given frame, with the given message. |
static boolean |
showYesNoDialog(Window frame,
String title,
Component contents,
Component src)
Show a modeful dialog, attached to the given frame, with the given message. |
static boolean |
showYesNoDialog(Window frame,
String message,
String title)
Show a modeful dialog, attached to the given frame, with the given message. |
static boolean |
showYesNoDialog(Window frame,
String message,
String title,
String yes,
String no)
Show a modeful dialog, attached to the given frame, with the given message. |
static String |
toCsv(TableModel model)
Convert the given table model to comma separated string |
static String |
toCsv(TableModel model,
boolean includeColumnNames)
Convert the given table model to comma separated string |
static void |
toFront(Window window)
Move the window to the front |
static void |
toFrontModalDialogs()
Move to the front any modal dialogs |
static void |
toggleHeavyWeightComponents(Component comp,
boolean visible)
Walk the tree and set any heavyweight components visibility. |
static JComponent |
valignLabel(String s)
This makes a component that contains a jlabel. |
static JSplitPane |
vsplit(Component top,
Component bottom)
Create a JSplitPane in vertical mode. |
static JSplitPane |
vsplit(Component top,
Component bottom,
double resizeWeight)
Create a JSplitPane in vertical mode. |
static JSplitPane |
vsplit(Component top,
Component bottom,
int topSpace)
Create a JSplitPane in vertical mode. |
static JSplitPane |
vsplit(Component top,
Component bottom,
int topSpace,
double resizeWeight)
Create a JSplitPane in vertical mode. |
| Methods inherited from class ucar.unidata.util.LayoutUtil |
|---|
bottom, center, centerBottom, centerRight, colGrid, doLayout, doLayout, doLayout, doLayout, doLayout, filler, filler, getComponentArray, grid, grid, hbox, hbox, hbox, hbox, hbox, hbox, hbox, hbox, hbox, hbox, hbox, hfill, hflow, hflow, hgrid, hgrid, hgrid, inset, inset, inset, inset, left, leftCenter, leftCenterRight, leftRight, leftVbox, right, rowGrid, rowGrid, setAnchorBottom, setAnchorTop, setHFill, setNoFill, toList, top, topBottom, topCenter, topCenterBottom, topLeft, vbox, vbox, vbox, vbox, vbox, vbox, vgrid, vgrid, wrap, wrapLeft |
| Methods inherited from class ucar.unidata.util.MenuUtil |
|---|
findMethod, makeCheckboxMenuItem, makeCheckboxMenuItem, makeMenu, makeMenu, makeMenuItem, makeMenuItem, makeMenuItem, makeMenuItems, makePopupMenu, makePopupMenu, showPopupMenu, typesMatch |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static String MISSING_IMAGE
public static final String ATTR_ACTION
public static final String ATTR_TOOLTIP
public static final String ATTR_ICON
public static final String ATTR_ID
public static final Cursor waitCursor
public static final Cursor normalCursor
public static final int[] FONT_SIZES
public static final String[] COLORNAMES
public static final Color[] COLORS
public static String CMD_APPLY
public static String CMD_CANCEL
public static String CMD_CLOSE
public static String CMD_IMPORT
public static String CMD_EXPORT
public static String CMD_SUBMIT
public static String CMD_RENAME
public static String CMD_REMOVE
public static String CMD_NEW
public static String CMD_YES
public static String CMD_NO
public static String CMD_OK
public static String CMD_OPEN
public static String CMD_RESET
public static String CMD_HELP
public static String CMD_SAVE
public static String CMD_SAVEAS
public static String CMD_UPDATE
public static String CMD_START
public static String CMD_STOP
public static Font buttonFont
public static final TimeZone TIMEZONE_UTC
| Method Detail |
|---|
public static void initLabels()
public static void setTimeZone(TimeZone tz)
tz - timezonepublic static TimeZone getTimeZone()
public static void setDefaultDateFormat(String fmt)
fmt - date format stringpublic static String formatDate(Date dttm)
dttm - date
public static void setDefaultIconSize(int size)
size - new sizepublic static int getDefaultIconSize()
public static void setDefaultFont(Font font)
font - the default fontpublic static Font getDefaultFont()
public static void applyDefaultFont(Component comp)
comp - _more_public static JLabel getFixedWidthLabel(String s)
s - Initial label string
public static void setFixedWidthFont(Component comp)
comp - The component
public static void setCursor(Component component,
Cursor cursor)
component - The component to look for the window fromcursor - The cursorpublic static JFrame getFrame(Component component)
component - The component to look for the frame
public static void showComponentInTabs(Component comp)
comp - The component to look for the window from
public static void showComponentInTabs(Component comp,
boolean andShowWindow)
comp - Component to showandShowWindow - If we get to a window do we also show itpublic static void toFront(Window window)
window - the windowpublic static Window getWindow(Component component)
component - The component to look for the window from
public static void empty(Container c)
c - The component to empty
public static void empty(Container c,
boolean doItInSwingThread)
c - The component to emptydoItInSwingThread - If true then do the emptying in the Swing thread
public static Color decodeColor(String value,
Color dflt)
value - String valuedflt - This is returned if the value cannot be converted
public static String getColorName(Color color)
color - The color
public static boolean checkHeight(int height)
height - the value to check
public static void setPreferredWidth(JComponent comp,
int width)
comp - componentwidth - width
public static JComponent[] makeColorSwatchWidget(Color color,
String label)
color - The initial colorlabel - The label to use when popping up the color dialog
public static JComboBox makeColorNameComboBox(Color dflt)
dflt - The default color value
public static ImageIcon getImageIcon(String file)
file - The image file
public static ImageIcon getImageIcon(String file,
boolean cache)
file - The image filecache - Should the local in memory cache be checked
public static ImageIcon getImageIcon(String file,
Class c)
file - The image filec - The class to use when looking up the image as a resource
public static ImageIcon getImageIcon(String file,
Class c,
boolean cache)
file - The image filec - The class to use when looking up the image as a resourcecache - Should the local in memory cache be checked
public static ImageIcon getScaledImageIcon(String file,
Class c,
boolean cache)
file - location of the imagec - relative classcache - true to cache result
public static ImageIcon scaleImageIcon(ImageIcon icon)
icon - The icon
public static Image getImage(String file)
file - The image file
public static Image getImage(String file,
Class c)
file - The image filec - Used to lookup the image as a java resource
public static Image getImage(String file,
Class c,
boolean cache)
file - The image filec - Used to lookup the image as a java resourcecache - Should the local cache of Images be checked
public static Image getImage(String file,
Class c,
boolean cache,
boolean returnNullIfNotFound)
file - location of the imagec - relative classcache - true to cache resultreturnNullIfNotFound - true to return null;
public static void showDialogNearSrc(Component src,
Component theWindow)
src - Where we locatetheWindow - What we locatepublic static void showWidget(Component c)
c - The thing to show.
public static JButton makeJButton(String label,
ActionListener listener)
label - The button labellistener - The ActionListener
public static JButton makeJButton(String label,
Object[] args)
label - The button labelargs - The argname/value array
public static double getSliderPercent(JSlider s)
s - The slider
public static void setSliderPercent(JSlider s,
double percent)
s - The sliderpercent - The percent value
public static void setBackgroundOnTree(Container c,
Color bgColor)
c - The componentbgColor - The color
public static void setToolTipOnTree(Container c,
String tooltip)
c - The componenttooltip - The tooltip
public static void setFontOnTree(JComponent c,
Font f)
c - The componentf - The font
public static void setForegroundOnTree(Component comp,
Color fgColor)
comp - The componentfgColor - The color
public static void setForegroundOnTree(Component comp,
Color fgColor,
Color ifEquals)
comp - The componentfgColor - The colorifEquals - If non null then only set the foreground color
on the component its current color equals the given fgColor
public static void enableTree(Component comp,
boolean enable)
comp - The componentenable - The enable flag
public static void enableComponents(List comps,
boolean enable)
comps - List of componentsenable - Enable or disable
public static JScrollPane makeScrollPane(Component c,
int xdim,
int ydim)
c - The component to put in the scroll panexdim - The x dimensionydim - The y dimension
public static JComponent setSize(JComponent comp,
int w,
int h)
comp - componentw - widthh - height_
public static ButtonGroup buttonGroup(JToggleButton b1,
JToggleButton b2)
b1 - Button 1b2 - Button 2
public static ButtonGroup buttonGroup(JToggleButton b1,
JToggleButton b2,
JToggleButton b3)
b1 - Button 1b2 - Button 2b3 - Button 3
public static JComponent valignLabel(String s)
s - The string to create the label with
public static JComponent formLayout(List objects)
objects - objects to lay out
public static JComponent formLayout(List objects,
Insets insets)
objects - May be components or strings. If strings this method will create jlabelsinsets - spacing
public static JComponent formLayout(Object[] objects,
Insets insets)
objects - array of components to layoutinsets - The spacing
public static JComponent formLayout(Object[] objects)
objects - array of components to layout
public static JPanel flowRight(Component[] comps)
comps - The components to add
public static JPanel flow(Component[] comps)
comps - The components to add
public static JPanel makeButtons(ActionListener l,
String[] cmds)
l - Listenercmds - Button labels.action commands
public static JPanel makeButtons(ActionListener l,
String[] cmds,
Hashtable buttonMap)
l - Listenercmds - Button labels.action commandsbuttonMap - If non-null will hold a mapping from (String) command to JButton
public static JPanel makeButtons(ActionListener l,
String[] labels,
String[] cmds)
l - Listenerlabels - Button labelscmds - Button action commands
public static JPanel makeButtons(ActionListener l,
String[] labels,
String[] cmds,
Hashtable buttonMap)
l - Listenerlabels - Button labelscmds - Button action commandsbuttonMap - If non-null will hold a mapping from (String) command to JButton
public static JPanel makeButtons(ActionListener l,
String[] labels,
String[] cmds,
String[] tooltips,
Hashtable buttonMap)
l - Listenerlabels - Button labels. If a label starts with icon: then we make an image button, the image path
is the rest of the labelcmds - Button action commandstooltips - If non-null then set te tooltip on the buttonbuttonMap - If non-null will hold a mapping from (String) command to JButton
public static JPanel makeApplyCancelButtons(ActionListener l)
l - The listener to add to the buttons
public static JButton makeApplyButton(ActionListener l)
l - The listener to add to the buttons
public static JPanel makeOkCancelButtons(ActionListener l)
l - The listener to add to the buttons
public static JPanel makeNewOkCancelButtons(ActionListener l)
l - The listener to add to the buttons
public static JPanel makeNewOkCancelHelpButtons(ActionListener l)
l - The listener to add to the buttons
public static JPanel makeNewOkCancelButtons(ActionListener l,
String newLabel,
String okLabel,
String cancelLabel)
l - The listener to add to the buttonsnewLabel - Label to use for the new buttonokLabel - Label to use for the ok buttoncancelLabel - Label to use for the cancel button
public static JPanel makeOkCancelButtons(ActionListener l,
String okLabel,
String cancelLabel)
l - The listener to add to the buttonsokLabel - Label to use for the ok buttoncancelLabel - Label to use for the cancel button
public static JPanel makeApplyOkCancelButtons(ActionListener l)
l - The listener to add to the buttons
public static JPanel makeOkHelpCancelButtons(ActionListener l)
l - The listener to add to the buttons
public static JPanel makeApplyOkHelpCancelButtons(ActionListener l)
l - The listener to add to the buttons
public static JPanel makeApplyOkResetCancelButtons(ActionListener l)
l - The listener to add to the buttons
public static boolean showYesNoDialog(Window frame,
String message,
String title)
frame - Frame to attach to.message - Message to showtitle - Window title
public static boolean showYesNoDialog(Window frame,
String message,
String title,
String yes,
String no)
frame - Frame to attach to.message - Message to showtitle - Window titleyes - The Yes textno - The No text
public static void insertText(JTextComponent comp,
String s)
comp - components - text to insert
public static int showYesNoCancelDialog(Window frame,
String message,
String title)
frame - Frame to attach to.message - Message to showtitle - Window title
public static int showYesNoCancelDialog(Window frame,
String message,
String title,
String defaultCmd)
frame - Frame to attach to.message - Message to showtitle - Window titledefaultCmd - default for the dialog (CMD_YES, CMD_NO, CMD_CANCEL)
public static boolean showYesNoDialog(Window frame,
String title,
Component contents,
Component src)
frame - Frame to attach to.contents - GUI contentstitle - Window titlesrc - Where to show window
public static boolean showOkCancelDialog(Window f,
String title,
Component contents,
Component src)
f - The frame to attach totitle - The window titlecontents - The gui contents to showsrc - Where should the window popup
public static boolean showOkCancelDialog(Window f,
String title,
Component contents,
Component src,
List actionComponents)
f - The frame to attach totitle - The window titlecontents - The gui contents to showsrc - Where should the window popupactionComponents - If non-null then these are components
in the contents (e.g., JTextField) that an action listener is added to to do the Ok
on an action event
public static JFrame createFrame(String title)
title - Frame title
public static JDialog createDialog(String title,
boolean modal)
title - Dialog titlemodal - Is modal
public static Component[] popup(String text,
int x,
int y,
boolean modal)
text - text or urix - xy - ymodal - modal
public static JDialog createDialog(Window parent,
String title,
boolean modal)
parent - The parent window. May be null, a Dialog or a Frametitle - Dialog titlemodal - Is modal
public static boolean showOkCancelDialog(Window f,
String title,
Component contents,
Component src,
List actionComponents,
String okLabel)
f - The frame to attach totitle - The window titlecontents - The gui contents to showsrc - Where should the window popupactionComponents - If non-null then these are components
in the contents (e.g., JTextField) that an
action listener is added to to do the Ok
on an action eventokLabel - text for the OK button
public static void showOkDialog(Window f,
String title,
Component contents,
Component src)
f - relative windowtitle - title for the dialogcontents - dialog contentssrc - src component
public static int makeDialog(Window f,
String title,
Component contents,
Component src,
String[] buttonLabels)
f - Frame to attach totitle - Window titlecontents - GUI contentssrc - Where to show windowbuttonLabels - Buttons
public static void configureStepSelection(JList list)
list - list to popup onpublic static void showIntervalSelectionDialog(JList list)
list - list
public static void getConfigureStepSelectionItems(JList list,
List items)
list - JListitems - menu items
public static JComponent formLayout(List comps,
boolean rightAlignFirstColumn)
comps - Components to layoutrightAlignFirstColumn - If true then right align the first column
public static JComponent formLayout(Component[] comps)
comps - Components to layout
public static JComponent formLayout(Component[] comps,
double[] widths,
double[] heights)
comps - Components to layoutwidths - WT_heights - WT_
public static JComponent formLayout(List comps,
double[] widths,
double[] heights)
comps - Components to layoutwidths - WT_heights - WT_
public static JComponent formLayout(List comps,
double[] widths,
double[] heights,
boolean rightAlignFirstColumn)
comps - Components to layoutrightAlignFirstColumn - If true then right align the first column.widths - WT_heights - WT_
public static JPanel label(String label,
Component widget)
label - The label text to usewidget - The widget to label
public static JPanel label(Component widget,
String label)
widget - The widget to labellabel - The label text to use
public static JFrame packWindow(JFrame f,
Component contents)
f - The framecontents - The contents
public static JFrame packWindow(JFrame f,
Component contents,
boolean andShow)
f - The framecontents - The contentsandShow - If true then show the window.
public static JDialog packDialog(JDialog f,
Component contents)
f - The dialogcontents - The contents
public static JFrame makeWindow(String title,
Component contents,
int x,
int y)
title - The window titlecontents - The contentsx - x locationy - y location
public static JMenuBar makeMenuBar(List menus)
menus - List if JMenu-s
public static ObjectListener getCloseDialogListener(JDialog dialog)
dialog - The dialog to close
public static JLabel getImageLabel(String icon,
Class origin)
icon - The image fileorigin - Used to lookup java resources
public static JLabel getImageLabel(String icon)
icon - The image file
public static JButton getImageButton(String icon,
Class origin)
icon - The image fileorigin - Used to lookup java resources
public static JButton getImageButton(String icon,
Class origin,
int hInset,
int vInset)
icon - The image fileorigin - Used to lookup java resourceshInset - Horizontal insetvInset - Vertical inset
public static JButton getScaledImageButton(String icon,
Class origin,
int hInset,
int vInset)
icon - path to icon for the buttonorigin - relative classhInset - horizontal insetvInset - vertical inset
public static JButton getImageButton(ImageIcon icon)
icon - The image icon
public static JButton getImageButton(ImageIcon icon,
int offset)
icon - The image iconoffset - The spacing around the image in the JButton
public static JButton getImageButton(ImageIcon icon,
int hinset,
int vinset)
icon - The image iconhinset - The hor. spacing around the image in the JButtonvinset - The vert. spacing around the image in the JButton
public static JToggleButton getToggleImageButton(String icon,
String selectedIcon,
int hinset,
int vinset,
boolean addMouseOverBorder)
icon - Image for buttonselectedIcon - Image to use when selectedhinset - Hor. insetvinset - Vert. insetaddMouseOverBorder - add a mouseover border
public static JToggleButton getToggleImageButton(ImageIcon icon,
ImageIcon selectedIcon,
int hinset,
int vinset)
icon - Image for buttonselectedIcon - Image to use when selectedhinset - Hor. insetvinset - Vert. inset
public static JToggleButton getToggleImageButton(ImageIcon icon,
ImageIcon selectedIcon,
int hinset,
int vinset,
boolean addMouseOverBorder)
icon - Image for buttonselectedIcon - Image to use when selectedhinset - Hor. insetvinset - Vert. insetaddMouseOverBorder - add a mouseover border
public static void makeMouseOverBorder(JComponent b)
b - the component
public static JToggleButton getToggleButton(String iconPath,
int hinset,
int vinset)
iconPath - path to imagehinset - hor. insetvinset - vert inset
public static JToggleButton getToggleButton(ImageIcon icon,
int hinset,
int vinset)
icon - The icon to usehinset - hor.insetvinset - vert. inset
public static Point getLocation(Component src)
src - Source component
public static void showInCenter(JDialog dialog)
dialog - The dialogpublic static void packInCenter(JDialog dialog)
dialog - The dialog
public static JSplitPane vsplit(Component top,
Component bottom,
int topSpace,
double resizeWeight)
top - Top componentbottom - Bottom componenttopSpace - How much space to give the topresizeWeight - How much weight to give the top when resizing
public static JSplitPane vsplit(Component top,
Component bottom,
int topSpace)
top - Top componentbottom - Bottom componenttopSpace - How much space to give the top
public static JSplitPane vsplit(Component top,
Component bottom,
double resizeWeight)
top - Top componentbottom - Bottom componentresizeWeight - How much weight to give the top when resizing
public static JSplitPane vsplit(Component top,
Component bottom)
top - Top componentbottom - Bottom component
public static JSplitPane hsplit(Component left,
Component right,
int leftSpace,
double resizeWeight)
left - The left componentright - The right componentleftSpace - Where to put the dividerresizeWeight - The resize weight
public static JSplitPane hsplit(Component left,
Component right,
int leftSpace)
left - The left componentright - The right componentleftSpace - Where to put the divider
public static JSplitPane hsplit(Component left,
Component right,
double resizeWeight)
left - The left componentright - The right componentresizeWeight - How much resize weight to use
public static JSplitPane hsplit(Component left,
Component right)
left - The left componentright - The right component
public static JLabel rLabel(String s)
s - The String to use for the label
public static JLabel cLabel(String s)
s - The String to use for the label
public static JLabel lLabel(String s)
s - The String to use for the label
public static JComponent hspace(int w,
int h)
w - The min widthh - The min height
public static String getInput(String question,
String label,
String initValue)
question - The question.label - Extra label.initValue - Initial value of answer
public static String getInput(String question,
String label,
String initValue,
String trailingLabel)
question - The question.label - Extra label.initValue - Initial value of answertrailingLabel - Label after the text field.
public static String getInput(String question,
String label,
String initValue,
String trailingLabel,
Object underLabel)
question - The question.label - Extra label.initValue - Initial value of answertrailingLabel - Label after the text field.underLabel - Label under the text field.
public static String getInput(String question,
String label,
String initValue,
String trailingLabel,
Object underLabel,
String title)
question - The question.label - Extra label.initValue - Initial value of answertrailingLabel - Label after the text field.underLabel - Label under the text field.title - for the dialog box.
public static String getInput(String question,
String label,
String initValue,
String trailingLabel,
Object underLabel,
String title,
int fieldWidth)
question - The question.label - Extra label.initValue - Initial value of answertrailingLabel - Label after the text field.underLabel - Label under the text field.title - for the dialog box.fieldWidth - Field width
public static String getInput(String question,
String label,
String initValue,
String trailingLabel,
Object underLabel,
String title,
int fieldWidth,
JComponent nearComponent)
question - The question.label - Extra label.initValue - Initial value of answertrailingLabel - Label after the text field.underLabel - Label under the text field.title - for the dialog box.fieldWidth - Field widthnearComponent - If non-null then show the dialog near this component
public static String getInput(String question)
question - The question
public static boolean askYesNo(String title,
Object question)
title - The window title.question - The question.
public static boolean askOkCancel(String title,
Object question)
title - The window title.question - The question.
public static void showDialog(String title,
Component comp)
title - The titlecomp - The component to showpublic static void addModalDialogComponent(Component comp)
comp - The component in the model dialogpublic static void removeModalDialogComponent(Component comp)
comp - The component in the model dialog
public static void showDialog(String title,
Component comp,
Component parentComponent)
title - The titlecomp - The component to showparentComponent - The parent component of the dialog.public static void toFrontModalDialogs()
public static void setListData(JComboBox box,
Object[] items)
box - Combobox to fillitems - Items to addpublic static boolean anySelected(JComboBox box)
box - The box to check
public static void setListData(JComboBox box,
List items)
box - Combobox to fillitems - Items to add
public static JComboBox getEditableBox(List items,
Object selected)
items - Items in the boxselected - Selected item
public static int getBoxValue(JComboBox box)
box - The box
public static JComboBox createValueBox(ActionListener listener,
String command,
int initValue,
List values,
boolean editable)
listener - The action listenercommand - Action command for boxinitValue - Initial valuevalues - List of Integerseditable - Is box editable
public static JMenuItem processXmlMenuItem(Node node,
ActionListener listener,
Hashtable menuItems)
throws Exception
node - Xml menu item nodelistener - Action listener to add to the menu itemmenuItems - Mapping from id (from xml) to JMenuItem
Exception
public static JMenuItem processXmlMenuItem(Node node,
ActionListener listener,
Hashtable menuItems,
Hashtable<String,ImageIcon> actionIcons)
throws Exception
node - Xml menu item nodelistener - Action listener to add to the menu itemmenuItems - Mapping from id (from xml) to JMenuItemactionIcons - mapping of string action to imageicon to use in the menu item
Exceptionpublic static int charToKeyCode(String s)
s - The string
public static int charToKeyCode(char ch)
ch - The character
public static JMenu processXmlMenu(Node menuNode,
ActionListener listener,
Hashtable menuItems)
throws Exception
menuNode - The menu xml nodelistener - The action listenermenuItems - Mapping from id to menu items
Exception
public static JMenu processXmlMenu(Node menuNode,
ActionListener listener,
Hashtable menuItems,
Hashtable<String,ImageIcon> actionIcons)
throws Exception
menuNode - The menu xml nodelistener - The action listenermenuItems - Mapping from id to menu itemsactionIcons - mapping of string action to imageicon to use in the menu item
Exception
public static JMenuBar processXmlMenuBar(Element root,
JMenuBar menuBar,
ActionListener listener,
Hashtable menuItems)
root - Xml rootmenuBar - The menu barlistener - The action listenermenuItems - Mapping from id to menu items
public static JMenuBar processXmlMenuBar(Element root,
JMenuBar menuBar,
ActionListener listener,
Hashtable menuItems,
Hashtable<String,ImageIcon> actionIcons)
root - Xml rootmenuBar - The menu barlistener - The action listenermenuItems - Mapping from id to menu itemsactionIcons - mapping of string action to imageicon to use in the menu item
public static List getItems(JComboBox box)
box - The box
public static boolean isShowing(JFrame f)
f - The frame
public static boolean isShowing(JDialog f)
f - The dialog
public static Image getImage(Component component)
throws Exception
component - The component.
Exception
public static Component[] showHtmlDialog(String html,
HyperlinkListener linkListener)
html - The htmllinkListener - The listener
public static Component[] showHtmlDialog(String html,
String title,
HyperlinkListener linkListener)
html - The htmltitle - The title of the windowlinkListener - The listener
public static Component[] getHtmlComponent(String html,
HyperlinkListener linkListener,
int width,
int height)
html - htmllinkListener - Listenerwidth - heightheight - width
public static Component[] showHtmlDialog(String html,
String title,
String label,
HyperlinkListener linkListener,
boolean modal)
html - htmltitle - window titlelabel - labellinkListener - Listenermodal - is window modal
public static Hashtable initializeExpandedPathsBeforeChange(JTree tree,
DefaultMutableTreeNode root)
tree - The jtreeroot - Its tree root
public static void expandPathsAfterChange(JTree tree,
Hashtable state,
DefaultMutableTreeNode root)
tree - The treestate - The state. From initializeExpandedPathsBeforeChangeroot - The tree root
public static GuiUtils.TreeSearchResults doTreeSearch(JTree tree,
Object lastState,
String nodeDesc,
JComponent near)
tree - Tree to searchlastState - For successive searches, this keeps state aroundnodeDesc - A descriptive term for the node for when we tell something to the usernear - If non-null then show the input dialog near this component
public static void limitMenuSize(List items,
String name,
int size)
items - List of JMenuItemsname - The name suffix to usesize - Max size of a menu
public static void limitMenuSize(JMenu menu,
String name,
int size)
menu - The menuname - The name suffix to usesize - Max size of a menu
public static void limitMenuSize(JMenu menu,
String name,
int size,
boolean recurse)
menu - The menuname - The name suffix to usesize - Max size of a menurecurse - If true then limit the size of all sub menus
public static GuiUtils.TreeSearchResults doTreeSearch(JTree tree,
Object lastState,
String nodeDesc,
JComponent near,
String originalPhrase)
tree - the treelastState - last statenodeDesc - the node descriptionnear - the near componentoriginalPhrase - the search phrase
public static String toCsv(TableModel model)
model - The table model to write
public static String toCsv(TableModel model,
boolean includeColumnNames)
model - The table model to writeincludeColumnNames - true to include the column names
public static void exportAsCsv(TableModel model)
model - The table model to write
public static void exportAsCsv(String header,
TableModel model)
header - a header to prepend to the tablemodel - The table model to write
public static void exportAsCsv(String header,
TableModel model,
boolean includeColumnNames)
header - a header to prepend to the tablemodel - The table model to writeincludeColumnNames - true to include the column names
public static void exportAsCsv(String header,
TableModel model,
String filename)
header - header for the outputmodel - table modelfilename - file name to export to
public static void exportAsCsv(String header,
TableModel model,
String filename,
boolean includeColumnNames)
header - header for the outputmodel - table modelfilename - file name to export toincludeColumnNames - true to include the column names
public static void setupDirectoryChooser(JButton btn,
JTextField directoryFld)
btn - button for choosing directorydirectoryFld - directory field
public static void setupFileChooser(JButton btn,
JTextField directoryFld,
boolean justDirectories)
btn - button for choosing directorydirectoryFld - directory fieldjustDirectories - flag for just looking at directories
public static JCheckBox makeCheckbox(String label,
Object object,
String property)
label - Labelobject - Object to callproperty - Name of property to get/set value
public static JCheckBox makeCheckbox(String label,
Object object,
String property,
Object arg)
label - Labelobject - Object to callproperty - Name of property to get/set valuearg - Optional arg to pass to method
public static JRadioButton[] makeRadioButtons(List labels,
int selectedIndex,
Object object,
String methodName)
labels - labelsselectedIndex - which one is onobject - Object to callmethodName - The method
public static JButton makeButton(String label,
Object object,
String methodName)
label - Labelobject - Object to callmethodName - Method name to call
public static JButton makeButton(String label,
Object object,
String methodName,
Object arg)
label - Labelobject - Object to callmethodName - Method name to callarg - Pass this to method name if non-null.
public static JButton makeButton(String label,
Object object,
String methodName,
Object arg,
String tooltip)
label - Labelobject - Object to callmethodName - Method name to callarg - Pass this to method name if non-null.tooltip - if non-null then set the tooltip on the button
public static ActionListener makeActionListener(Object object,
String methodName,
Object arg)
object - Object to callmethodName - Method name to callarg - Pass this to method name if non-null.
public static void invokeInSwingThread(Runnable runnable)
runnable - runnable to run
public static JButton makeImageButton(String label,
Object object,
String methodName)
label - Labelobject - Object to callmethodName - Method name to call
public static JButton makeImageButton(String label,
Object object,
String methodName,
Object arg)
label - Labelobject - Object to callmethodName - Method name to callarg - Pass this to method name if non-null.
public static JButton makeImageButton(String label,
Object object,
String methodName,
Object arg,
boolean addMouseOverBorder)
label - Labelobject - Object to callmethodName - Method name to callarg - Pass this to method name if non-null.addMouseOverBorder - add a mouse-over border
public static JComponent addActionListener(JComponent comp,
Object object,
String methodName,
Object arg)
comp - The componentobject - Object to callmethodName - Method name to callarg - Pass this to method name if non-null.
public static JMenu makeDynamicMenu(String name,
Object object,
String methodName)
name - Menu nameobject - Object to callmethodName - method to invoke
public static JMenu makeDynamicMenu(String name,
Object object,
String methodName,
boolean doRemoveAll)
name - Menu nameobject - Object to callmethodName - method to invokedoRemoveAll - true to remove all first
public static JComboBox makeComboBox(List items,
Object selected,
boolean editable,
Object listener,
String methodName)
items - items for the boxselected - the selected itemeditable - flag for whether this is editable or notlistener - Listener for changesmethodName - method to call when item changes
public static JComboBox makeComboBox(List items,
Object selected,
boolean editable,
Object listener,
String methodName,
boolean inAThread)
items - items for the boxselected - the selected itemeditable - flag for whether this is editable or notlistener - Listener for changesmethodName - method to call when item changesinAThread - Call the method in a thread
public static JComboBox makeComboBox(int[] values,
String[] labels,
int current)
values - integer valueslabels - labels for valuescurrent - current one to select
public static void setValueOfBox(JComboBox box,
int value,
int[] values,
String[] labels)
box - the box to setvalue - the default valuevalues - the valueslabels - labels for the valuespublic static int getValueFromBox(JComboBox box)
box - the box to use
public static JSlider makeSlider(int min,
int max,
int value,
Object listener,
String methodName)
min - minimum valuemax - maximum valuevalue - initial valuelistener - listener for changesmethodName - method to call when change occurs
public static JSlider makeSlider(int min,
int max,
int value,
Object listener,
String methodName,
boolean updateAsMove)
min - minimum valuemax - maximum valuevalue - initial valuelistener - listener for changesmethodName - method to call when change occursupdateAsMove - If true we call the listener as the slider moves.
public static Vector getFontSizeList()
public static Vector getFontList()
public static TwoFacedObject makeTwoFacedFont(Font f)
f - Font to use
public static void makeRowVisible(JTable table,
int row)
table - The tablerow - The rowpublic static void scrollToTop(JEditorPane editor)
editor - editor to scroll
public static void addMouseListenerRecurse(MouseListener listener,
Container c)
listener - the mouse listenerc - the container
public static void addKeyListenerRecurse(KeyListener listener,
Container c)
listener - the key listenerc - the container
public static double distance(double x1,
double y1,
double x2,
double y2)
x1 - x1y1 - y1x2 - x2y2 - y2
public static double distance(double[] p1,
double[] p2)
p1 - Fromp2 - To
public static double distance(int[] p1,
int[] p2)
p1 - Fromp2 - To
public static double distance(double x,
double y,
Rectangle2D r)
x - xy - yr - rect
public static JLabel makeVerticalLabel(String text)
text - text
public static JComponent doMultiSplitPane(List comps,
boolean hsplit)
comps - List of componentshsplit - horizontal or vertical
public static JTabbedPane getNestedTabbedPane()
public static JTabbedPane getNestedTabbedPane(int orient)
orient - tab orientation
public static JTabbedPane getNestedTabbedPane(int orient,
int top,
int left,
int bottom,
int right)
orient - tab orientationtop - top borderleft - left borderbottom - bottom borderright - right border
public static JComponent[] makeSliderPopup(int min,
int max,
int value,
ChangeListener listener)
min - slider min valuemax - slider max valuevalue - slider valuelistener - slider change listener
public static void positionAndFitToScreen(Window window,
Rectangle bounds)
window - window to fitbounds - new bounds
public static void toggleHeavyWeightComponents(Component comp,
boolean visible)
comp - Componentvisible - On/offpublic static void checkHeavyWeightComponents(JTabbedPane tab)
tab - tabpublic static void resetHeavyWeightComponents(JTabbedPane tab)
tab - tabpublic static void handleHeavyWeightComponentsInTabs(JTabbedPane tab)
tab - tab
public static void main(String[] args)
throws Exception
args - args
Exception - on badnesspublic static JButton makeFileBrowseButton(JTextComponent fld)
fld - Field to set
public static JButton makeFileBrowseButton(JTextComponent fld,
List filters)
fld - Field to setfilters - File filters. May be null.
public static JButton makeFileBrowseButton(JTextComponent fld,
boolean chooseDirectory,
List filters)
fld - Field to setchooseDirectory - Select a directoryfilters - File filters. May be null.
public static JComboBox doMakeFontBox(Font f)
f - Font to select in the box
public static JComboBox doMakeFontSizeBox(int size)
size - Selected size
public static Component italicizeFont(Component comp)
comp - The component
public static void popupUnitMenu(JTextField fld,
JComponent comp)
fld - The fld to setcomp - THe component to popup the menu nearpublic static boolean getIconsInMenus()
public static void setIconsInMenus(boolean doIcons)
doIcons - show icons
public static AbstractButton setIcon(AbstractButton button,
String iconPath)
button - The buttoniconPath - The icon path
public static void setSelectedItems(JList list,
List selected)
list - _more_selected - _more_public static List getItems(JList list)
list - _more_
public static String getLocalName(String n,
boolean local)
n - _more_local - _more_
public static String getLocalName(String n,
boolean local,
boolean addHtml)
n - _more_local - _more_addHtml - _more_
public static void appendText(JTextComponent fld,
String s,
String delimiter)
fld - _more_s - _more_delimiter - _more_public static void addKeyBindings(JTextComponent comp)
comp - _more_public static void moveSubtreesToTop(DefaultMutableTreeNode parent)
parent - _more_public static JComponent makeHeader(String label)
label - Header label
public static String getAttribute(Node element,
String name,
String dflt)
element - The xml element to look within.name - The attribute name.dflt - The default value.
public static String getAttribute(NamedNodeMap attrs,
String name,
String dflt)
attrs - _more_name - _more_dflt - _more_
public static boolean getAttribute(NamedNodeMap attrs,
String name,
boolean dflt)
attrs - _more_name - _more_dflt - _more_
public static String getAttribute(NamedNodeMap attrs,
String name)
attrs - _more_name - _more_
public static List findChildren(Node parent,
String tag)
parent - _more_tag - _more_
public static int getInt(JTextField fld)
fld - text field
public static double getValue(JTextField fld)
fld - text field
public static void setApplicationTitle(String title)
title - _more_public static String getApplicationTitle()
public static boolean doMacMenubar()
public static boolean isControlKey(InputEvent event)
event - _more_
public static boolean isControlKey(KeyEvent event,
int keyCode)
public static boolean isMac()
public static boolean isDeleteEvent(KeyEvent e)
e - _more_
public static void decorateFrame(JFrame frame,
JMenuBar menuBar)
frame - _more_menuBar - _more_
public static void showUrl(String s)
throws Exception
s - _more_
Exception - _more_public static void addLinkListener(JEditorPane editor)
editor - _more_
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||