Package ucar.unidata.util
Class GuiUtils
java.lang.Object
ucar.unidata.util.MenuUtil
ucar.unidata.util.LayoutUtil
ucar.unidata.util.GuiUtils
This is a vast catchall class to old various
 utilities for doing GUI things.
- Author:
- IDV development team
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classClass CardLayoutPanel is a utility that does a card layou of its components.static classA color swatch panelstatic classstatic classClass ProgressDialog _more_static classClass TreeSearchResults Holds state from a tree searchstatic classClass for a vertical label
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Stringxml attribute namestatic final Stringxml attribute namestatic final Stringxml attribute namestatic final Stringxml attribute namestatic FontUsed by apps for having a common font for buttonsstatic StringAction command used for the Apply buttonstatic StringAction command used for the Cancel buttonstatic StringAction command used for the Close buttonstatic StringAction command used for the Export buttonstatic StringAction command used for the Help buttonstatic StringAction command used for the Import buttonstatic StringAction command used for the New buttonstatic StringAction command used for the No buttonstatic StringAction command used for the OK buttonstatic StringAction command used for the Open buttonstatic StringAction command used for the Remove buttonstatic StringAction command used for the Rename buttonstatic StringAction command used for the Reset buttonstatic StringAction command used for the Save buttonstatic StringAction command used for the Saveas buttonstatic StringAction command used for the Start buttonstatic StringAction command used for the Stop buttonstatic StringAction command used for the Submit buttonstatic StringAction command used for the Update buttonstatic StringAction command used for the Yes buttonstatic final String[]Used to map named colors to colorstatic final Color[]Used to map named colors to colorstatic final int[]font sizesstatic final Stringhex color string without leading #static Stringmissing image pathstatic final CursorThe normal cursor_static final TimeZone_more_static final CursorThe cursor to use when waitingFields inherited from class ucar.unidata.util.LayoutUtilINSETS_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_INSETSFields inherited from class ucar.unidata.util.MenuUtilMENU_SEPARATOR
- 
Method SummaryModifier and TypeMethodDescriptionstatic JComponentaddActionListener(JComponent comp, Object object, String methodName, Object arg) Adds an action listener to the button.static voidaddKeyBindings(JTextComponent comp) _more_static voidaddKeyListenerRecurse(KeyListener listener, Container c) Add a key listener to all components of a containerstatic voidaddLinkListener(JEditorPane editor) _more_static voidAdd the model dialog to the liststatic voidaddMouseListenerRecurse(MouseListener listener, Container c) Add a mouse listener to all components of a containerstatic booleananySelected(JComboBox box) Check if there are any selected items in the combobox.static voidappendText(JTextComponent fld, String s, String delimiter) _more_static voidapplyDefaultFont(Component comp) _more_static booleanaskOkCancel(String title, Object question) Ask the user the question.static booleanAsk the user the question.static ButtonGroupbuttonGroup(JToggleButton b1, JToggleButton b2) Create a button group and add the two buttons to it.static ButtonGroupbuttonGroup(JToggleButton b1, JToggleButton b2, JToggleButton b3) Create a button group and add the three buttons to it.static ButtonGroupbuttonGroup(JToggleButton b1, JToggleButton b2, JToggleButton b3, JToggleButton b4) Create a button group and add the three buttons to it.static intcharToKeyCode(char ch) Return the numeric key code of the given character.static intTake the first character of the string and return the numeric key codestatic voidWalk the components of the tab and toggle the heavyweight components visiblitystatic booleancheckHeight(int height) Check the height against a valuestatic JLabelCreate a center aligned JLabelstatic voidconfigureStepSelection(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 JDialogcreateDialog(Window parent, String title, boolean modal) Utility to create a JDialog with a parent component.static JDialogcreateDialog(String title, boolean modal) A utility to create a dialog.static JFramecreateFrame(String title) A utility to create a frame.static JComboBoxcreateValueBox(ActionListener listener, String command, int initValue, List values, boolean editable) Create a combobx boxc that holds a set of integer values.static ColordecodeColor(String value, Color dflt) This takes the given String and tries to convert it to a color.static voiddecorateFrame(JFrame frame, JMenuBar menuBar) _more_static doubledistance(double[] p1, double[] p2) Get distance betweenstatic doubledistance(double x1, double y1, double x2, double y2) Calculate distance between 2 points.static doubledistance(double x, double y, Rectangle2D r) Calculate distance between point and rectangle.static doubledistance(int[] p1, int[] p2) Get distance betweenstatic boolean_more_static JComboBoxMake a font selector boxstatic JComboBoxdoMakeFontSizeBox(int size) Make a box for setting the font sizestatic JComponentdoMultiSplitPane(List comps, boolean hsplit) Make an evenly balanced group of split panes for the given componentsstatic GuiUtils.TreeSearchResultsdoTreeSearch(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.TreeSearchResultsdoTreeSearch(JTree tree, Object lastState, String nodeDesc, JComponent near, String originalPhrase) Search the given treestatic voidIf non-null then removes all children and removes from parent.static voidIf non-null then removes all children and removes from parent.static voidenableComponents(List comps, boolean enable) Enable or disable the list of Componentsstatic voidenablePanel(JPanel panel, boolean enable) _more_static voidenableTree(Component comp, boolean enable) Enable or disable a whole tree's worth of componentsstatic voidexpandPathsAfterChange(JTree tree, Hashtable state, DefaultMutableTreeNode root) Call this after the structure of a JTree changes to re-expand the paths.static voidexportAsCsv(String header, TableModel model) Write out the given table model as a comma separated value (CSV) file prepending the header.static voidexportAsCsv(String header, TableModel model, boolean includeColumnNames) Write out the given table model as a comma separated value (CSV) file prepending the header.static voidexportAsCsv(String header, TableModel model, String filename) Export a table as csvstatic voidexportAsCsv(String header, TableModel model, String filename, boolean includeColumnNames) Export a table as csvstatic voidexportAsCsv(TableModel model) Write out the given table model as a csv filestatic ListfindChildren(Node parent, String tag) _more_static JPanelCreate a panel and do flow layout of the componentsstatic JPanelCreate a panel and do a a right align flow layout of the componentsstatic StringformatDate(Date dttm) Format the date with the default date format and timezonestatic JComponentformLayout(Component[] comps) Do a 2 column layout.static JComponentformLayout(Component[] comps, double[] widths, double[] heights) Do a 2 column layout.static JComponentformLayout(Object[] objects) This does a doLayout with 2 columns.static JComponentformLayout(Object[] objects, Insets insets) This does a doLayout with 2 columns.static JComponentformLayout(List objects) Layout as a 2 column formstatic JComponentformLayout(List comps, boolean rightAlignFirstColumn) Do a 2 column layout.static JComponentformLayout(List comps, double[] widths, double[] heights) Do a 2 column layout.static JComponentformLayout(List comps, double[] widths, double[] heights, boolean rightAlignFirstColumn) Do a 2 column layout.static JComponentformLayout(List objects, Insets insets) Do a 2 column layout of the objects with the given insets for spacingstatic String_more_static StringgetAttribute(NamedNodeMap attrs, String name) _more_static booleangetAttribute(NamedNodeMap attrs, String name, boolean dflt) _more_static StringgetAttribute(NamedNodeMap attrs, String name, String dflt) _more_static StringgetAttribute(Node element, String name, String dflt) Get the given name-d attribute from the given element.static intgetBoxValue(JComboBox box) Return the selected item in the given box as an integer.static ObjectListenergetCloseDialogListener(JDialog dialog) Create a listener that will close the given dialog.static StringgetColorName(Color color) Return the name of the given color.static voidgetConfigureStepSelectionItems(JList list, List items) popup a menu to select stridesstatic FontGet the default fontstatic intGet the default icon sizestatic JComboBoxgetEditableBox(List items, Object selected) Create an editable combobox with the given items.static JLabelCreate a JLabel with a fixed width fontstatic VectorGet a list of fontsstatic VectorGet a list of font sizesstatic JFrameThis 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 htmlstatic booleanDo we show icons in the menusstatic ImageGet the screen image from the componentstatic ImageCreate an Image from the given image file name.static ImageCreate an Image from the given image file name.static ImageCreate an Image from the given image file name.static ImageGet an imagestatic JButtongetImageButton(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 JButtongetImageButton(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 JButtongetImageButton(ImageIcon icon) Create a JButton that displays the given image iconstatic JButtongetImageButton(ImageIcon icon, int offset) Create a JButton that displays the given image iconstatic JButtongetImageButton(ImageIcon icon, int hinset, int vinset) Create a JButton that displays the given image iconstatic ImageIcongetImageIcon(String file) Create an ImageIcon from the given image file name.static ImageIcongetImageIcon(String file, boolean cache) Create an ImageIcon from the given image file name.static ImageIcongetImageIcon(String file, Class c) Create an ImageIcon from the given image file name.static ImageIcongetImageIcon(String file, Class c, boolean cache) Create an ImageIcon from the given image file name.static JLabelgetImageLabel(String icon) Create a JLabel that displays an image icon create from the given icon path (may be a file, resource or url).static JLabelgetImageLabel(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 StringAsk the user the question.static StringAsk the user the question.static StringAsk the user the question.static StringAsk the user the question.static StringgetInput(String question, String label, String initValue, String trailingLabel, Object underLabel, String title) Ask the user the question.static StringgetInput(String question, String label, String initValue, String trailingLabel, Object underLabel, String title, int fieldWidth) Ask the user the question.static StringgetInput(String question, String label, String initValue, String trailingLabel, Object underLabel, String title, int fieldWidth, JComponent nearComponent) Ask the user the question.static intgetInt(JTextField fld) Get an integer value from the text fieldstatic Listreturn the list of items held by the combo box.static List_more_static StringgetLocalName(String n, boolean local) _more_static StringgetLocalName(String n, boolean local, boolean addHtml) _more_static PointgetLocation(Component src) Find the location of the given componet on the screen.static JTabbedPaneMake a JTabbedPane without some of its borderstatic JTabbedPanegetNestedTabbedPane(int orient) Make a JTabbedPane without some of its borderstatic JTabbedPanegetNestedTabbedPane(int orient, int top, int left, int bottom, int right) Make a JTabbedPane without some of its borderstatic JButtongetScaledImageButton(String icon, Class origin, int hInset, int vInset) Get a scaled image buttonstatic ImageIcongetScaledImageIcon(String file, Class c, boolean cache) Get a scaled image iconstatic doubleReturn the slider value as a percentage between its min and maxstatic TimeZoneGet the default timezone used for formattingstatic JToggleButtongetToggleButton(String iconPath, int hinset, int vinset) Create a toggle button with the given image.static JToggleButtongetToggleButton(ImageIcon icon, int hinset, int vinset) Create a toggle button with the given image.static JToggleButtongetToggleImageButton(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 JToggleButtongetToggleImageButton(ImageIcon icon, ImageIcon selectedIcon, int hinset, int vinset) Create a JToggleButton with the given image and, if non-null, the given selected image.static JToggleButtongetToggleImageButton(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 doublegetValue(JTextField fld) Get an double value from the text fieldstatic intgetValueFromBox(JComboBox box) Get the integer value from a JComboBox of integer itemsstatic WindowThis finds and returns the Window, or null if not found, that contains the given component.static voidAdd 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 JComponenthspace(int w, int h) Create a a minimally sized spacerstatic JSplitPaneCreate a basic horizontally aligned JSplitPanestatic JSplitPaneCreate a horizontally aligned JSplitPanestatic JSplitPaneCreate a horizontally aligned JSplitPanestatic JSplitPaneCreate a horizontally aligned JSplitPane.static HashtableCall this before a JTree changes.static voidInit the fixed labelsstatic voidinsertText(JTextComponent comp, String s) Insert text into the componentstatic voidinvokeInSwingThread(Runnable runnable) RUn the given runnable in the swing event dispatch threadstatic booleanisControlKey(InputEvent event) Is the given event a control (or meta for the mac) keystatic booleanisControlKey(KeyEvent event, int keyCode) _more_static boolean_more_static booleanisMac()Is this running on a Mac?static booleanIs the dialog showingstatic booleanIs the frame showingstatic ComponentitalicizeFont(Component comp) Italicize the font on the given componentstatic JPanelCreate a JPanel that holds a the given widget/JLabelstatic JPanelCreate a JPanel that holds a JLabel/the given widgetstatic voidlimitMenuSize(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 voidlimitMenuSize(JMenu menu, String name, int size) This ensures that there are no more than size number of items in any sub menu.static voidlimitMenuSize(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 JLabelCreate a left aligned JLabelstatic voidteststatic ActionListenermakeActionListener(Object object, String methodName, Object arg) Make an ActionListener.static JButtonUtility to make apply button panelstatic JPanelUtility to make apply/cancel button panelstatic JPanelUtility to make apply/ok/cancel button panelstatic JPanelUtility to make apply/ok/help/cancel button panelstatic JPanelUtility to make apply/ok/reset/cancel button panelstatic JButtonmakeButton(String label, Object object, String methodName) Make a JButton.static JButtonmakeButton(String label, Object object, String methodName, Object arg) Make a JButton.static JButtonMake a JButton.static JPanelmakeButtons(ActionListener l, String[] cmds) Make a set of JButtons, each with a label and action command from the given cmds array.static JPanelmakeButtons(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 JPanelmakeButtons(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 JPanelmakeButtons(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 JPanelmakeButtons(ActionListener l, String[] cmds, Hashtable buttonMap) Make a set of JButtons, each with a label and action command from the given cmds array.static JCheckBoxmakeCheckbox(String label, Object object, String property) Make a checkbox.static JCheckBoxmakeCheckbox(String label, Object object, String property, Object arg) Make a checkbox.static JComboBoxmakeColorNameComboBox(Color dflt) A helper to make a color selector combo boxstatic JComponent[]makeColorSwatchWidget(Color color, String label) This makes a color swatch and a 'Set' button that is used to set the color.static JComboBoxmakeComboBox(int[] values, String[] labels, int current) Make a combo box from a set of values and labelsstatic JComboBoxmakeComboBox(List items, Object selected, boolean editable, Object listener, String methodName) Make a JComboBoxstatic JComboBoxmakeComboBox(List items, Object selected, boolean editable, Object listener, String methodName, boolean inAThread) Make a JComboBoxstatic intMake and show a modeful dialog with the given collection of buttons.static JMenumakeDynamicMenu(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 JMenumakeDynamicMenu(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 JButtonMake a button that pops up a file browser and sets the text of the given field with the selected filestatic JButtonmakeFileBrowseButton(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 filestatic JButtonmakeFileBrowseButton(JTextComponent fld, List filters) Make a button that pops up a file browser and sets the text of the given field with the selected filestatic JComponentmakeHeader(String label) Utility to create a header that is a label and a line.static JButtonmakeImageButton(String label, Object object, String methodName) Make a JButton.static JButtonmakeImageButton(String label, Object object, String methodName, Object arg) Make a JButton.static JButtonmakeImageButton(String label, Object object, String methodName, Object arg, boolean addMouseOverBorder) Make a JButton.static JButtonmakeJButton(String label, ActionListener listener) Utility to make a JButton, adding the given listener as an ActionListenerstatic JButtonmakeJButton(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 JMenuBarmakeMenuBar(List menus) Create a JMenuBar and add the menus contained with the menus list If no menus then return null.static voidMake a mouse over borderstatic JPanelUtility to make new/ok/cancel button panelstatic JPanelmakeNewOkCancelButtons(ActionListener l, String newLabel, String okLabel, String cancelLabel) Utility to make new/ok/cancel button panelstatic JPanelUtility to make new/ok/cancel/help button panelstatic JPanelUtility to make ok/cancel button panelstatic JPanelmakeOkCancelButtons(ActionListener l, String okLabel, String cancelLabel) Utility to make ok/cancel button panelstatic JPanelUtility to make ok/help/cancel button panelstatic JRadioButton[]makeRadioButtons(List labels, int selectedIndex, Object object, String methodName) Make a set of radio buttonsstatic voidmakeRowVisible(JTable table, int row) Make the given row in the table visiblestatic JScrollPanemakeScrollPane(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 JSlidermakeSlider(int min, int max, int value, Object listener, String methodName) Make a JSliderstatic JSlidermakeSlider(int min, int max, int value, Object listener, String methodName, boolean updateAsMove) Make a JSliderstatic JComponent[]makeSliderPopup(int min, int max, int value, ChangeListener listener) This creates a JButton and a JSlider.static TwoFacedObjectMake a TwoFacedObject from a font for displaying in a combobox.static JLabelmakeVerticalLabel(String text) Make a vertical labelstatic JFramemakeWindow(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_more_static JDialogpackDialog(JDialog f, Component contents) Add the given contents into the given dialogstatic voidpackInCenter(JDialog dialog) pack the dialog in the center of the screenstatic JFramepackWindow(JFrame f, Component contents) Add the given contents into the given framestatic JFramepackWindow(JFrame f, Component contents, boolean andShow) Add the given contents into the given framestatic Component[]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 voidpopupUnitMenu(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 fldstatic voidpositionAndFitToScreen(Window window, Rectangle bounds) Position and fit a window to the screenstatic JMenuprocessXmlMenu(Node menuNode, ActionListener listener, Hashtable menuItems) Create the JMenu from the given xml.static JMenuprocessXmlMenu(Node menuNode, ActionListener listener, Hashtable menuItems, Hashtable<String, ImageIcon> actionIcons) Create the JMenu from the given xml.static JMenuBarprocessXmlMenuBar(Element root, JMenuBar menuBar, ActionListener listener, Hashtable menuItems) Create, if null, and ddd to the JMenuBar from the xmlstatic JMenuBarprocessXmlMenuBar(Element root, JMenuBar menuBar, ActionListener listener, Hashtable menuItems, Hashtable<String, ImageIcon> actionIcons) Create, if null, and ddd to the JMenuBar from the xmlstatic JMenuItemprocessXmlMenuItem(Node node, ActionListener listener, Hashtable menuItems) Create the JMenuItem defined by the given xmlstatic JMenuItemprocessXmlMenuItem(Node node, ActionListener listener, Hashtable menuItems, Hashtable<String, ImageIcon> actionIcons) Create the JMenuItem defined by the given xmlstatic voidRemove the model dialog from the liststatic voidWalk the components of the tab and toggle the heavyweight components visiblitystatic JLabelCreate a right aligned JLabelstatic ImageIconscaleImageIcon(ImageIcon icon) This scales the image icon up to the minimum icon size if it is definedstatic voidscrollToTop(JEditorPane editor) Scroll the given component to the topstatic voidsetApplicationTitle(String title) _more_static voidsetBackgroundOnTree(Container c, Color bgColor) Recurse the Component hierarchy, setting the background color of each component.static voidThis 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 voidSet the default date formatstatic voidsetDefaultFont(Font font) Set the default fontstatic voidsetDefaultIconSize(int size) Set the default icon sizestatic voidsetFixedWidthFont(Component comp) Set the font on the component to be monospacedstatic voidsetFontOnTree(JComponent c, Font f) Recurse the Component hierarchy, setting the font.static voidsetForegroundOnTree(Component comp, Color fgColor) Recurse the Component hierarchy, setting the foreground color of each component.static voidsetForegroundOnTree(Component comp, Color fgColor, Color ifEquals) Recurse the Component hierarchy, setting the foreground color of each component.static AbstractButtonsetIcon(AbstractButton button, String iconPath) Set the icon on the button.static voidsetIconsInMenus(boolean doIcons) Do we show icons in the menusstatic voidsetListData(JComboBox box, Object[] items) Procedure to set the list of items in a ComboBoxstatic voidsetListData(JComboBox box, List items) Procedure to set the list of items in a ComboBoxstatic voidsetPreferredWidth(JComponent comp, int width) Set the preferred width on a componentstatic voidsetSelectedItems(JList list, List selected) _more_static JComponentsetSize(JComponent comp, int w, int h) Set the size and preferred size of the component and return itstatic voidsetSliderPercent(JSlider s, double percent) Set the slider value as a percentage between its min and maxstatic voidsetTimeZone(TimeZone tz) Set the default timezone used for formattingstatic voidsetToolTipOnTree(Container c, String tooltip) Recurse the Component hierarchy, setting the tooltip of each component.static voidsetupDirectoryChooser(JButton btn, JTextField directoryFld) Set up a directory chooserstatic voidsetupFileChooser(JButton btn, JTextField directoryFld, boolean justDirectories) Set up a directory chooserstatic voidsetValueOfBox(JComboBox box, int value, int[] values, String[] labels) Set the value of the boxstatic voidshowComponentInTabs(Component comp) Show the component in any contained tabsstatic voidshowComponentInTabs(Component comp, boolean andShowWindow) Show the component in any containing tabsstatic voidshowDialog(String title, Component comp) Show the given component in a dialog.static voidshowDialog(String title, Component comp, Component parentComponent) Show the given component in a dialog.static voidshowDialogNearSrc(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 voidshowFrameAsDialog(Component parentComponent, JFrame frame) popup but a modal dialog with input Jframestatic Component[]showHtmlDialog(String html, String title, String label, HyperlinkListener linkListener, boolean modal) Show a dialog window that contains an html editorstatic Component[]showHtmlDialog(String html, String title, HyperlinkListener linkListener) Show the given html in a window with the given title.static Component[]showHtmlDialog(String html, HyperlinkListener linkListener) Show the given html in a window.static voidshowInCenter(JDialog dialog) pack and show the dialog in the center of the screenstatic voidShow the list interval selection dialogstatic booleanshowOkCancelDialog(Window f, String title, Component contents, Component src) Show a modeful Ok/Cancel dialog.static booleanshowOkCancelDialog(Window f, String title, Component contents, Component src, List actionComponents) Show a modeful Ok/Cancel dialog.static booleanshowOkCancelDialog(Window f, String title, Component contents, Component src, List actionComponents, String okLabel) Show a modeful Ok/Cancel dialog.static booleanshowOkCancelDialog(Window f, String title, Component contents, Component src, List actionComponents, String okLabel, boolean resizable, Dimension dialogPrefSize) Show a modal Ok/Cancel dialog.static voidshowOkDialog(Window f, String title, Component contents, Component src) Show OK dialogstatic void_more_static voidThis will show and/or deiconify the given component.static intshowYesNoCancelDialog(Window frame, String message, String title) Show a modeful dialog, attached to the given frame, with the given message.static intshowYesNoCancelDialog(Window frame, String message, String title, String defaultCmd) Show a modeful dialog, attached to the given frame, with the given message.static booleanshowYesNoDialog(Window frame, String title, Component contents, Component src) Show a modeful dialog, attached to the given frame, with the given message.static booleanshowYesNoDialog(Window frame, String message, String title) Show a modeful dialog, attached to the given frame, with the given message.static booleanShow a modeful dialog, attached to the given frame, with the given message.static StringtoCsv(TableModel model) Convert the given table model to comma separated stringstatic StringtoCsv(TableModel model, boolean includeColumnNames) Convert the given table model to comma separated stringstatic voidMove the window to the frontstatic voidMove to the front any modal dialogsstatic voidtoggleHeavyWeightComponents(Component comp, boolean visible) Walk the tree and set any heavyweight components visibility.static JComponentThis makes a component that contains a jlabel.static JSplitPaneCreate a JSplitPane in vertical mode.static JSplitPaneCreate a JSplitPane in vertical mode.static JSplitPaneCreate a JSplitPane in vertical mode.static JSplitPaneCreate a JSplitPane in vertical mode.Methods inherited from class ucar.unidata.util.LayoutUtilbottom, 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, vbox, vgrid, vgrid, wrap, wrapLeftMethods inherited from class ucar.unidata.util.MenuUtilfindMethod, makeCheckboxMenuItem, makeCheckboxMenuItem, makeMenu, makeMenu, makeMenuItem, makeMenuItem, makeMenuItem, makeMenuItems, makePopupMenu, makePopupMenu, showPopupMenu, typesMatch
- 
Field Details- 
MISSING_IMAGEmissing image path
- 
ATTR_ACTIONxml attribute name- See Also:
 
- 
ATTR_TOOLTIPxml attribute name- See Also:
 
- 
ATTR_ICONxml attribute name- See Also:
 
- 
ATTR_IDxml attribute name- See Also:
 
- 
waitCursorThe cursor to use when waiting
- 
normalCursorThe normal cursor_
- 
FONT_SIZESpublic static final int[] FONT_SIZESfont sizes
- 
COLORNAMESUsed to map named colors to color
- 
COLORSUsed to map named colors to color
- 
HEX_COLOR_PATTERNhex color string without leading #- See Also:
 
- 
CMD_APPLYAction command used for the Apply button
- 
CMD_CANCELAction command used for the Cancel button
- 
CMD_CLOSEAction command used for the Close button
- 
CMD_IMPORTAction command used for the Import button
- 
CMD_EXPORTAction command used for the Export button
- 
CMD_SUBMITAction command used for the Submit button
- 
CMD_RENAMEAction command used for the Rename button
- 
CMD_REMOVEAction command used for the Remove button
- 
CMD_NEWAction command used for the New button
- 
CMD_YESAction command used for the Yes button
- 
CMD_NOAction command used for the No button
- 
CMD_OKAction command used for the OK button
- 
CMD_OPENAction command used for the Open button
- 
CMD_RESETAction command used for the Reset button
- 
CMD_HELPAction command used for the Help button
- 
CMD_SAVEAction command used for the Save button
- 
CMD_SAVEASAction command used for the Saveas button
- 
CMD_UPDATEAction command used for the Update button
- 
CMD_STARTAction command used for the Start button
- 
CMD_STOPAction command used for the Stop button
- 
buttonFontUsed by apps for having a common font for buttons
- 
TIMEZONE_UTC_more_
 
- 
- 
Method Details- 
initLabelspublic static void initLabels()Init the fixed labels
- 
setTimeZoneSet the default timezone used for formatting- Parameters:
- tz- timezone
 
- 
getTimeZoneGet the default timezone used for formatting- Returns:
- timezone
 
- 
setDefaultDateFormatSet the default date format- Parameters:
- fmt- date format string
 
- 
formatDateFormat the date with the default date format and timezone- Parameters:
- dttm- date
- Returns:
- formatted date
 
- 
setDefaultIconSizepublic static void setDefaultIconSize(int size) Set the default icon size- Parameters:
- size- new size
 
- 
getDefaultIconSizepublic static int getDefaultIconSize()Get the default icon size- Returns:
- the default icon size
 
- 
setDefaultFontSet the default font- Parameters:
- font- the default font
 
- 
getDefaultFontGet the default font- Returns:
- the default font
 
- 
applyDefaultFont_more_- Parameters:
- comp- _more_
 
- 
getFixedWidthLabelCreate a JLabel with a fixed width font- Parameters:
- s- Initial label string
- Returns:
- label
 
- 
setFixedWidthFontSet the font on the component to be monospaced- Parameters:
- comp- The component
 
- 
setCursorThis finds the Window the given component c is in and, if it is found, sets the cursor of the Window to the given cursor.- Parameters:
- component- The component to look for the window from
- cursor- The cursor
 
- 
getFrameThis finds and returns the JFrame, or null if not found, that holds the given component.- Parameters:
- component- The component to look for the frame
- Returns:
- The JFrame
 
- 
showComponentInTabsShow the component in any contained tabs- Parameters:
- comp- The component to look for the window from
 
- 
showComponentInTabsShow the component in any containing tabs- Parameters:
- comp- Component to show
- andShowWindow- If we get to a window do we also show it
 
- 
toFrontMove the window to the front- Parameters:
- window- the window
 
- 
getWindowThis finds and returns the Window, or null if not found, that contains the given component.- Parameters:
- component- The component to look for the window from
- Returns:
- The window the component is on or null if not found
 
- 
emptyIf non-null then removes all children and removes from parent.- Parameters:
- c- The component to empty
 
- 
emptyIf non-null then removes all children and removes from parent.- Parameters:
- c- The component to empty
- doItInSwingThread- If true then do the emptying in the Swing thread
 
- 
decodeColorThis takes the given String and tries to convert it to a color. The string may be a space or comma separated triple of RGB integer values. It may be an integer or it may be a color name defined in the COLORNAMES array- Parameters:
- value- String value
- dflt- This is returned if the value cannot be converted
- Returns:
- Color defined by the String value or the dflt
 
- 
getColorNameReturn the name of the given color.- Parameters:
- color- The color
- Returns:
- name of the color
 
- 
checkHeightpublic static boolean checkHeight(int height) Check the height against a value- Parameters:
- height- the value to check
- Returns:
- return height > 100;
 
- 
setPreferredWidthSet the preferred width on a component- Parameters:
- comp- component
- width- width
 
- 
makeColorSwatchWidgetThis makes a color swatch and a 'Set' button that is used to set the color. It returns a 2 element array holding the swatch and the button.- Parameters:
- color- The initial color
- label- The label to use when popping up the color dialog
- Returns:
- 3 element array that holds the swatch and the set button and the clear button
 
- 
makeColorNameComboBoxA helper to make a color selector combo box- Parameters:
- dflt- The default color value
- Returns:
- The color selector combo box
 
- 
getImageIconCreate an ImageIcon from the given image file name. The filename may be a file, a java resource or a url.- Parameters:
- file- The image file
- Returns:
- The ImageIcon or null if it could not be created
 
- 
getImageIconCreate an ImageIcon from the given image file name. The filename may be a file, a java resource or a url.- Parameters:
- file- The image file
- cache- Should the local in memory cache be checked
- Returns:
- The ImageIcon or null if it could not be created
 
- 
getImageIconCreate an ImageIcon from the given image file name. The filename may be a file, a java resource or a url.- Parameters:
- file- The image file
- c- The class to use when looking up the image as a resource
- Returns:
- The ImageIcon or null if it could not be created
 
- 
getImageIconCreate an ImageIcon from the given image file name. The filename may be a file, a java resource or a url.- Parameters:
- file- The image file
- c- The class to use when looking up the image as a resource
- cache- Should the local in memory cache be checked
- Returns:
- The ImageIcon or null if it could not be created
 
- 
getScaledImageIconGet a scaled image icon- Parameters:
- file- location of the image
- c- relative class
- cache- true to cache result
- Returns:
- the icon or null
 
- 
scaleImageIconThis scales the image icon up to the minimum icon size if it is defined- Parameters:
- icon- The icon
- Returns:
- The scaled icon
 
- 
getImageCreate an Image from the given image file name. The filename may be a file, a java resource or a url.- Parameters:
- file- The image file
- Returns:
- The Image or null if it could not be created
 
- 
getImageCreate an Image from the given image file name. The filename may be a file, a java resource or a url.- Parameters:
- file- The image file
- c- Used to lookup the image as a java resource
- Returns:
- The Image or null if it could not be created
 
- 
getImageCreate an Image from the given image file name. The filename may be a file, a java resource or a url.- Parameters:
- file- The image file
- c- Used to lookup the image as a java resource
- cache- Should the local cache of Images be checked
- Returns:
- The Image or null if it could not be created
 
- 
getImageGet an image- Parameters:
- file- location of the image
- c- relative class
- cache- true to cache result
- returnNullIfNotFound- true to return null;
- Returns:
- image or null (if returnNullIfNotFound is true);
 
- 
showDialogNearSrcThis will set the location of the theWindow component (might be A JDialog or a JFrame) at the screen location of the given src component. It will then show the theWindow.- Parameters:
- src- Where we locate
- theWindow- What we locate
 
- 
showWidgetThis will show and/or deiconify the given component. The component needs to be a Window or a Frame- Parameters:
- c- The thing to show.
 
- 
makeJButtonUtility to make a JButton, adding the given listener as an ActionListener- Parameters:
- label- The button label
- listener- The ActionListener
- Returns:
- The newly created button
 
- 
makeJButtonUtility 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>- Parameters:
- label- The button label
- args- The argname/value array
- Returns:
- The newly created button
 
- 
getSliderPercentReturn the slider value as a percentage between its min and max- Parameters:
- s- The slider
- Returns:
- The percent value
 
- 
setSliderPercentSet the slider value as a percentage between its min and max- Parameters:
- s- The slider
- percent- The percent value
 
- 
setBackgroundOnTreeRecurse the Component hierarchy, setting the background color of each component.- Parameters:
- c- The component
- bgColor- The color
 
- 
setToolTipOnTreeRecurse the Component hierarchy, setting the tooltip of each component.- Parameters:
- c- The component
- tooltip- The tooltip
 
- 
setFontOnTreeRecurse the Component hierarchy, setting the font.- Parameters:
- c- The component
- f- The font
 
- 
setForegroundOnTreeRecurse the Component hierarchy, setting the foreground color of each component.- Parameters:
- comp- The component
- fgColor- The color
 
- 
setForegroundOnTreeRecurse the Component hierarchy, setting the foreground color of each component.- Parameters:
- comp- The component
- fgColor- The color
- ifEquals- If non null then only set the foreground color on the component its current color equals the given fgColor
 
- 
enableTreeEnable or disable a whole tree's worth of components- Parameters:
- comp- The component
- enable- The enable flag
 
- 
enableComponentsEnable or disable the list of Components- Parameters:
- comps- List of components
- enable- Enable or disable
 
- 
enablePanel_more_- Parameters:
- panel- _more_
- enable- _more_
 
- 
makeScrollPaneMake 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.- Parameters:
- c- The component to put in the scroll pane
- xdim- The x dimension
- ydim- The y dimension
- Returns:
- The new scroll pane
 
- 
setSizeSet the size and preferred size of the component and return it- Parameters:
- comp- component
- w- width
- h- height_
- Returns:
- The component
 
- 
buttonGroupCreate a button group and add the two buttons to it.- Parameters:
- b1- Button 1
- b2- Button 2
- Returns:
- The created button group.
 
- 
buttonGroupCreate a button group and add the three buttons to it.- Parameters:
- b1- Button 1
- b2- Button 2
- b3- Button 3
- Returns:
- The created button group.
 
- 
buttonGrouppublic static ButtonGroup buttonGroup(JToggleButton b1, JToggleButton b2, JToggleButton b3, JToggleButton b4) Create a button group and add the three buttons to it.- Parameters:
- b1- Button 1
- b2- Button 2
- b3- Button 3
- b4- Button 3
- Returns:
- The created button group.
 
- 
valignLabelThis makes a component that contains a jlabel. The jlabel is inset with some padding at the top and the outer component is aligned to the top. It is intended to be used when doing a form layout and the component on the right it a tall one- Parameters:
- s- The string to create the label with
- Returns:
- the component
 
- 
formLayoutLayout as a 2 column form- Parameters:
- objects- objects to lay out
- Returns:
- the form
 
- 
formLayoutDo a 2 column layout of the objects with the given insets for spacing- Parameters:
- objects- May be components or strings. If strings this method will create jlabels
- insets- spacing
- Returns:
- component
 
- 
formLayoutThis does a doLayout with 2 columns. If any of the objects are not a Component then it creates a rLabel(object.toString)- Parameters:
- objects- array of components to layout
- insets- The spacing
- Returns:
- component
 
- 
formLayoutThis does a doLayout with 2 columns. If any of the objects are not a Component then it creates a rLabel(object.toString)- Parameters:
- objects- array of components to layout
- Returns:
- component
 
- 
flowRightCreate a panel and do a a right align flow layout of the components- Parameters:
- comps- The components to add
- Returns:
- The new panel
 
- 
flowCreate a panel and do flow layout of the components- Parameters:
- comps- The components to add
- Returns:
- The new panel
 
- 
makeButtonsMake a set of JButtons, each with a label and action command from the given cmds array. Add the buttons into a new JPanel and return it.- Parameters:
- l- Listener
- cmds- Button labels.action commands
- Returns:
- JPanel that contains the buttons
 
- 
makeButtonsMake a set of JButtons, each with a label and action command from the given cmds array. Add the buttons into a new JPanel and return it.- Parameters:
- l- Listener
- cmds- Button labels.action commands
- buttonMap- If non-null will hold a mapping from (String) command to JButton
- Returns:
- JPanel that contains the buttons
 
- 
makeButtonsMake a set of JButtons, each with a label and action command from the given cmds and labels arrays. Add the buttons into a new JPanel and return it.- Parameters:
- l- Listener
- labels- Button labels
- cmds- Button action commands
- Returns:
- JPanel that contains the buttons
 
- 
makeButtonspublic 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. Add the buttons into a new JPanel and return it.- Parameters:
- l- Listener
- labels- Button labels
- cmds- Button action commands
- buttonMap- If non-null will hold a mapping from (String) command to JButton
- Returns:
- JPanel that contains the buttons
 
- 
makeButtonspublic 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. Add the buttons into a new JPanel and return it.- Parameters:
- l- Listener
- labels- Button labels. If a label starts with icon: then we make an image button, the image path is the rest of the label
- cmds- Button action commands
- tooltips- If non-null then set te tooltip on the button
- buttonMap- If non-null will hold a mapping from (String) command to JButton
- Returns:
- JPanel that contains the buttons
 
- 
makeApplyCancelButtonsUtility to make apply/cancel button panel- Parameters:
- l- The listener to add to the buttons
- Returns:
- The button panel
 
- 
makeApplyButtonUtility to make apply button panel- Parameters:
- l- The listener to add to the buttons
- Returns:
- The button panel
 
- 
makeOkCancelButtonsUtility to make ok/cancel button panel- Parameters:
- l- The listener to add to the buttons
- Returns:
- The button panel
 
- 
makeNewOkCancelButtonsUtility to make new/ok/cancel button panel- Parameters:
- l- The listener to add to the buttons
- Returns:
- The button panel
 
- 
makeNewOkCancelHelpButtonsUtility to make new/ok/cancel/help button panel- Parameters:
- l- The listener to add to the buttons
- Returns:
- The button panel
 
- 
makeNewOkCancelButtonspublic static JPanel makeNewOkCancelButtons(ActionListener l, String newLabel, String okLabel, String cancelLabel) Utility to make new/ok/cancel button panel- Parameters:
- l- The listener to add to the buttons
- newLabel- Label to use for the new button
- okLabel- Label to use for the ok button
- cancelLabel- Label to use for the cancel button
- Returns:
- Button panel
 
- 
makeOkCancelButtonsUtility to make ok/cancel button panel- Parameters:
- l- The listener to add to the buttons
- okLabel- Label to use for the ok button
- cancelLabel- Label to use for the cancel button
- Returns:
- Button panel
 
- 
makeApplyOkCancelButtonsUtility to make apply/ok/cancel button panel- Parameters:
- l- The listener to add to the buttons
- Returns:
- Button panel
 
- 
makeOkHelpCancelButtonsUtility to make ok/help/cancel button panel- Parameters:
- l- The listener to add to the buttons
- Returns:
- Button panel
 
- 
makeApplyOkHelpCancelButtonsUtility to make apply/ok/help/cancel button panel- Parameters:
- l- The listener to add to the buttons
- Returns:
- Button panel
 
- 
makeApplyOkResetCancelButtonsUtility to make apply/ok/reset/cancel button panel- Parameters:
- l- The listener to add to the buttons
- Returns:
- Button panel
 
- 
showYesNoDialogShow a modeful dialog, attached to the given frame, with the given message. Ask the user Yes or No.- Parameters:
- frame- Frame to attach to.
- message- Message to show
- title- Window title
- Returns:
- True if user selects Yes, false if No
 
- 
showYesNoDialogpublic 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. Ask the user Yes or No.- Parameters:
- frame- Frame to attach to.
- message- Message to show
- title- Window title
- yes- The Yes text
- no- The No text
- Returns:
- True if user selects Yes, false if No
 
- 
insertTextInsert text into the component- Parameters:
- comp- component
- s- text to insert
 
- 
showYesNoCancelDialogShow a modeful dialog, attached to the given frame, with the given message. Ask the user Yes or No or Cancel- Parameters:
- frame- Frame to attach to.
- message- Message to show
- title- Window title
- Returns:
- 0 if Yes, 1 if No, 2 if Cancel
 
- 
showYesNoCancelDialogpublic static int showYesNoCancelDialog(Window frame, String message, String title, String defaultCmd) Show a modeful dialog, attached to the given frame, with the given message. Ask the user Yes or No or Cancel- Parameters:
- frame- Frame to attach to.
- message- Message to show
- title- Window title
- defaultCmd- default for the dialog (CMD_YES, CMD_NO, CMD_CANCEL)
- Returns:
- 0 if Yes, 1 if No, 2 if Cancel
 
- 
showYesNoDialogpublic static boolean showYesNoDialog(Window frame, String title, Component contents, Component src) Show a modeful dialog, attached to the given frame, with the given message. Ask the user Yes or No.- Parameters:
- frame- Frame to attach to.
- title- Window title
- contents- GUI contents
- src- Where to show window
- Returns:
- True if user selects Yes, false if No
 
- 
showOkCancelDialogShow a modeful Ok/Cancel dialog.- Parameters:
- f- The frame to attach to
- title- The window title
- contents- The gui contents to show
- src- Where should the window popup
- Returns:
- True if Ok was pressed, false otherwise
 
- 
showOkCancelDialogpublic static boolean showOkCancelDialog(Window f, String title, Component contents, Component src, List actionComponents) Show a modeful Ok/Cancel dialog.- Parameters:
- f- The frame to attach to
- title- The window title
- contents- The gui contents to show
- src- Where should the window popup
- actionComponents- 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
- Returns:
- True if Ok was pressed, false otherwise
 
- 
createFrameA utility to create a frame. This also registers the frame with the LogUtil facility that tracks the recently active windows.- Parameters:
- title- Frame title
- Returns:
- The frame
 
- 
createDialogA utility to create a dialog. If modal then this method uses the LogUtil.getCurrentWindow as the parent window of the dialog.- Parameters:
- title- Dialog title
- modal- Is modal
- Returns:
- THe dialog
 
- 
popupPopup an html widget at the given x/y that shows the text (or, if the text is a URI will read the URI).- Parameters:
- text- text or uri
- x- x
- y- y
- modal- modal
- Returns:
- 2 element array holding the html component and the dialog
 
- 
createDialogUtility to create a JDialog with a parent component. If not modal this method also registers the JDialog with the LogUtil last active window facility.- Parameters:
- parent- The parent window. May be null, a Dialog or a Frame
- title- Dialog title
- modal- Is modal
- Returns:
- The dialog
 
- 
showOkCancelDialogpublic static boolean showOkCancelDialog(Window f, String title, Component contents, Component src, List actionComponents, String okLabel) Show a modeful Ok/Cancel dialog.- Parameters:
- f- The frame to attach to
- title- The window title
- contents- The gui contents to show
- src- Where should the window popup
- actionComponents- 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
- okLabel- text for the OK button
- Returns:
- True if Ok was pressed, false otherwise
 
- 
showOkCancelDialogpublic static boolean showOkCancelDialog(Window f, String title, Component contents, Component src, List actionComponents, String okLabel, boolean resizable, Dimension dialogPrefSize) Show a modal Ok/Cancel dialog.- Parameters:
- f- The frame to attach to
- title- The window title
- contents- The gui contents to show
- src- Where should the window popup
- actionComponents- 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
- okLabel- text for the OK button
- resizable- Whether or not the dialog can be resized.
- dialogPrefSize- If not- null, use as preferred size of resulting dialog.
- Returns:
- True if Ok was pressed, false otherwise
 
- 
showOkDialogShow OK dialog- Parameters:
- f- relative window
- title- title for the dialog
- contents- dialog contents
- src- src component
 
- 
makeDialogpublic 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. Return the index of the button that was pushed- Parameters:
- f- Frame to attach to
- title- Window title
- contents- GUI contents
- src- Where to show window
- buttonLabels- Buttons
- Returns:
- Which button was pushed
 
- 
configureStepSelectionAdd a listener to the JList that pops up a menu on a right click that allos for the selection of different strides.- Parameters:
- list- list to popup on
 
- 
showIntervalSelectionDialogShow the list interval selection dialog- Parameters:
- list- list
 
- 
getConfigureStepSelectionItemspopup a menu to select strides- Parameters:
- list- JList
- items- menu items
 
- 
formLayoutDo a 2 column layout. Right align the first column. Make the width of the first column non-stretcy, second column stretchy.- Parameters:
- comps- Components to layout
- rightAlignFirstColumn- If true then right align the first column
- Returns:
- Panel containing form
 
- 
formLayoutDo a 2 column layout. Right align the first column. Make the width of the first column non-stretcy, second column stretchy.- Parameters:
- comps- Components to layout
- Returns:
- Panel containing form
 
- 
formLayoutDo a 2 column layout. Right align the first column. Use the given stretchy flags.- Parameters:
- comps- Components to layout
- widths- WT_
- heights- WT_
- Returns:
- Panel containing form
 
- 
formLayoutDo a 2 column layout. Right align the first column. Use the given stretchy flags.- Parameters:
- comps- Components to layout
- widths- WT_
- heights- WT_
- Returns:
- Panel containing form
 
- 
formLayoutpublic static JComponent formLayout(List comps, double[] widths, double[] heights, boolean rightAlignFirstColumn) Do a 2 column layout. Use the given stretchy flags.- Parameters:
- comps- Components to layout
- widths- WT_
- heights- WT_
- rightAlignFirstColumn- If true then right align the first column.
- Returns:
- Panel containing form
 
- 
labelCreate a JPanel that holds a JLabel/the given widget- Parameters:
- label- The label text to use
- widget- The widget to label
- Returns:
- The panel
 
- 
labelCreate a JPanel that holds a the given widget/JLabel- Parameters:
- widget- The widget to label
- label- The label text to use
- Returns:
- The panel
 
- 
packWindowAdd the given contents into the given frame- Parameters:
- f- The frame
- contents- The contents
- Returns:
- The given frame
 
- 
packWindowAdd the given contents into the given frame- Parameters:
- f- The frame
- contents- The contents
- andShow- If true then show the window.
- Returns:
- The given frame
 
- 
packDialogAdd the given contents into the given dialog- Parameters:
- f- The dialog
- contents- The contents
- Returns:
- The dialog
 
- 
makeWindowCreate a new JFrame, add the contents to it, set its location and return it.- Parameters:
- title- The window title
- contents- The contents
- x- x location
- y- y location
- Returns:
- The new JFrame
 
- 
makeMenuBarCreate a JMenuBar and add the menus contained with the menus list If no menus then return null.- Parameters:
- menus- List if JMenu-s
- Returns:
- The JMenuBar
 
- 
getCloseDialogListenerCreate a listener that will close the given dialog.- Parameters:
- dialog- The dialog to close
- Returns:
- The listener that closes the dialog on an action event
 
- 
getImageLabelCreate a JLabel that displays an image icon create from the given icon path (may be a file, resource or url).- Parameters:
- icon- The image file
- origin- Used to lookup java resources
- Returns:
- New JLabel showing image
 
- 
getImageLabelCreate a JLabel that displays an image icon create from the given icon path (may be a file, resource or url).- Parameters:
- icon- The image file
- Returns:
- New JLabel showing image
 
- 
getImageButtonCreate a JButton that displays an image icon create from the given icon path (may be a file, resource or url).- Parameters:
- icon- The image file
- origin- Used to lookup java resources
- Returns:
- New JButton showing image
 
- 
getImageButtonCreate a JButton that displays an image icon create from the given icon path (may be a file, resource or url).- Parameters:
- icon- The image file
- origin- Used to lookup java resources
- hInset- Horizontal inset
- vInset- Vertical inset
- Returns:
- New JButton showing image
 
- 
getScaledImageButtonGet a scaled image button- Parameters:
- icon- path to icon for the button
- origin- relative class
- hInset- horizontal inset
- vInset- vertical inset
- Returns:
- the button
 
- 
getImageButtonCreate a JButton that displays the given image icon- Parameters:
- icon- The image icon
- Returns:
- New JButton showing image
 
- 
getImageButtonCreate a JButton that displays the given image icon- Parameters:
- icon- The image icon
- offset- The spacing around the image in the JButton
- Returns:
- New JButton showing image
 
- 
getImageButtonCreate a JButton that displays the given image icon- Parameters:
- icon- The image icon
- hinset- The hor. spacing around the image in the JButton
- vinset- The vert. spacing around the image in the JButton
- Returns:
- New JButton showing image
 
- 
getToggleImageButtonpublic 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.- Parameters:
- icon- Image for button
- selectedIcon- Image to use when selected
- hinset- Hor. inset
- vinset- Vert. inset
- addMouseOverBorder- add a mouseover border
- Returns:
- New button
 
- 
getToggleImageButtonpublic 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.- Parameters:
- icon- Image for button
- selectedIcon- Image to use when selected
- hinset- Hor. inset
- vinset- Vert. inset
- Returns:
- New button
 
- 
getToggleImageButtonpublic 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.- Parameters:
- icon- Image for button
- selectedIcon- Image to use when selected
- hinset- Hor. inset
- vinset- Vert. inset
- addMouseOverBorder- add a mouseover border
- Returns:
- New button
 
- 
makeMouseOverBorderMake a mouse over border- Parameters:
- b- the component
 
- 
getToggleButtonCreate a toggle button with the given image.- Parameters:
- iconPath- path to image
- hinset- hor. inset
- vinset- vert inset
- Returns:
- button
 
- 
getToggleButtonCreate a toggle button with the given image.- Parameters:
- icon- The icon to use
- hinset- hor.inset
- vinset- vert. inset
- Returns:
- The new button
 
- 
getLocationFind the location of the given componet on the screen. If any errors then return the screen center - 100- Parameters:
- src- Source component
- Returns:
- Location on screen
 
- 
showInCenterpack and show the dialog in the center of the screen- Parameters:
- dialog- The dialog
 
- 
packInCenterpack the dialog in the center of the screen- Parameters:
- dialog- The dialog
 
- 
vsplitCreate a JSplitPane in vertical mode.- Parameters:
- top- Top component
- bottom- Bottom component
- topSpace- How much space to give the top
- resizeWeight- How much weight to give the top when resizing
- Returns:
- The split pane
 
- 
vsplitCreate a JSplitPane in vertical mode.- Parameters:
- top- Top component
- bottom- Bottom component
- topSpace- How much space to give the top
- Returns:
- The split pane
 
- 
vsplitCreate a JSplitPane in vertical mode.- Parameters:
- top- Top component
- bottom- Bottom component
- resizeWeight- How much weight to give the top when resizing
- Returns:
- The split pane
 
- 
vsplitCreate a JSplitPane in vertical mode.- Parameters:
- top- Top component
- bottom- Bottom component
- Returns:
- The split pane
 
- 
hsplitpublic static JSplitPane hsplit(Component left, Component right, int leftSpace, double resizeWeight) Create a horizontally aligned JSplitPane. Give the left component the specified space.- Parameters:
- left- The left component
- right- The right component
- leftSpace- Where to put the divider
- resizeWeight- The resize weight
- Returns:
- The split pane
 
- 
hsplitCreate a horizontally aligned JSplitPane- Parameters:
- left- The left component
- right- The right component
- leftSpace- Where to put the divider
- Returns:
- The split pane
 
- 
hsplitCreate a horizontally aligned JSplitPane- Parameters:
- left- The left component
- right- The right component
- resizeWeight- How much resize weight to use
- Returns:
- The split pane
 
- 
hsplitCreate a basic horizontally aligned JSplitPane- Parameters:
- left- The left component
- right- The right component
- Returns:
- The split pane
 
- 
rLabelCreate a right aligned JLabel- Parameters:
- s- The String to use for the label
- Returns:
- The label
 
- 
cLabelCreate a center aligned JLabel- Parameters:
- s- The String to use for the label
- Returns:
- The label
 
- 
lLabelCreate a left aligned JLabel- Parameters:
- s- The String to use for the label
- Returns:
- The label
 
- 
hspaceCreate a a minimally sized spacer- Parameters:
- w- The min width
- h- The min height
- Returns:
- The spacer
 
- 
getInputAsk the user the question. Return their response or null.- Parameters:
- question- The question.
- label- Extra label.
- initValue- Initial value of answer
- Returns:
- The user's response
 
- 
getInputpublic static String getInput(String question, String label, String initValue, String trailingLabel) Ask the user the question. Return their response or null.- Parameters:
- question- The question.
- label- Extra label.
- initValue- Initial value of answer
- trailingLabel- Label after the text field.
- Returns:
- The user's response
 
- 
getInputpublic static String getInput(String question, String label, String initValue, String trailingLabel, Object underLabel) Ask the user the question. Return their response or null.- Parameters:
- question- The question.
- label- Extra label.
- initValue- Initial value of answer
- trailingLabel- Label after the text field.
- underLabel- Label under the text field.
- Returns:
- The user's response
 
- 
getInputpublic static String getInput(String question, String label, String initValue, String trailingLabel, Object underLabel, String title) Ask the user the question. Return their response or null.- Parameters:
- question- The question.
- label- Extra label.
- initValue- Initial value of answer
- trailingLabel- Label after the text field.
- underLabel- Label under the text field.
- title- for the dialog box.
- Returns:
- The user's response
 
- 
getInputpublic static String getInput(String question, String label, String initValue, String trailingLabel, Object underLabel, String title, int fieldWidth) Ask the user the question. Return their response or null.- Parameters:
- question- The question.
- label- Extra label.
- initValue- Initial value of answer
- trailingLabel- Label after the text field.
- underLabel- Label under the text field.
- title- for the dialog box.
- fieldWidth- Field width
- Returns:
- The user's response
 
- 
getInputpublic static String getInput(String question, String label, String initValue, String trailingLabel, Object underLabel, String title, int fieldWidth, JComponent nearComponent) Ask the user the question. Return their response or null.- Parameters:
- question- The question.
- label- Extra label.
- initValue- Initial value of answer
- trailingLabel- Label after the text field.
- underLabel- Label under the text field.
- title- for the dialog box.
- fieldWidth- Field width
- nearComponent- If non-null then show the dialog near this component
- Returns:
- The user's response
 
- 
getInputAsk the user the question. Return the answer.- Parameters:
- question- The question
- Returns:
- The answer
 
- 
askYesNoAsk the user the question. Return yes or no.- Parameters:
- title- The window title.
- question- The question.
- Returns:
- True if they say yes
 
- 
askOkCancelAsk the user the question. Return ok or cancel.- Parameters:
- title- The window title.
- question- The question.
- Returns:
- True if they say ok, false otherwise
 
- 
showDialogShow the given component in a dialog.- Parameters:
- title- The title
- comp- The component to show
 
- 
addModalDialogComponentAdd the model dialog to the list- Parameters:
- comp- The component in the model dialog
 
- 
removeModalDialogComponentRemove the model dialog from the list- Parameters:
- comp- The component in the model dialog
 
- 
showDialogShow the given component in a dialog.- Parameters:
- title- The title
- comp- The component to show
- parentComponent- The parent component of the dialog.
 
- 
toFrontModalDialogspublic static void toFrontModalDialogs()Move to the front any modal dialogs
- 
setListDataProcedure to set the list of items in a ComboBox- Parameters:
- box- Combobox to fill
- items- Items to add
 
- 
anySelectedCheck if there are any selected items in the combobox. We have this as a method because if the box as no items a getSelectedItem causes an error.- Parameters:
- box- The box to check
- Returns:
- Any selected items.
 
- 
setListDataProcedure to set the list of items in a ComboBox- Parameters:
- box- Combobox to fill
- items- Items to add
 
- 
getEditableBoxCreate an editable combobox with the given items. Preselect the selected item if non-null.- Parameters:
- items- Items in the box
- selected- Selected item
- Returns:
- New JComboBox
 
- 
getBoxValueReturn the selected item in the given box as an integer. Do a new Double(selected.toString()):- Parameters:
- box- The box
- Returns:
- The int value of the selected item.
 
- 
createValueBoxpublic static JComboBox createValueBox(ActionListener listener, String command, int initValue, List values, boolean editable) Create a combobx boxc that holds a set of integer values.- Parameters:
- listener- The action listener
- command- Action command for box
- initValue- Initial value
- values- List of Integers
- editable- Is box editable
- Returns:
- The combobox
 
- 
processXmlMenuItempublic static JMenuItem processXmlMenuItem(Node node, ActionListener listener, Hashtable menuItems) throws Exception Create the JMenuItem defined by the given xml- Parameters:
- node- Xml menu item node
- listener- Action listener to add to the menu item
- menuItems- Mapping from id (from xml) to JMenuItem
- Returns:
- The menu item
- Throws:
- Exception
 
- 
processXmlMenuItempublic static JMenuItem processXmlMenuItem(Node node, ActionListener listener, Hashtable menuItems, Hashtable<String, ImageIcon> actionIcons) throws ExceptionCreate the JMenuItem defined by the given xml- Parameters:
- node- Xml menu item node
- listener- Action listener to add to the menu item
- menuItems- Mapping from id (from xml) to JMenuItem
- actionIcons- mapping of string action to imageicon to use in the menu item
- Returns:
- The menu item
- Throws:
- Exception
 
- 
charToKeyCodeTake the first character of the string and return the numeric key code- Parameters:
- s- The string
- Returns:
- The key code of the first char of the string
 
- 
charToKeyCodepublic static int charToKeyCode(char ch) Return the numeric key code of the given character.- Parameters:
- ch- The character
- Returns:
- Its key code
 
- 
processXmlMenupublic static JMenu processXmlMenu(Node menuNode, ActionListener listener, Hashtable menuItems) throws Exception Create the JMenu from the given xml.- Parameters:
- menuNode- The menu xml node
- listener- The action listener
- menuItems- Mapping from id to menu items
- Returns:
- New JMenu
- Throws:
- Exception
 
- 
processXmlMenupublic static JMenu processXmlMenu(Node menuNode, ActionListener listener, Hashtable menuItems, Hashtable<String, ImageIcon> actionIcons) throws ExceptionCreate the JMenu from the given xml.- Parameters:
- menuNode- The menu xml node
- listener- The action listener
- menuItems- Mapping from id to menu items
- actionIcons- mapping of string action to imageicon to use in the menu item
- Returns:
- New JMenu
- Throws:
- Exception
 
- 
processXmlMenuBarpublic static JMenuBar processXmlMenuBar(Element root, JMenuBar menuBar, ActionListener listener, Hashtable menuItems) Create, if null, and ddd to the JMenuBar from the xml- Parameters:
- root- Xml root
- menuBar- The menu bar
- listener- The action listener
- menuItems- Mapping from id to menu items
- Returns:
- The JMenuBar
 
- 
processXmlMenuBarpublic 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- Parameters:
- root- Xml root
- menuBar- The menu bar
- listener- The action listener
- menuItems- Mapping from id to menu items
- actionIcons- mapping of string action to imageicon to use in the menu item
- Returns:
- The JMenuBar
 
- 
getItemsreturn the list of items held by the combo box.- Parameters:
- box- The box
- Returns:
- List of items
 
- 
isShowingIs the frame showing- Parameters:
- f- The frame
- Returns:
- Is it showing
 
- 
isShowingIs the dialog showing- Parameters:
- f- The dialog
- Returns:
- Is it showing
 
- 
getImageGet the screen image from the component- Parameters:
- component- The component.
- Returns:
- Its image
- Throws:
- Exception
 
- 
showHtmlDialogShow the given html in a window. If linkListener is non-null then add itinto the html viewer to listen for hyper link clicks.- Parameters:
- html- The html
- linkListener- The listener
- Returns:
- A 2-tuple. First element is the JDialog. Second is the JEditorPane
 
- 
showHtmlDialogShow the given html in a window with the given title. If linkListener is non-null then add itinto the html viewer to listen for hyper link clicks.- Parameters:
- html- The html
- title- The title of the window
- linkListener- The listener
- Returns:
- A 2-tuple. First element is the JFrame. Second is the JEditorPane
 
- 
getHtmlComponentpublic static Component[] getHtmlComponent(String html, HyperlinkListener linkListener, int width, int height) Make a JTextEditor component and scroller for the given html- Parameters:
- html- html
- linkListener- Listener
- width- height
- height- width
- Returns:
- 2 component array. First is the editor. Second is the scroller its in
 
- 
showHtmlDialogpublic static Component[] showHtmlDialog(String html, String title, String label, HyperlinkListener linkListener, boolean modal) Show a dialog window that contains an html editor- Parameters:
- html- html
- title- window title
- label- label
- linkListener- Listener
- modal- is window modal
- Returns:
- 2 component array. First is the editor. Second is the scroller its in
 
- 
initializeExpandedPathsBeforeChangepublic static Hashtable initializeExpandedPathsBeforeChange(JTree tree, DefaultMutableTreeNode root) Call this before a JTree changes. It stores into the returned hashtable state that it uses later to re-expand the paths of the jtree after its structure changes.- Parameters:
- tree- The jtree
- root- Its tree root
- Returns:
- Holds the state for later expansion
 
- 
expandPathsAfterChangeCall this after the structure of a JTree changes to re-expand the paths.- Parameters:
- tree- The tree
- state- The state. From initializeExpandedPathsBeforeChange
- root- The tree root
 
- 
doTreeSearchpublic 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.- Parameters:
- tree- Tree to search
- lastState- For successive searches, this keeps state around
- nodeDesc- A descriptive term for the node for when we tell something to the user
- near- If non-null then show the input dialog near this component
- Returns:
- Some state for successive searches
 
- 
limitMenuSizeThis 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. It uses name (e.g., Group) to make the sub-menus, e.g., Group 1, Group 2, ...- Parameters:
- items- List of JMenuItems
- name- The name suffix to use
- size- Max size of a menu
 
- 
limitMenuSizeThis ensures that there are no more than size number of items in any sub menu. It uses name (e.g., Group) to make the sub-menus, e.g., Group 1, Group 2, ...- Parameters:
- menu- The menu
- name- The name suffix to use
- size- Max size of a menu
 
- 
limitMenuSizeThis ensures that there are no more than size number of items in any sub menu. It uses name (e.g., Group) to make the sub-menus, e.g., Group 1, Group 2, ...- Parameters:
- menu- The menu
- name- The name suffix to use
- size- Max size of a menu
- recurse- If true then limit the size of all sub menus
 
- 
doTreeSearchpublic static GuiUtils.TreeSearchResults doTreeSearch(JTree tree, Object lastState, String nodeDesc, JComponent near, String originalPhrase) Search the given tree- Parameters:
- tree- the tree
- lastState- last state
- nodeDesc- the node description
- near- the near component
- originalPhrase- the search phrase
- Returns:
- the results
 
- 
toCsvConvert the given table model to comma separated string- Parameters:
- model- The table model to write
- Returns:
- CSV representation of the given table model
 
- 
toCsvConvert the given table model to comma separated string- Parameters:
- model- The table model to write
- includeColumnNames- true to include the column names
- Returns:
- CSV representation of the given table model
 
- 
exportAsCsvWrite out the given table model as a csv file- Parameters:
- model- The table model to write
 
- 
exportAsCsvWrite out the given table model as a comma separated value (CSV) file prepending the header.- Parameters:
- header- a header to prepend to the table
- model- The table model to write
 
- 
exportAsCsvWrite out the given table model as a comma separated value (CSV) file prepending the header.- Parameters:
- header- a header to prepend to the table
- model- The table model to write
- includeColumnNames- true to include the column names
 
- 
exportAsCsvExport a table as csv- Parameters:
- header- header for the output
- model- table model
- filename- file name to export to
 
- 
exportAsCsvpublic static void exportAsCsv(String header, TableModel model, String filename, boolean includeColumnNames) Export a table as csv- Parameters:
- header- header for the output
- model- table model
- filename- file name to export to
- includeColumnNames- true to include the column names
 
- 
setupDirectoryChooserSet up a directory chooser- Parameters:
- btn- button for choosing directory
- directoryFld- directory field
 
- 
setupFileChooserSet up a directory chooser- Parameters:
- btn- button for choosing directory
- directoryFld- directory field
- justDirectories- flag for just looking at directories
 
- 
makeCheckboxMake a checkbox. Automatically call the set'property' method on the object- Parameters:
- label- Label
- object- Object to call
- property- Name of property to get/set value
- Returns:
- The checkbox
 
- 
makeCheckboxMake a checkbox. Automatically call the set'property' method on the object- Parameters:
- label- Label
- object- Object to call
- property- Name of property to get/set value
- arg- Optional arg to pass to method
- Returns:
- The checkbox
 
- 
makeRadioButtonspublic static JRadioButton[] makeRadioButtons(List labels, int selectedIndex, Object object, String methodName) Make a set of radio buttons- Parameters:
- labels- labels
- selectedIndex- which one is on
- object- Object to call
- methodName- The method
- Returns:
- The radio buttons
 
- 
makeButtonMake a JButton. Call methodName on object when button pressed.- Parameters:
- label- Label
- object- Object to call
- methodName- Method name to call
- Returns:
- The button
 
- 
makeButtonMake a JButton. Call methodName on object when button pressed. Pass in given arg if non-null.- Parameters:
- label- Label
- object- Object to call
- methodName- Method name to call
- arg- Pass this to method name if non-null.
- Returns:
- The button
 
- 
makeButtonpublic static JButton makeButton(String label, Object object, String methodName, Object arg, String tooltip) Make a JButton. Call methodName on object when button pressed. Pass in given arg if non-null.- Parameters:
- label- Label
- object- Object to call
- methodName- Method name to call
- arg- Pass this to method name if non-null.
- tooltip- if non-null then set the tooltip on the button
- Returns:
- The button
 
- 
makeActionListenerMake an ActionListener. Call methodName on object when button pressed. Pass in given arg if non-null.- Parameters:
- object- Object to call
- methodName- Method name to call
- arg- Pass this to method name if non-null.
- Returns:
- The action listener
 
- 
invokeInSwingThreadRUn the given runnable in the swing event dispatch thread- Parameters:
- runnable- runnable to run
 
- 
makeImageButtonMake a JButton. Call methodName on object when button pressed.- Parameters:
- label- Label
- object- Object to call
- methodName- Method name to call
- Returns:
- The button
 
- 
makeImageButtonMake a JButton. Call methodName on object when button pressed. Pass in given arg if non-null.- Parameters:
- label- Label
- object- Object to call
- methodName- Method name to call
- arg- Pass this to method name if non-null.
- Returns:
- The button
 
- 
makeImageButtonpublic static JButton makeImageButton(String label, Object object, String methodName, Object arg, boolean addMouseOverBorder) Make a JButton. Call methodName on object when button pressed. Pass in given arg if non-null.- Parameters:
- label- Label
- object- Object to call
- methodName- Method name to call
- arg- Pass this to method name if non-null.
- addMouseOverBorder- add a mouse-over border
- Returns:
- The button
 
- 
addActionListenerpublic static JComponent addActionListener(JComponent comp, Object object, String methodName, Object arg) Adds an action listener to the button. Call methodName on object when button pressed. Pass in given arg if non-null.- Parameters:
- comp- The component
- object- Object to call
- methodName- Method name to call
- arg- Pass this to method name if non-null.
- Returns:
- The button
 
- 
makeDynamicMenuCreate 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.- Parameters:
- name- Menu name
- object- Object to call
- methodName- method to invoke
- Returns:
- The menu
 
- 
makeDynamicMenupublic 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.- Parameters:
- name- Menu name
- object- Object to call
- methodName- method to invoke
- doRemoveAll- true to remove all first
- Returns:
- The menu
 
- 
makeComboBoxpublic static JComboBox makeComboBox(List items, Object selected, boolean editable, Object listener, String methodName) Make a JComboBox- Parameters:
- items- items for the box
- selected- the selected item
- editable- flag for whether this is editable or not
- listener- Listener for changes
- methodName- method to call when item changes
- Returns:
- the combo box
 
- 
makeComboBoxpublic static JComboBox makeComboBox(List items, Object selected, boolean editable, Object listener, String methodName, boolean inAThread) Make a JComboBox- Parameters:
- items- items for the box
- selected- the selected item
- editable- flag for whether this is editable or not
- listener- Listener for changes
- methodName- method to call when item changes
- inAThread- Call the method in a thread
- Returns:
- the combo box
 
- 
makeComboBoxMake a combo box from a set of values and labels- Parameters:
- values- integer values
- labels- labels for values
- current- current one to select
- Returns:
- the JComboBox
 
- 
setValueOfBoxSet the value of the box- Parameters:
- box- the box to set
- value- the default value
- values- the values
- labels- labels for the values
 
- 
getValueFromBoxGet the integer value from a JComboBox of integer items- Parameters:
- box- the box to use
- Returns:
- the integer value
 
- 
makeSliderMake a JSlider- Parameters:
- min- minimum value
- max- maximum value
- value- initial value
- listener- listener for changes
- methodName- method to call when change occurs
- Returns:
- JSlider
 
- 
makeSliderpublic static JSlider makeSlider(int min, int max, int value, Object listener, String methodName, boolean updateAsMove) Make a JSlider- Parameters:
- min- minimum value
- max- maximum value
- value- initial value
- listener- listener for changes
- methodName- method to call when change occurs
- updateAsMove- If true we call the listener as the slider moves.
- Returns:
- JSlider
 
- 
getFontSizeListGet a list of font sizes- Returns:
- list of font sizes
 
- 
getFontListGet a list of fonts- Returns:
- vector of fonts
 
- 
makeTwoFacedFontMake a TwoFacedObject from a font for displaying in a combobox.- Parameters:
- f- Font to use
- Returns:
- corresponding TwoFacedObject
 
- 
makeRowVisibleMake the given row in the table visible- Parameters:
- table- The table
- row- The row
 
- 
scrollToTopScroll the given component to the top- Parameters:
- editor- editor to scroll
 
- 
addMouseListenerRecurseAdd a mouse listener to all components of a container- Parameters:
- listener- the mouse listener
- c- the container
 
- 
addKeyListenerRecurseAdd a key listener to all components of a container- Parameters:
- listener- the key listener
- c- the container
 
- 
distancepublic static double distance(double x1, double y1, double x2, double y2) Calculate distance between 2 points.- Parameters:
- x1- x1
- y1- y1
- x2- x2
- y2- y2
- Returns:
- distance
 
- 
distancepublic static double distance(double[] p1, double[] p2) Get distance between- Parameters:
- p1- From
- p2- To
- Returns:
- Distance
 
- 
distancepublic static double distance(int[] p1, int[] p2) Get distance between- Parameters:
- p1- From
- p2- To
- Returns:
- Distance
 
- 
distanceCalculate distance between point and rectangle. This will give the min distance from the 4 corners and the sides.- Parameters:
- x- x
- y- y
- r- rect
- Returns:
- distance_
 
- 
makeVerticalLabelMake a vertical label- Parameters:
- text- text
- Returns:
- vertical label
 
- 
doMultiSplitPaneMake an evenly balanced group of split panes for the given components- Parameters:
- comps- List of components
- hsplit- horizontal or vertical
- Returns:
- split panes
 
- 
getNestedTabbedPaneMake a JTabbedPane without some of its border- Returns:
- Tabbed pane
 
- 
getNestedTabbedPaneMake a JTabbedPane without some of its border- Parameters:
- orient- tab orientation
- Returns:
- Tabbed pane
 
- 
getNestedTabbedPaneMake a JTabbedPane without some of its border- Parameters:
- orient- tab orientation
- top- top border
- left- left border
- bottom- bottom border
- right- right border
- Returns:
- Tabbed pane
 
- 
makeSliderPopupThis creates a JButton and a JSlider. The intent is that the button can be placed in some GUI. On click a small, decorationless modeful dialog that contains the slider is popped up. Focus is set on the slider and a return or escape or press of the close button closes the dialog. slider events are routed to the change listener.- Parameters:
- min- slider min value
- max- slider max value
- value- slider value
- listener- slider change listener
- Returns:
- a 2 element array containing the button and the slider
 
- 
positionAndFitToScreenPosition and fit a window to the screen- Parameters:
- window- window to fit
- bounds- new bounds
 
- 
toggleHeavyWeightComponentsWalk the tree and set any heavyweight components visibility. Note: We don't turn off any component that is under the javax.swing package If we encounter a JTabbedPane then only show the components that are in the selected tab- Parameters:
- comp- Component
- visible- On/off
 
- 
checkHeavyWeightComponentsWalk the components of the tab and toggle the heavyweight components visiblity- Parameters:
- tab- tab
 
- 
resetHeavyWeightComponentsWalk the components of the tab and toggle the heavyweight components visiblity- Parameters:
- tab- tab
 
- 
handleHeavyWeightComponentsInTabsAdd 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.- Parameters:
- tab- tab
 
- 
maintest- Parameters:
- args- args
- Throws:
- Exception- on badness
 
- 
makeFileBrowseButtonMake a button that pops up a file browser and sets the text of the given field with the selected file- Parameters:
- fld- Field to set
- Returns:
- The button
 
- 
makeFileBrowseButtonMake a button that pops up a file browser and sets the text of the given field with the selected file- Parameters:
- fld- Field to set
- filters- File filters. May be null.
- Returns:
- The button
 
- 
makeFileBrowseButtonpublic 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- Parameters:
- fld- Field to set
- chooseDirectory- Select a directory
- filters- File filters. May be null.
- Returns:
- The button
 
- 
doMakeFontBoxMake a font selector box- Parameters:
- f- Font to select in the box
- Returns:
- The box
 
- 
doMakeFontSizeBoxMake a box for setting the font size- Parameters:
- size- Selected size
- Returns:
- The box
 
- 
italicizeFontItalicize the font on the given component- Parameters:
- comp- The component
- Returns:
- the component
 
- 
popupUnitMenuThis pops up a menu near the given comp and allows the user to select a unit name which gets put into the given fld- Parameters:
- fld- The fld to set
- comp- THe component to popup the menu near
 
- 
getIconsInMenuspublic static boolean getIconsInMenus()Do we show icons in the menus- Returns:
- show icons in menus
 
- 
setIconsInMenuspublic static void setIconsInMenus(boolean doIcons) Do we show icons in the menus- Parameters:
- doIcons- show icons
 
- 
setIconSet the icon on the button. This button is usually a JMenu or JMenuItem If the setIconsInMenus flag is false then don't do this- Parameters:
- button- The button
- iconPath- The icon path
- Returns:
- Just return the button so you can do something like menu.add(GuiUtils.setIcon(menuItem,"/icon path"));
 
- 
setSelectedItems_more_- Parameters:
- list- _more_
- selected- _more_
 
- 
getItems_more_- Parameters:
- list- _more_
- Returns:
- _more_
 
- 
getLocalName_more_- Parameters:
- n- _more_
- local- _more_
- Returns:
- _more_
 
- 
getLocalName_more_- Parameters:
- n- _more_
- local- _more_
- addHtml- _more_
- Returns:
- _more_
 
- 
appendText_more_- Parameters:
- fld- _more_
- s- _more_
- delimiter- _more_
 
- 
addKeyBindings_more_- Parameters:
- comp- _more_
 
- 
moveSubtreesToTop_more_- Parameters:
- parent- _more_
 
- 
makeHeaderUtility to create a header that is a label and a line.- Parameters:
- label- Header label
- Returns:
- Header
 
- 
getAttributeGet the given name-d attribute from the given element. If not found return the dflt argument.- Parameters:
- element- The xml element to look within.
- name- The attribute name.
- dflt- The default value.
- Returns:
- The attribute value or the dflt if not found.
 
- 
getAttribute_more_- Parameters:
- attrs- _more_
- name- _more_
- dflt- _more_
- Returns:
- _more_
 
- 
getAttribute_more_- Parameters:
- attrs- _more_
- name- _more_
- dflt- _more_
- Returns:
- _more_
 
- 
getAttribute_more_- Parameters:
- attrs- _more_
- name- _more_
- Returns:
- _more_
 
- 
findChildren_more_- Parameters:
- parent- _more_
- tag- _more_
- Returns:
- _more_
 
- 
getIntGet an integer value from the text field- Parameters:
- fld- text field
- Returns:
- integer value shown
 
- 
getValueGet an double value from the text field- Parameters:
- fld- text field
- Returns:
- double value shown
 
- 
setApplicationTitle_more_- Parameters:
- title- _more_
 
- 
getApplicationTitle_more_- Returns:
- _more_
 
- 
doMacMenubarpublic static boolean doMacMenubar()_more_- Returns:
- _more_
 
- 
isControlKeyIs the given event a control (or meta for the mac) key- Parameters:
- event- _more_
- Returns:
- _more_
 
- 
isControlKey_more_- Parameters:
- event- _more_
- keyCode- _more_
- Returns:
- _more_
 
- 
isMacpublic static boolean isMac()Is this running on a Mac?- Returns:
- true if running on Mac
 
- 
isDeleteEvent_more_- Parameters:
- e- _more_
- Returns:
- _more_
 
- 
decorateFrame_more_- Parameters:
- frame- _more_
- menuBar- _more_
 
- 
showUrl_more_- Parameters:
- s- _more_
- Throws:
- Exception- _more_
 
- 
addLinkListener_more_- Parameters:
- editor- _more_
 
- 
showFrameAsDialogpopup but a modal dialog with input Jframe
 
-