Package com.compomics.util.gui
Class GuiUtilities
java.lang.Object
com.compomics.util.gui.GuiUtilities
A class containing simple GUI helper methods.
- Author:
- Harald Barsnes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetPreferredWidthOfCell(JTable table, int rowIndex, int colIndex) Returns the preferred width of a given cell in a table.static voidinstallEscapeCloseOperation(JDialog dialog) Close a dialog using the escape key.static booleanvalidateDoubleInput(Component parentComponent, JLabel label, JTextField textField, String valueDescription, String errorTitle, boolean positiveValue, boolean showMessage, boolean valid) Validate double input.static booleanvalidateIntegerInput(Component parentComponent, JLabel label, JTextField textField, String valueDescription, String errorTitle, boolean positiveValue, boolean showMessage, boolean valid) Validate integer input.
-
Constructor Details
-
GuiUtilities
public GuiUtilities()
-
-
Method Details
-
getPreferredWidthOfCell
Returns the preferred width of a given cell in a table.- Parameters:
table- the tablerowIndex- the row indexcolIndex- the colum index- Returns:
- the preferred width of the cell
-
validateIntegerInput
public static boolean validateIntegerInput(Component parentComponent, JLabel label, JTextField textField, String valueDescription, String errorTitle, boolean positiveValue, boolean showMessage, boolean valid) Validate integer input.- Parameters:
parentComponent- the parent componentlabel- the label of the inputtextField- the text field containing the inputvalueDescription- the description of the inputerrorTitle- the error titlepositiveValue- if true, only positive values will pass the filtershowMessage- if true, a message will be shown if the validation failsvalid- the status of previous validations- Returns:
- true of the field is validated, false if not (or if valid is false)
-
validateDoubleInput
public static boolean validateDoubleInput(Component parentComponent, JLabel label, JTextField textField, String valueDescription, String errorTitle, boolean positiveValue, boolean showMessage, boolean valid) Validate double input.- Parameters:
parentComponent- the parent componentlabel- the label of the inputtextField- the text field containing the inputvalueDescription- the description of the inputerrorTitle- the error titlepositiveValue- if true, only positive values will pass the filtershowMessage- if true, a message will be shown if the validation failsvalid- the status of previous validations- Returns:
- true of the field is validated, false if not (or if valid is false)
-
installEscapeCloseOperation
Close a dialog using the escape key.- Parameters:
dialog- the dialog to install the escape close on
-