Class JComponentFactory


  • public class JComponentFactory
    extends java.lang.Object
    The class JComponentFactory provides factory methods for create swing Component objects
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.awt.Frame newFrame​(java.lang.String title)  
      static javax.help.HelpSet newHelpSet​(java.lang.String directoryPath, java.lang.String filename)
      Factory method for create new HelpSet object.
      static javax.swing.JInternalFrame newInternalFrame​(java.lang.String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)
      Factory method for create a JInternalFrame object.
      static javax.swing.JButton newJButton​(java.lang.String text)  
      static javax.swing.JEditorPane newJEditorPane​(java.lang.String contentType, boolean editable)  
      static javax.swing.JMenuItem newJMenuItem​(@NonNull java.lang.String text, int mnemonic, char accelerator)
      Factory method for create a JMenuItem.
      static javax.swing.JPopupMenu newJPopupMenu()
      Factory method for create a JPopupMenu.
      static javax.swing.JPopupMenu newJPopupMenu​(java.awt.Component component, javax.swing.JMenuItem... items)
      Factory method for create a JPopupMenu that will be add a MouseListener to the given Component and an array of JMenuItem that will be added to the popup.
      static javax.swing.JPopupMenu newJPopupMenu​(java.lang.String label)
      Factory method for create a JPopupMenu with the specified title.
      static javax.swing.JPopupMenu newJPopupMenu​(java.lang.String label, java.awt.Component component, javax.swing.JMenuItem... items)
      Factory method for create a JPopupMenu that will be add a MouseListener to the given Component and an array of JMenuItem that will be added to the popup.
      static javax.swing.JSplitPane newJSplitPane​(int newOrientation, boolean newContinuousLayout, java.awt.Component newLeftComponent, java.awt.Component newRightComponent)
      Factory method for create new JSplitPane object
      static javax.swing.JSplitPane newJSplitPane​(int newOrientation, java.awt.Component newLeftComponent, java.awt.Component newRightComponent)
      Factory method for create new JSplitPane object
      static javax.swing.JSplitPane newJSplitPane​(java.awt.Component newLeftComponent, java.awt.Component newRightComponent)
      Factory method for create new JSplitPane object
      static javax.swing.JToolBar newJToolBar()
      Factory method for create a JToolBar object.
      static java.awt.PopupMenu newPopupMenu​(java.util.List<MenuItemBean> menuItemBeans)
      Factory method for create a PopupMenu object.
      static SplashScreen newSplashScreen​(java.lang.String image, java.lang.String text)
      Factory method for create a SplashScreen.
      static java.awt.TrayIcon newTrayIcon​(java.lang.String imgFilename, java.lang.String appName, java.awt.PopupMenu systemTrayPopupMenu, java.util.Map<java.lang.String,​java.awt.event.ActionListener> actionListeners)
      Factory method for create a TrayIcon object.
      • Methods inherited from class java.lang.Object

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

      • JComponentFactory

        public JComponentFactory()
    • Method Detail

      • newFrame

        public static java.awt.Frame newFrame​(java.lang.String title)
      • newJEditorPane

        public static javax.swing.JEditorPane newJEditorPane​(java.lang.String contentType,
                                                             boolean editable)
      • newJButton

        public static javax.swing.JButton newJButton​(java.lang.String text)
      • newJSplitPane

        public static javax.swing.JSplitPane newJSplitPane​(java.awt.Component newLeftComponent,
                                                           java.awt.Component newRightComponent)
        Factory method for create new JSplitPane object
        Parameters:
        newLeftComponent - the Component that will appear on the left of a horizontally-split pane, or at the top of a vertically-split pane
        newRightComponent - the Component that will appear on the right of a horizontally-split pane, or at the bottom of a vertically-split pane
        Returns:
        the new JSplitPane object
      • newJSplitPane

        public static javax.swing.JSplitPane newJSplitPane​(int newOrientation,
                                                           java.awt.Component newLeftComponent,
                                                           java.awt.Component newRightComponent)
        Factory method for create new JSplitPane object
        Parameters:
        newOrientation - JSplitPane.HORIZONTAL_SPLIT or JSplitPane.VERTICAL_SPLIT
        newLeftComponent - the Component that will appear on the left of a horizontally-split pane, or at the top of a vertically-split pane
        newRightComponent - the Component that will appear on the right of a horizontally-split pane, or at the bottom of a vertically-split pane
        Returns:
        the new JSplitPane object
      • newJSplitPane

        public static javax.swing.JSplitPane newJSplitPane​(int newOrientation,
                                                           boolean newContinuousLayout,
                                                           java.awt.Component newLeftComponent,
                                                           java.awt.Component newRightComponent)
        Factory method for create new JSplitPane object
        Parameters:
        newOrientation - JSplitPane.HORIZONTAL_SPLIT or JSplitPane.VERTICAL_SPLIT
        newContinuousLayout - a boolean, true for the components to redraw continuously as the divider changes position, false to wait until the divider position stops changing to redraw
        newLeftComponent - the Component that will appear on the left of a horizontally-split pane, or at the top of a vertically-split pane
        newRightComponent - the Component that will appear on the right of a horizontally-split pane, or at the bottom of a vertically-split pane
        Returns:
        the new JSplitPane object
      • newHelpSet

        public static javax.help.HelpSet newHelpSet​(java.lang.String directoryPath,
                                                    java.lang.String filename)
                                             throws javax.help.HelpSetException
        Factory method for create new HelpSet object.
        Parameters:
        directoryPath - the directory path
        filename - the filename
        Returns:
        the new HelpSet object
        Throws:
        javax.help.HelpSetException - is thrown if there are problems parsing the HelpSet object.
      • newInternalFrame

        public static javax.swing.JInternalFrame newInternalFrame​(java.lang.String title,
                                                                  boolean resizable,
                                                                  boolean closable,
                                                                  boolean maximizable,
                                                                  boolean iconifiable)
        Factory method for create a JInternalFrame object.
        Parameters:
        title - the title
        resizable - the resizable
        closable - the closable
        maximizable - the maximizable
        iconifiable - the iconifiable
        Returns:
        the new JInternalFrame.
      • newJMenuItem

        public static javax.swing.JMenuItem newJMenuItem​(@NonNull
                                                         @NonNull java.lang.String text,
                                                         int mnemonic,
                                                         char accelerator)
        Factory method for create a JMenuItem.
        Parameters:
        text - the text of the JMenuItem
        mnemonic - the keyboard mnemonic for the JMenuItem
        accelerator - The character that have to push together with the CTRL.
        Returns:
        the new JMenuItem
      • newJPopupMenu

        public static javax.swing.JPopupMenu newJPopupMenu()
        Factory method for create a JPopupMenu.
        Returns:
        the new JPopupMenu.
      • newJPopupMenu

        public static javax.swing.JPopupMenu newJPopupMenu​(java.awt.Component component,
                                                           javax.swing.JMenuItem... items)
        Factory method for create a JPopupMenu that will be add a MouseListener to the given Component and an array of JMenuItem that will be added to the popup.
        Parameters:
        component - the component
        items - the JMenuItems
        Returns:
        the new JPopupMenu.
      • newJPopupMenu

        public static javax.swing.JPopupMenu newJPopupMenu​(java.lang.String label)
        Factory method for create a JPopupMenu with the specified title.
        Parameters:
        label - the string that a UI may use to display as a title for the popup menu.
        Returns:
        the new JPopupMenu.
      • newJPopupMenu

        public static javax.swing.JPopupMenu newJPopupMenu​(java.lang.String label,
                                                           java.awt.Component component,
                                                           javax.swing.JMenuItem... items)
        Factory method for create a JPopupMenu that will be add a MouseListener to the given Component and an array of JMenuItem that will be added to the popup.
        Parameters:
        label - the label
        component - the component
        items - the JMenuItems
        Returns:
        the new JPopupMenu.
      • newJToolBar

        public static javax.swing.JToolBar newJToolBar()
        Factory method for create a JToolBar object.
        Returns:
        the j tool bar
      • newPopupMenu

        public static java.awt.PopupMenu newPopupMenu​(java.util.List<MenuItemBean> menuItemBeans)
        Factory method for create a PopupMenu object.
        Parameters:
        menuItemBeans - the menu item beans
        Returns:
        the new PopupMenu.
      • newSplashScreen

        public static SplashScreen newSplashScreen​(java.lang.String image,
                                                   java.lang.String text)
        Factory method for create a SplashScreen.
        Parameters:
        image - the image
        text - the text
        Returns:
        the new SplashScreen.
      • newTrayIcon

        public static java.awt.TrayIcon newTrayIcon​(java.lang.String imgFilename,
                                                    java.lang.String appName,
                                                    java.awt.PopupMenu systemTrayPopupMenu,
                                                    java.util.Map<java.lang.String,​java.awt.event.ActionListener> actionListeners)
        Factory method for create a TrayIcon object.
        Parameters:
        imgFilename - the img filename
        appName - the app name
        systemTrayPopupMenu - the system tray popup menu
        actionListeners - the action listeners
        Returns:
        the new TrayIcon.