Class SimpleInternalFrame

  • All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable, Accessible

    public class SimpleInternalFrame
    extends JPanel
    A JPanel subclass that has a drop shadow border and that provides a header with icon, title and tool bar. This class can be used to replace the JInternalFrame, for use outside of a JDesktopPane. The SimpleInternalFrame is less flexible but often more usable; it avoids overlapping windows and scales well up to IDE size. Several customers have reported that they and their clients feel much better with both the appearance and the UI feel. The SimpleInternalFrame provides the following bound properties: frameIcon, title, toolBar, content, selected. By default the SimpleInternalFrame is in selected state. If you don't do anything, multiple simple internal frames will be displayed as selected.
    Author:
    Karsten Lentzsch
    See Also:
    JInternalFrame, JDesktopPane, Serialized Form
    • Constructor Detail

      • SimpleInternalFrame

        public SimpleInternalFrame()
      • SimpleInternalFrame

        public SimpleInternalFrame​(String title)
        Constructs a SimpleInternalFrame with the specified title.
        Parameters:
        title - the initial title
      • SimpleInternalFrame

        public SimpleInternalFrame​(Icon icon,
                                   String title)
        Constructs a SimpleInternalFrame with the specified icon, and title.
        Parameters:
        icon - the initial icon
        title - the initial title
      • SimpleInternalFrame

        public SimpleInternalFrame​(String title,
                                   JToolBar bar,
                                   JComponent content)
        Constructs a SimpleInternalFrame with the specified title, tool bar, and content panel.
        Parameters:
        title - the initial title
        bar - the initial tool bar
        content - the initial content pane
      • SimpleInternalFrame

        public SimpleInternalFrame​(Icon icon,
                                   String title,
                                   JToolBar bar,
                                   JComponent content)
        Constructs a SimpleInternalFrame with the specified icon, title, tool bar, and content panel.
        Parameters:
        icon - the initial icon
        title - the initial title
        bar - the initial tool bar
        content - the initial content pane
    • Method Detail

      • getFrameIcon

        public Icon getFrameIcon()
        Returns the frame's icon.
        Returns:
        the frame's icon
      • setFrameIcon

        public void setFrameIcon​(Icon newIcon)
        Sets a new frame icon.
        Parameters:
        newIcon - the icon to be set
      • getTitle

        public String getTitle()
        Returns the frame's title text.
        Returns:
        String the current title text
      • setTitle

        public void setTitle​(String newText)
        Sets a new title text.
        Parameters:
        newText - the title text tp be set
      • getToolBar

        public JToolBar getToolBar()
        Returns the current toolbar, null if none has been set before.
        Returns:
        the current toolbar - if any
      • setToolBar

        public void setToolBar​(JToolBar newToolBar)
        Sets a new tool bar in the header.
        Parameters:
        newToolBar - the tool bar to be set in the header
      • getContent

        public Component getContent()
        Returns the content - null, if none has been set.
        Returns:
        the current content
      • setContent

        public void setContent​(Component newContent)
        Sets a new panel content; replaces any existing content, if existing.
        Parameters:
        newContent - the panel's new content
      • isSelected

        public boolean isSelected()
        Answers if the panel is currently selected (or in other words active) or not. In the selected state, the header background will be rendered differently.
        Returns:
        boolean a boolean, where true means the frame is selected (currently active) and false means it is not
      • setSelected

        public void setSelected​(boolean newValue)
        This panel draws its title bar differently if it is selected, which may be used to indicate to the user that this panel has the focus, or should get more attention than other simple internal frames.
        Parameters:
        newValue - a boolean, where true means the frame is selected (currently active) and false means it is not
      • updateUI

        public void updateUI()
        Updates the UI. In addition to the superclass behavior, we need to update the header component.
        Overrides:
        updateUI in class JPanel
      • getTextForeground

        protected Color getTextForeground​(boolean selected)
        Determines and answers the header's text foreground color. Tries to lookup a special color from the L&F. In case it is absent, it uses the standard internal frame forground.
        Parameters:
        selected - true to lookup the active color, false for the inactive
        Returns:
        the color of the foreground text
      • getHeaderBackground

        protected Color getHeaderBackground()
        Determines and answers the header's background color. Tries to lookup a special color from the L&F. In case it is absent, it uses the standard internal frame background.
        Returns:
        the color of the header's background