Class InternalWindow

All Implemented Interfaces:
ComponentPaintCache.Cacheable, ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
InternalManagedWindow

public class InternalWindow extends JPanel implements ComponentPaintCache.Cacheable
A window like panel component with a title bar and optional close and minimize buttons.
See Also:
Serialized Form
  • Method Details

    • addCloseListener

      public void addCloseListener(InternalWindow.CloseListener listener)
      Add a close listener to the window. All the listeners will be notified when this window is closed.
      Parameters:
      listener - new listener
    • setContent

      public void setContent(JComponent content)
      Set the content of the window. The minimum width of the title bar is determined at this stage, so usually you should defer setting the window contents until the content component has been fully constructed.
      Parameters:
      content - window content
    • setCloseable

      public void setCloseable(boolean closeable)
      Make the window closeable by the user by showing or hiding the close button.
      Parameters:
      closeable - true if the window should have a close button, otherwise false
    • setHideOnClose

      public void setHideOnClose(boolean hide)
      Set closing policy. Normally windows delete themselves on close, but setting the policy to hiding just makes it invisible.
      Parameters:
      hide - if true, the window will hide itself when the user closes it, otherwise the window is deleted on close
    • setMinimizable

      public void setMinimizable(boolean minimizable)
      Make the window minimizable by the user by showing or hiding the minimize button.
      Parameters:
      minimizable - true if the window should have a minimize button, otherwise false
    • isMinimized

      public boolean isMinimized()
      Get the minimization status of the window.
      Returns:
      true if the window is minimized, false otherwise
    • setMinimized

      public void setMinimized(boolean minimized)
      Set the minimization status of the window.
      Parameters:
      minimized - true to minimize the window, false to restore it
    • getTitlebar

      protected JComponent getTitlebar()
      Get the title bar component.
      Returns:
      title bar
    • setTitle

      public final void setTitle(String title)
      Set the window title.
      Parameters:
      title - title text
    • close

      public void close()
      Close the window. Either deletes or hides it, according to the policy set with setHideOnClose(boolean).
    • paint

      public void paint(Graphics g)
      Overrides:
      paint in class JComponent
    • paintComponent

      public void paintComponent(Graphics g)
      Description copied from interface: ComponentPaintCache.Cacheable
      Paint the component.
      Specified by:
      paintComponent in interface ComponentPaintCache.Cacheable
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g - graphics
    • paintBorder

      public void paintBorder(Graphics g)
      Description copied from interface: ComponentPaintCache.Cacheable
      Paint the component border.
      Specified by:
      paintBorder in interface ComponentPaintCache.Cacheable
      Overrides:
      paintBorder in class JComponent
      Parameters:
      g - graphics
    • paintChildren

      public void paintChildren(Graphics g)
      Description copied from interface: ComponentPaintCache.Cacheable
      Paint everything, including the child components.
      Specified by:
      paintChildren in interface ComponentPaintCache.Cacheable
      Overrides:
      paintChildren in class JComponent
      Parameters:
      g - graphics