Class SwingHelper


  • public class SwingHelper
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      SwingHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.swing.JButton addButton​(java.awt.Window frame, java.lang.String text, int x, int y, int width, int height)
      Adds a JButton to a Window.
      static javax.swing.JComboBox<java.lang.Object> addComboBox​(java.awt.Window frame, int x, int y, int width, int height)
      Adds a JComboBox to a Window.
      static javax.swing.JLabel addLabel​(java.awt.Window frame, java.lang.String text, int x, int y, int width, int height)
      Adds a JLabel to a Window.
      static java.awt.Component addScrollPane​(java.awt.Window frame, java.awt.Component c)
      Adds a JScrollPane to a Window.
      static javax.swing.JTextArea addTextArea​(java.awt.Window frame, java.lang.String text, boolean editable, int x, int y, int width, int height)
      Adds a JTextArea to a Window.
      static javax.swing.JTextField addTextBox​(java.awt.Window frame, java.lang.String text, boolean editable, int x, int y, int width, int height)
      Adds a JTextField to a Window.
      static javax.swing.JTextArea alwaysUpdateCaret​(javax.swing.JTextArea area)
      Sets a policy to always update the default caret of a JTextArea.
      static javax.swing.JDialog createNewDialog​(java.awt.Dimension dimension, java.lang.String title)
      Creates a new JDialog.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SwingHelper

        public SwingHelper()
    • Method Detail

      • addButton

        public static javax.swing.JButton addButton​(java.awt.Window frame,
                                                    java.lang.String text,
                                                    int x,
                                                    int y,
                                                    int width,
                                                    int height)
        Adds a JButton to a Window.
        Parameters:
        frame - The Window to add the JButton to.
        text - The text of the JButton.
        x - The X coordinate of the JButton.
        y - The Y coordinate of the JButton.
        width - The width of the JButton.
        height - The height of the JButton.
        Returns:
        The newly created JButton.
      • addTextBox

        public static javax.swing.JTextField addTextBox​(java.awt.Window frame,
                                                        java.lang.String text,
                                                        boolean editable,
                                                        int x,
                                                        int y,
                                                        int width,
                                                        int height)
        Adds a JTextField to a Window.
        Parameters:
        frame - The Window to add the JTextField to.
        text - The text of the JTextField.
        editable - Whether or not the JTextField is editable.
        x - The X coordinate of the JTextField.
        y - The Y coordinate of the JTextField.
        width - The width of the JTextField.
        height - The height of the JTextField.
        Returns:
        The newly created JTextField.
      • addLabel

        public static javax.swing.JLabel addLabel​(java.awt.Window frame,
                                                  java.lang.String text,
                                                  int x,
                                                  int y,
                                                  int width,
                                                  int height)
        Adds a JLabel to a Window.
        Parameters:
        frame - The Window to add the JLabel to.
        text - The text of the JLabel.
        x - The X coordinate of the JLabel.
        y - The Y coordinate of the JLabel.
        width - The width of the JLabel.
        height - The height of the JLabel.
        Returns:
        The newly created JLabel.
      • addTextArea

        public static javax.swing.JTextArea addTextArea​(java.awt.Window frame,
                                                        java.lang.String text,
                                                        boolean editable,
                                                        int x,
                                                        int y,
                                                        int width,
                                                        int height)
        Adds a JTextArea to a Window.
        Parameters:
        frame - The Window to add the JTextArea to.
        text - The text of the JTextArea.
        editable - Whether or not the JTextArea is editable.
        x - The X coordinate of the JTextArea.
        y - The Y coordinate of the JTextArea.
        width - The width of the JTextArea.
        height - The height of the JTextArea.
        Returns:
        The newly created JTextArea.
      • addComboBox

        public static javax.swing.JComboBox<java.lang.Object> addComboBox​(java.awt.Window frame,
                                                                          int x,
                                                                          int y,
                                                                          int width,
                                                                          int height)
        Adds a JComboBox to a Window.
        Parameters:
        frame - The Window to add the JComboBox to.
        x - The X coordinate of the JComboBox.
        y - The Y coordinate of the JComboBox.
        width - The width of the JComboBox.
        height - The height of the JComboBox.
        Returns:
        The newly created JComboBox.
      • addScrollPane

        public static java.awt.Component addScrollPane​(java.awt.Window frame,
                                                       java.awt.Component c)
        Adds a JScrollPane to a Window.
        Parameters:
        frame - The Window to add the JScrollPane to.
        c - The Component to apply the JScrollPane to.
        Returns:
        The Component with the newly created JScrollPane.
      • alwaysUpdateCaret

        public static javax.swing.JTextArea alwaysUpdateCaret​(javax.swing.JTextArea area)
        Sets a policy to always update the default caret of a JTextArea.
        Parameters:
        area - The JTextArea to apply the policy to.
        Returns:
        The JTextArea with the newly set policy.
      • createNewDialog

        public static javax.swing.JDialog createNewDialog​(java.awt.Dimension dimension,
                                                          java.lang.String title)
        Creates a new JDialog.
        Parameters:
        dimension - The dimensions of the JDialog.
        title - The title of the JDialog.
        Returns:
        The newly created JDialog.