Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.javathis.utilities.ui
Class JTOrnateAboutBox  view JTOrnateAboutBox download JTOrnateAboutBox.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Dialog
                  extended byjavax.swing.JDialog
                      extended bycom.javathis.utilities.ui.JTOrnateAboutBox
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class JTOrnateAboutBox
extends javax.swing.JDialog

Provides a Windows XP style About box that can be used consistenly across multiple applications.

It has Four areas. A banner at the top, a icon at the left, text information at the right, and the button bar at the bottom.

      _________________________________________________________
      |O|___________________________________________________|X|
      |                                                       |
      |                 B A N N E R  A R E A                  |
      |_______________________________________________________|
      |               |                                       |
      |     +----+    |  N A M E                              |
      |     |ICON|    |  V E R S I O N                        |
      |     +----+    |  COPYRIGHT  (1)                       |
      |               |             (2)                       |
      |               |             (3)                       |
      |               |  L I C E N S E  C O M M E N T         |
      |               |  L I C E N S E  D E T A I L S ''''''' |
      |               |  '                                  ' |
      |               |  '                                  ' |
      |               |  '                                  ' |
      |_______________|__'__________________________________'_|
      |                                               [ OK ]  |
      |_______________________________________________________|
 

Requirements:

Banner cannot be larger than 414 x 76.
Icon must be 32 x 32.
A IllegalArgumentException will be thrown is the images are not in compliance.

Limitations:

Name, Version, and License Comment fields are single lines that can contain between 30 - 50 characters depending on the charcters used.
Copyright field is multilined. It will word wrap if needed. Recommended that the string include returns and or tabs where needed for formating. It only can hold 3 lines, all other lines will not be shown.
License Details is a multiline, scroll when needed, field.

Note: If information is not provided for a field/area it will be set to it's default value. Passing a null value will reset the field/area to it's default value. If you want an area to be displayed as empty, use an empty string for the field. Exceptions to this are the Banner, and Icon areas. An image is required for these areas. If you do not want to show an image in the banner or icon area please use the methods noBanner(boolean), and/or noIcon(boolean). The corresponding area will be blank.


Nested Class Summary
 
Nested classes inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Nested classes inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  java.awt.Font aboutFont
           
private static java.awt.Dimension BANNER_SIZE
           
private  java.io.File bannerFile
           
private  javax.swing.JLabel bannerLabel
           
private  javax.swing.JPanel bannerPanel
           
private  java.awt.BorderLayout borderLayout1
           
private  javax.swing.JPanel buttonPanel
           
private  java.lang.String copyright
           
private static java.awt.Dimension COPYRIGHT_SIZE
           
private  javax.swing.JTextPane copyrightTextPane
           
private static java.net.URL DEFAULT_BANNER_URL
           
private static java.lang.String DEFAULT_COPYRIGHT
           
private static java.awt.Dimension DEFAULT_DIALOG_SIZE
           
private static java.net.URL DEFAULT_ICON_URL
           
private static java.lang.String DEFAULT_LICENSE_COMMENT
           
private static java.lang.String DEFAULT_LICENSE_DETAILS
           
private static java.lang.String DEFAULT_NAME
           
private static java.lang.String DEFAULT_TITLE
           
private static java.lang.String DEFAULT_VERSION
           
private static java.net.URL EMPTY_BANNER
           
private static java.net.URL EMPTY_ICON
           
private  java.awt.GridBagLayout gridBagLayout1
           
private  java.awt.GridBagLayout gridBagLayout2
           
private static java.awt.Dimension ICON_SIZE
           
private  java.io.File iconFile
           
private  javax.swing.JLabel iconLabel
           
private  javax.swing.JPanel iconPanel
           
private  java.lang.String licenseComment
           
private  javax.swing.JLabel licenseCommentLabel
           
private  java.lang.String licenseDetails
           
private  javax.swing.JScrollPane licenseScrollPane
           
private  javax.swing.JTextPane licenseTextPane
           
protected static java.util.ResourceBundle MAIN_RESOURCE_BUNDLE
           
private  javax.swing.JPanel mainPanel
           
private  java.lang.String name
           
private  javax.swing.JLabel nameLabel
           
private  boolean noBanner
           
private  boolean noIcon
           
private  javax.swing.JButton okButton
           
private  java.lang.String version
           
private  javax.swing.JLabel versionLabel
           
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
 
Fields inherited from class java.awt.Window
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JTOrnateAboutBox()
          Creates a JTOrnateAboutBox with a JavaThis banner and icon.
JTOrnateAboutBox(javax.swing.JDialog owner, java.lang.String title)
          Creates a JTOrnateAboutBox with a JavaThis banner and icon.
JTOrnateAboutBox(javax.swing.JDialog owner, java.lang.String title, java.lang.String name, java.lang.String version, java.lang.String copyright, java.lang.String licenseComment, java.lang.String licenseDetails, java.io.File banner, java.io.File icon)
          Creates a JTOrnateAboutBox with the provided banner and icon.
JTOrnateAboutBox(javax.swing.JFrame owner, java.lang.String title)
          Creates a JTOrnateAboutBox with a JavaThis banner and icon.
JTOrnateAboutBox(javax.swing.JFrame owner, java.lang.String title, java.lang.String name, java.lang.String version, java.lang.String copyright, java.lang.String licenseComment, java.lang.String licenseDetails, java.io.File banner, java.io.File icon)
          Creates a JTOrnateAboutBox with the provided banner and icon.
 
Method Summary
 java.lang.String getCopyright()
           
 java.lang.String getLicenseComment()
           
 java.lang.String getLicenseDetails()
           
 java.lang.String getName()
          Returns the name of this component.
 java.lang.String getVersion()
           
private  void guiInit()
           
 boolean isNoBanner()
           
 boolean isNoIcon()
           
private  void jtInit(java.lang.String name, java.lang.String version, java.lang.String copyright, java.lang.String licenseComment, java.lang.String licenseDetails, java.io.File banner, java.io.File icon)
           
static void main(java.lang.String[] args)
          Used for simple testing of about box using default settings.
 void noBanner(boolean noBanner)
          Used to disable the showing of a banner.
 void noIcon(boolean noIcon)
          Used to disable the showing of a icon.
private  void registerEvents()
           
 void setBanner(java.io.File banner)
          Sets the banner at the top of the about box with the provided file.
 void setCopyright(java.lang.String copyright)
          Provide the information to fill the copyright field.
 void setIcon(java.io.File icon)
          Sets the icon at the left of the about box with the provided file.
 void setJMenuBar(javax.swing.JMenuBar menu)
          Overridded to prevent modifications
 void setLayout(java.awt.LayoutManager manager)
          Overridded to prevent modifications
 void setLicenseComment(java.lang.String licenseComment)
          Provide the information to fill the license comment field.
 void setLicenseDetails(java.lang.String licenseDetails)
          Provide the information to fill the license details field.
 void setModal(boolean isModal)
          Overridded to prevent modifications
 void setName(java.lang.String name)
          Provide the information to fill the name field.
 void setVersion(java.lang.String version)
          Provide the information to fill the version field.
 void show()
          Overridden to center tje about box relative to it's owner before each showing.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getPreferredSize, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setLayeredPane, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, dispose, getTitle, hide, isModal, isResizable, isUndecorated, setResizable, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusOwner, getGraphicsConfiguration, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, swapComponents, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAIN_RESOURCE_BUNDLE

protected static final java.util.ResourceBundle MAIN_RESOURCE_BUNDLE

bannerPanel

private javax.swing.JPanel bannerPanel

mainPanel

private javax.swing.JPanel mainPanel

buttonPanel

private javax.swing.JPanel buttonPanel

okButton

private javax.swing.JButton okButton

iconPanel

private javax.swing.JPanel iconPanel

borderLayout1

private java.awt.BorderLayout borderLayout1

bannerLabel

private javax.swing.JLabel bannerLabel

gridBagLayout1

private java.awt.GridBagLayout gridBagLayout1

iconLabel

private javax.swing.JLabel iconLabel

gridBagLayout2

private java.awt.GridBagLayout gridBagLayout2

nameLabel

private javax.swing.JLabel nameLabel

versionLabel

private javax.swing.JLabel versionLabel

copyrightTextPane

private javax.swing.JTextPane copyrightTextPane

licenseCommentLabel

private javax.swing.JLabel licenseCommentLabel

licenseTextPane

private javax.swing.JTextPane licenseTextPane

licenseScrollPane

private javax.swing.JScrollPane licenseScrollPane

aboutFont

private java.awt.Font aboutFont

DEFAULT_TITLE

private static final java.lang.String DEFAULT_TITLE

DEFAULT_NAME

private static final java.lang.String DEFAULT_NAME

DEFAULT_VERSION

private static final java.lang.String DEFAULT_VERSION

DEFAULT_COPYRIGHT

private static final java.lang.String DEFAULT_COPYRIGHT

DEFAULT_LICENSE_COMMENT

private static final java.lang.String DEFAULT_LICENSE_COMMENT

DEFAULT_LICENSE_DETAILS

private static final java.lang.String DEFAULT_LICENSE_DETAILS

DEFAULT_BANNER_URL

private static final java.net.URL DEFAULT_BANNER_URL

DEFAULT_ICON_URL

private static final java.net.URL DEFAULT_ICON_URL

EMPTY_BANNER

private static final java.net.URL EMPTY_BANNER

EMPTY_ICON

private static final java.net.URL EMPTY_ICON

name

private java.lang.String name

version

private java.lang.String version

copyright

private java.lang.String copyright

licenseComment

private java.lang.String licenseComment

licenseDetails

private java.lang.String licenseDetails

bannerFile

private java.io.File bannerFile

iconFile

private java.io.File iconFile

noBanner

private boolean noBanner

noIcon

private boolean noIcon

BANNER_SIZE

private static final java.awt.Dimension BANNER_SIZE

ICON_SIZE

private static final java.awt.Dimension ICON_SIZE

COPYRIGHT_SIZE

private static final java.awt.Dimension COPYRIGHT_SIZE

DEFAULT_DIALOG_SIZE

private static final java.awt.Dimension DEFAULT_DIALOG_SIZE
Constructor Detail

JTOrnateAboutBox

public JTOrnateAboutBox()
Creates a JTOrnateAboutBox with a JavaThis banner and icon. The text information will be filled with details related to JavaThis Utitlities library. It will have no owner. Is always model.


JTOrnateAboutBox

public JTOrnateAboutBox(javax.swing.JFrame owner,
                        java.lang.String title)
Creates a JTOrnateAboutBox with a JavaThis banner and icon. The text information will be filled with details related to JavaThis Utitlities library. It will have the provided javax.swing.JFrame as its owner, the with the provided title. Is always model.


JTOrnateAboutBox

public JTOrnateAboutBox(javax.swing.JDialog owner,
                        java.lang.String title)
Creates a JTOrnateAboutBox with a JavaThis banner and icon. The text information will be filled with details related to JavaThis Utitlities library. It will have the provided javax.swing.JDialog as its owner, the with the provided title. Is always model.


JTOrnateAboutBox

public JTOrnateAboutBox(javax.swing.JFrame owner,
                        java.lang.String title,
                        java.lang.String name,
                        java.lang.String version,
                        java.lang.String copyright,
                        java.lang.String licenseComment,
                        java.lang.String licenseDetails,
                        java.io.File banner,
                        java.io.File icon)
Creates a JTOrnateAboutBox with the provided banner and icon. The text information will be filled with the provided details, and it will have the provided javax.swing.JFrame as its owner, the with the provided title. Is always model.


JTOrnateAboutBox

public JTOrnateAboutBox(javax.swing.JDialog owner,
                        java.lang.String title,
                        java.lang.String name,
                        java.lang.String version,
                        java.lang.String copyright,
                        java.lang.String licenseComment,
                        java.lang.String licenseDetails,
                        java.io.File banner,
                        java.io.File icon)
Creates a JTOrnateAboutBox with the provided banner and icon. The text information will be filled with the provided details, and it will have the provided javax.swing.JDialog as its owner, the with the provided title. Is always model.

Method Detail

setModal

public void setModal(boolean isModal)
Overridded to prevent modifications


setJMenuBar

public void setJMenuBar(javax.swing.JMenuBar menu)
Overridded to prevent modifications


setLayout

public void setLayout(java.awt.LayoutManager manager)
Overridded to prevent modifications


setName

public void setName(java.lang.String name)
Provide the information to fill the name field.

Note: It only accepts one line, any excess will not be showed and a ellipsis will be shown at the end of the line.


getName

public java.lang.String getName()
Description copied from class: java.awt.Component
Returns the name of this component.


setVersion

public void setVersion(java.lang.String version)
Provide the information to fill the version field.

Note: It only accepts one line, any excess will not be showed and a ellipsis will be shown at the end of the line.


getVersion

public java.lang.String getVersion()

setCopyright

public void setCopyright(java.lang.String copyright)
Provide the information to fill the copyright field.

Note: It only accepts one line, any excess will not be showed and a ellipsis will be shown at the end of the line.


getCopyright

public java.lang.String getCopyright()

setLicenseComment

public void setLicenseComment(java.lang.String licenseComment)
Provide the information to fill the license comment field.

Note: It will word wrap and show only 3 lines maximum.


getLicenseComment

public java.lang.String getLicenseComment()

setLicenseDetails

public void setLicenseDetails(java.lang.String licenseDetails)
Provide the information to fill the license details field.

Note: It will word wrap and provide a vertical scroll bar if needed.


getLicenseDetails

public java.lang.String getLicenseDetails()

setBanner

public void setBanner(java.io.File banner)
Sets the banner at the top of the about box with the provided file.

Note: The java.io.File must point to a valid image. That image must be not larger than 414 x 76 pixels. If image is invalid in anyway an java.lang.IllegalArgumentException will be thrown. If the file is null or does not exist the default JavaThis banner will be displayed. If you pass true to the noBanner 55 then no banner will be displayed and the area will be left blank, and unusable.


setIcon

public void setIcon(java.io.File icon)
Sets the icon at the left of the about box with the provided file.

Note: The java.io.File must point to a valid image. That image must be 32 x 32 pixels. If image is invalid in anyway an java.lang.IllegalArgumentException will be thrown. If the file is null or does not exist the default JavaThis icon will be displayed. If you pass true to the noIcon 55 then no icon will be displayed and the area will be left blank, and unusable.


noBanner

public void noBanner(boolean noBanner)
Used to disable the showing of a banner.


isNoBanner

public boolean isNoBanner()

noIcon

public void noIcon(boolean noIcon)
Used to disable the showing of a icon.


isNoIcon

public boolean isNoIcon()

jtInit

private void jtInit(java.lang.String name,
                    java.lang.String version,
                    java.lang.String copyright,
                    java.lang.String licenseComment,
                    java.lang.String licenseDetails,
                    java.io.File banner,
                    java.io.File icon)

registerEvents

private void registerEvents()

guiInit

private void guiInit()

show

public void show()
Overridden to center tje about box relative to it's owner before each showing.


main

public static void main(java.lang.String[] args)
Used for simple testing of about box using default settings.