Class GuiUtilities

java.lang.Object
com.compomics.util.gui.GuiUtilities

public class GuiUtilities
extends Object
A class containing simple GUI helper methods.
Author:
Harald Barsnes
  • Constructor Details

  • Method Details

    • getPreferredWidthOfCell

      public static int getPreferredWidthOfCell​(JTable table, int rowIndex, int colIndex)
      Returns the preferred width of a given cell in a table.
      Parameters:
      table - the table
      colIndex - the colum index
      rowIndex - the row 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 component
      label - the label of the input
      textField - the text field containing the input
      valueDescription - the description of the input
      errorTitle - the error title
      positiveValue - if true, only positive values will pass the filter
      showMessage - if true, a message will be shown if the validation fails
      valid - 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 component
      label - the label of the input
      textField - the text field containing the input
      valueDescription - the description of the input
      errorTitle - the error title
      positiveValue - if true, only positive values will pass the filter
      showMessage - if true, a message will be shown if the validation fails
      valid - the status of previous validations
      Returns:
      true of the field is validated, false if not (or if valid is false)
    • installEscapeCloseOperation

      public static void installEscapeCloseOperation​(JDialog dialog)
      Close a dialog using the escape key.
      Parameters:
      dialog - the dialog to install the escape close on