Class JAboutBox

All Implemented Interfaces:
ActionListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class JAboutBox extends JDefaultDialog
The JAboutBox class provides a modal dialog box containing general application information.

Note that a valid I18NL10N database must be available!

The dialog box is modal, non-resizable and contains an "Ok" button to close it. Here's an example of a complete about box (Microsoft Windows L&F):

As seen in the above image, there can be up to four different tabs: the first tab contains the application's logo and its accompanying about text, the second tab contains a copyright notice (see second image below), the third tab contains the licence information (see third image below) and the fourth tab contains the author's affiliations (see third image below).

Typically, JAboutBox is subclassed, with several methods overridden, allow customisation of each of the previously shown four tabs. The overrideable methods that control these aspects of the visual layout of the dialog box are:

In the first tab, the amount of free memory available to the Java Virtual Machine is also shown.

Finally, if either setupCopyrightContent(), setupLicenceContent(), or setupAffiliationsLabels() returns null, then its corresponding tab is not shown.

Version:
09/05/2024
Author:
Sven Maerivoet
See Also:
  • Field Details

    • fResources

      protected JARResources fResources
      Provides access to an application's resources.
  • Constructor Details

    • JAboutBox

      public JAboutBox(JFrame owner)
      Constructs a JAboutBox object.

      The about box is inactive at the end of the constructor, so it should explicitly shown using the JDefaultDialog.activate() method.
      It's also modal, has a fixed size and a standard "Ok" button.

      Parameters:
      owner - the owner of the frame in which this about box is to be displayed
    • JAboutBox

      public JAboutBox(JFrame owner, JARResources resources)
      Constructs a JAboutBox object.

      The about box is inactive at the end of the constructor, so it should explicitly shown using the JDefaultDialog.activate() method.
      It's also modal, has a fixed size and a standard "Ok" button.

      Parameters:
      owner - the owner of the frame in which this about box is to be displayed
      resources - the parent application's resources that can be accessed by this JAboutBox
  • Method Details

    • setupLogo

      protected JLabel setupLogo()
      Sets up a JLabel containing the application's logo.

      A typical logo can span up to 500x200 pixels (when positioned at the top) or 200x300 pixels (when positioned at the left).

      This method returns null by default, so in order to obtain a custom logo, the caller should override this method.

      Returns:
      a JLabel containing the application's logo
    • setupLogoPosition

      protected JAboutBox.ELogoPosition setupLogoPosition()
      Sets up an ELogoPosition indicating where the application's logo should be relative to its accompanying about text.

      See also JAboutBox.ELogoPosition.

      The default is JAboutBox.ELogoPosition.kTop.

      Returns:
      an ELogoPosition indicating the application's logo's position
    • setupAboutText

      protected String setupAboutText()
      Sets up a String containing the about text displayed together with the application's logo.

      In order to have some control over the copyright notice's layout, HTML tags are allowed (except the starting <HTML> and ending </HTML> tags which are implicitly given by the about box).

      This method returns null by default, so in order to obtain a custom text, the caller should override this method.

      Returns:
      a String containing the about text
    • setupCopyrightContent

      protected StringBuilder setupCopyrightContent()
      Sets up a StringBuilder containing the short application's copyright notice.

      In order to have some control over the copyright notice's layout, HTML tags are allowed (except the starting <HTML> and ending </HTML> tags which are implicitly given by the about box).

      This method returns null by default, so in order to obtain a custom copyright notice, the caller should override this method.

      If no explicit content is given, the tab containing the copyright notice will not be displayed in the about box.

      Returns:
      a StringBuffer containing the application's copyright notice
    • setupLicenceContent

      protected StringBuilder setupLicenceContent()
      Sets up a StringBuilder containing the (long) application's licence text (e.g., the Apache Licence).

      This method returns null by default, so in order to obtain a custom licence text, the caller should override this method.

      Note that the content should only be plain text without HTML tages.

      If no explicit content is given, the tab containing the licence text will not be displayed in the about box.

      Returns:
      a StringBuffer containing the application's licence text
    • setupAffiliationsLabels

      protected ArrayList<JLabel> setupAffiliationsLabels()
      Sets up a list of JLabels containing the author's affiliations.

      This method returns null by default, so in order to obtain custom affiliations, the caller should override this method.

      The given affiliations are JLabels that can contain text and/or images.

      If no explicit affiliations are given, the tab containing them will not be displayed in the about box.

      Returns:
      a list of JLabels containing the author's affiliations
    • setupUsedLibrariesDescriptions

      protected String setupUsedLibrariesDescriptions()
      Sets up a String describing the application's used libraries.

      This method returns null by default, so in order to obtain custom affiliations, the caller should override this method.

      Returns:
      a String describing the application's used libraries
    • initialiseClass

      protected final void initialiseClass(Object[] parameters)
      Performs custom initialisation of the about box's member fields.

      Note that this method cannot be overridden!

      Overrides:
      initialiseClass in class JDefaultDialog
      Parameters:
      parameters - internally fixed to the parent application's resources
    • setupWindowTitle

      protected final String setupWindowTitle()
      Sets up the window title of the about box.

      Note that this method cannot be overridden!

      Overrides:
      setupWindowTitle in class JDefaultDialog
      Returns:
      the window title of the dialog box
    • setupMainPanel

      protected final void setupMainPanel(JPanel mainPanel)
      Sets up the about box content area.

      Note that this method cannot be overridden!

      Overrides:
      setupMainPanel in class JDefaultDialog
      Parameters:
      mainPanel - the area of the dialog box that is reserved for custom content
    • initialiseDuringActivation

      protected final void initialiseDuringActivation()
      Performs custom initialisation during the about box's activation.

      Note that this method cannot be overridden!

      Overrides:
      initialiseDuringActivation in class JDefaultDialog
      See Also: