Package dialog

Class DialogPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
AboutPanel, DomainsPanel, FormatPanel, TerminalPanel

public class DialogPanel extends JPanel
Class for a panel for dialogs.
Since:
2007.07.07
See Also:
  • Field Details

    • BOLD

      public static final Font BOLD
      the font for input text fields
    • SMALL

      public static final Font SMALL
      the font for help text fields
    • LEFT

      public static final GridBagConstraints LEFT
      the grid bag constraints for labels
    • MIDDLE

      public static final GridBagConstraints MIDDLE
      the grid bag constraints for middle input fields
    • HALF

      public static final GridBagConstraints HALF
      the grid bag constraints for middle input fields
    • FILL

      public static final GridBagConstraints FILL
      the grid bag constraints for fillers
    • buf

      protected StringBuilder buf
      the buffer for reading a configuration file
    • chooser

      protected JFileChooser chooser
      the file chooser
  • Constructor Details

    • DialogPanel

      public DialogPanel()
      Create a dialog panel.
      Since:
      2007.07.07 (Christian Borgelt)
  • Method Details

    • add

      public void add(Component comp, GridBagConstraints gbc)
      Add a component.
      Parameters:
      comp - the component to add
      gbc - the grid bag constraints to use
      Since:
      2007.07.07 (Christian Borgelt)
    • addHelp

      public JTextArea addHelp(String text)
      Add a help text.
      Parameters:
      text - the help text
      Returns:
      the added text area for the help text
      Since:
      2007.07.07 (Christian Borgelt)
    • addFiller

      public void addFiller(int height)
      Add a filler.
      Parameters:
      height - the height of the filler
      Since:
      2007.07.07 (Christian Borgelt)
    • addLabel

      public JLabel addLabel(String text)
      Add a label to a tab.
      Parameters:
      text - the text of the label
      Returns:
      the label that has been added
      Since:
      2007.07.07 (Christian Borgelt)
    • addLabel

      public JLabel addLabel(String text, GridBagConstraints gbc)
      Add a label to a tab.
      Parameters:
      text - the text of the label
      gbc - the grid bag constraints to use
      Returns:
      the label that has been added
      Since:
      2007.07.07 (Christian Borgelt)
    • addButton

      public JButton addButton(String text)
      Add a button to a tab.
      Parameters:
      text - the text of the button
      Returns:
      the button that has been added
      Since:
      2007.07.07 (Christian Borgelt)
    • addButton

      public JButton addButton(String text, GridBagConstraints gbc)
      Add a button to a tab.
      Parameters:
      text - the text of the button
      gbc - the grid bag constraints to use
      Returns:
      the button that has been added
      Since:
      2007.07.07 (Christian Borgelt)
    • addTextInput

      public JTextField addTextInput(String text)
      Add a text input field to a tab.
      Parameters:
      text - the initial text of the text input field
      Returns:
      the created JTextField
      Since:
      2007.07.07 (Christian Borgelt)
    • addTextInput

      public JTextField addTextInput(String text, GridBagConstraints gbc)
      Add a text input field to a tab.
      Parameters:
      text - the initial text of the text input field
      gbc - the grid bag constraints to use
      Returns:
      the created JTextField
      Since:
      2007.07.07 (Christian Borgelt)
    • createNumberInput

      public static JTextField createNumberInput(String text)
      Create a number input field.
      Parameters:
      text - the initial text of the input field
      Returns:
      the created JFormattedTextField
      Since:
      2007.07.07 (Christian Borgelt)
    • addNumberInput

      public JTextField addNumberInput(String text)
      Add a text input field to a tab.
      Parameters:
      text - the initial text of the text input field
      Returns:
      the created JFormattedTextField
      Since:
      2007.07.07 (Christian Borgelt)
    • addNumberInput

      public JTextField addNumberInput(String text, GridBagConstraints gbc)
      Add a text input field to a tab.
      Parameters:
      text - the initial text of the text input field
      gbc - the grid bag constraints to use
      Returns:
      the created JFormattedTextField
      Since:
      2007.07.07 (Christian Borgelt)
    • addFileInput

      public JTextField addFileInput(String text)
      Add a file input field to a tab.
      Parameters:
      text - the initial text of the file input field
      Returns:
      the created JTextField
      Since:
      2007.07.07 (Christian Borgelt)
    • addFileInput

      public JTextField addFileInput(String text, GridBagConstraints gbc)
      Add a text input field to a tab.
      Parameters:
      text - the initial text of the file input field
      gbc - the grid bag constraints to use
      Returns:
      the created JTextField
      Since:
      2007.07.07 (Christian Borgelt)
    • addCheckBox

      public JCheckBox addCheckBox(boolean state)
      Add a check box to a tab.
      Parameters:
      state - the initial state of the check box
      Returns:
      the created JCheckBox
      Since:
      2007.07.07 (Christian Borgelt)
    • addCheckBox

      public JCheckBox addCheckBox(boolean state, GridBagConstraints gbc)
      Add a check box to a tab.
      Parameters:
      state - the initial state of the check box
      gbc - the grid bag constraints to use
      Returns:
      the created JCheckBox
      Since:
      2007.07.07 (Christian Borgelt)
    • addCheckBox

      public JCheckBox addCheckBox(String text, boolean state)
      Add a check box to a tab.
      Parameters:
      text - the text of the check box
      state - the initial state of the check box
      Returns:
      the created JCheckBox
      Since:
      2007.07.07 (Christian Borgelt)
    • addCheckBox

      public JCheckBox addCheckBox(String text, boolean state, GridBagConstraints gbc)
      Add a check box to a tab.
      Parameters:
      text - the text of the check box
      state - the initial state of the check box
      gbc - the grid bag constraints to use
      Returns:
      the created JCheckBox
      Since:
      2007.07.07 (Christian Borgelt)
    • addComboBox

      public JComboBox<String> addComboBox(String[] items)
      Add a combo box to a tab.
      Parameters:
      items - the list of items
      Returns:
      the created JComboBox
      Since:
      2007.07.07 (Christian Borgelt)
    • addComboBox

      public JComboBox<String> addComboBox(String[] items, GridBagConstraints gbc)
      Add a combo box to a tab.
      Parameters:
      items - the list of items
      gbc - the grid bag constraints to use
      Returns:
      the created JComboBox
      Since:
      2007.07.07 (Christian Borgelt)
    • addSpinner

      public JSpinner addSpinner(int val, int min, int max, int step)
      Add a spinner to a tab.
      Parameters:
      val - the initial value
      min - the minimal value
      max - the maximal value
      step - the step size
      Returns:
      the created JSpinner
      Since:
      2007.07.07 (Christian Borgelt)
    • addSpinner

      public JSpinner addSpinner(int val, int min, int max, int step, GridBagConstraints gbc)
      Add a combo box to a tab.
      Parameters:
      val - the initial value
      min - the minimal value
      max - the maximal value
      step - the step size
      gbc - the grid bag constraints to use
      Returns:
      the created JSpinner
      Since:
      2007.07.07 (Christian Borgelt)
    • getFileChooser

      public JFileChooser getFileChooser()
      Get the file chooser.
      Returns:
      the file chooser
      Since:
      2007.02.12 (Christian Borgelt)
    • getFileName

      public File getFileName(JTextField text)
      Get a file name and store it in a text field.
      Parameters:
      text - the text field in which to store the file name
      Returns:
      the selected file or null if cancelled
      Since:
      2007.02.12 (Christian Borgelt)
    • getFileName

      public File getFileName(JTextField text, String title)
      Get a file name and store it in a text field.
      Parameters:
      text - the text field in which to store the file name
      title - the title of the file chooser dialog
      Returns:
      the selected file or null if cancelled
      Since:
      2007.07.26 (Christian Borgelt)
    • showTable

      public void showTable(JTextField text, FormatPanel format)
      Show a data table (to be read from a file).
      Parameters:
      text - the text field containing the file name
      format - the panel for the data format (if any)
      Since:
      2007.02.12 (Christian Borgelt)
    • showTable

      public void showTable(File file, FormatPanel format)
      Show a data table (to be read from a file).
      Parameters:
      file - the file containing the data table
      format - the panel for the data format (if any)
      Since:
      2007.02.12 (Christian Borgelt)
    • editDomains

      public void editDomains(JTextField text)
      Edit domain descriptions.
      Parameters:
      text - the text field containing the file name
      Since:
      2007.07.24 (Christian Borgelt)
    • editDomains

      public void editDomains(File file)
      Edit domain descriptions.
      Parameters:
      file - the file containing the domain descriptions to edit
      Since:
      2007.07.24 (Christian Borgelt)
    • editFile

      public void editFile(JTextField text)
      Edit a text file.
      Parameters:
      text - the text field containing the file name
      Since:
      2007.02.12 (Christian Borgelt)
    • editFile

      public void editFile(File file)
      Edit a text file.
      Parameters:
      file - the file to edit
      Since:
      2007.05.09 (Christian Borgelt)
    • readLine

      protected String readLine(FileReader reader) throws IOException
      Read a line (of the configuration file).
      Parameters:
      reader - the reader to read from
      Returns:
      the line read
      Throws:
      IOException - if an i/o error occurs or no line could be read
      Since:
      2013.11.26 (Christian Borgelt) (transferred from DialogPanel)
    • readInt

      protected int readInt(FileReader reader) throws IOException
      Read an integer value (from the configuration file).
      Parameters:
      reader - the reader to read from
      Returns:
      the integer value read
      Throws:
      IOException - if an i/o error occurs or no field could be read
      Since:
      2013.11.26 (Christian Borgelt) (transferred from DialogPanel)