LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing.component
Class LyJBorderPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by leon.view.win.swing.component.LyJBorderPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class LyJBorderPanel
extends javax.swing.JPanel

This class implements a panel who can have severals types of border corresponding to the Leonardi's style.

See Also:
Serialized Form

Nested Class Summary
 class LyJBorderPanel._LyJBorderPanelClosableBorder
          Internal class used to draw a closable border.
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static java.lang.String __VERSION
           
static int CENTER
          Center alignment.
static int DEFAULT_ALIGNMENT
          Default alignment: LEFT.
static java.awt.Color DEFAULT_COLOR
          Default color: black.
static java.awt.Font DEFAULT_FONT
          Default font: TimesRoman, PLAIN, 14.
static int DEFAULT_GAP
          Default gap between border and contained component: 1 pixel.
static int DEFAULT_IN_THICKNESS
          Default thickness for etched-in borders: 10 pixels.
static int DEFAULT_LOWERED_THICKNESS
          Default thickness for lowered borders: 2 pixels.
static int DEFAULT_OUT_THICKNESS
          Default thickness for etched-out borders: 10 pixels.
static int DEFAULT_RAISED_THICKNESS
          Default thickness for raised borders: 2 pixels.
static int DEFAULT_SOLID_THICKNESS
          Default thickness for solid borders: 1 pixel.
static int DEFAULT_THICKNESS
          Default thickness: 10 pixels.
static int LEFT
          Left alignment.
static int RIGHT
          Right alignment.
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LyJBorderPanel()
          Default constructor.
LyJBorderPanel(java.awt.Color color, int thickness)
          Class constructor of a new JBorder Panel object.
LyJBorderPanel(LyAreaBase.Border style)
          Class constructor of a new JBorder Panel object.
LyJBorderPanel(LyAreaBase.Border style, int thickness)
          Class constructor of a new JBorder Panel object.
LyJBorderPanel(java.lang.String text)
          Class constructor.
 
Method Summary
static javax.swing.border.Border createBorder(LyAreaBase.Border style)
          Creates a reusable border for other components.
static javax.swing.border.Border createBorder(LyAreaBase.Border style, int thickness, int gap, java.awt.Color color)
          Creates a reusable border for other components.
static javax.swing.border.Border createBorder(LyAreaBase.Border style, int thickness, int gap, java.awt.Color color, java.awt.Font font, int alignment, java.lang.String text)
          This method allows another component to have the same border's style than a LyBorderPanel.
 int getAlignment()
          Gets the text alignment.
 java.awt.Rectangle getBounds()
           
 java.awt.Color getColor()
          Gets the current color for SOLID borders and the caption text color for etched borders.
 int getGap()
          Gets the gap between the border and the contained Component.
 java.awt.Dimension getPreferredSize()
           
 LyAreaBase.Border getStyle()
          Gets the style of the border.
 java.lang.String getText()
          Gets the text.
 java.awt.Font getTextFont()
          Gets the font of the text.
 int getThickness()
          Gets the thickness of the border.
 LyJBorderPanel setAlignment(int alignment)
          Sets the text alignment.
 void setClosable(boolean closable)
          Sets the closable state of the panel.
 LyJBorderPanel setColor(java.awt.Color color)
          Sets the current color for SOLID borders and the caption text color for etched borders.
 LyJBorderPanel setGap(int gap)
          Sets the gap between the border and the contained Component.
 void setOpen(boolean open)
          Sets the open state of the panel.
 void setOpenCloseImages(java.awt.Image openImage, java.awt.Image closeImage)
          Sets the images used to open / close the panel.
 void setParentView(LyView view)
          Sets the parent LyView instance of this panel.
 LyJBorderPanel setStyle(LyAreaBase.Border style)
          Sets the style of the border.
 LyJBorderPanel setText(java.lang.String text)
          Sets the text.
 LyJBorderPanel setTextFont(java.awt.Font font)
          Sets the font.
 LyJBorderPanel setThickness(int thickness)
          Sets the thickness of the border.
 void updateBorder()
          Sets the border of this component depending on its style value.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

LEFT

public static final int LEFT
Left alignment.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Center alignment.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Right alignment.

See Also:
Constant Field Values

DEFAULT_THICKNESS

public static final int DEFAULT_THICKNESS
Default thickness: 10 pixels.

See Also:
Constant Field Values

DEFAULT_SOLID_THICKNESS

public static final int DEFAULT_SOLID_THICKNESS
Default thickness for solid borders: 1 pixel.

See Also:
Constant Field Values

DEFAULT_RAISED_THICKNESS

public static final int DEFAULT_RAISED_THICKNESS
Default thickness for raised borders: 2 pixels.

See Also:
Constant Field Values

DEFAULT_LOWERED_THICKNESS

public static final int DEFAULT_LOWERED_THICKNESS
Default thickness for lowered borders: 2 pixels.

See Also:
Constant Field Values

DEFAULT_IN_THICKNESS

public static final int DEFAULT_IN_THICKNESS
Default thickness for etched-in borders: 10 pixels.

See Also:
Constant Field Values

DEFAULT_OUT_THICKNESS

public static final int DEFAULT_OUT_THICKNESS
Default thickness for etched-out borders: 10 pixels.

See Also:
Constant Field Values

DEFAULT_GAP

public static final int DEFAULT_GAP
Default gap between border and contained component: 1 pixel.

See Also:
Constant Field Values

DEFAULT_COLOR

public static final java.awt.Color DEFAULT_COLOR
Default color: black. Applies to SOLID and etched borders.


DEFAULT_FONT

public static final java.awt.Font DEFAULT_FONT
Default font: TimesRoman, PLAIN, 14. Only applies to etched borders.


DEFAULT_ALIGNMENT

public static final int DEFAULT_ALIGNMENT
Default alignment: LEFT. Only applies to etched borders.

See Also:
Constant Field Values
Constructor Detail

LyJBorderPanel

public LyJBorderPanel()
Default constructor. Makes default border.


LyJBorderPanel

public LyJBorderPanel(java.lang.String text)
Class constructor. Makes an etched #IN border with given text caption.

Parameters:
text - the text caption

LyJBorderPanel

public LyJBorderPanel(java.awt.Color color,
                      int thickness)
Class constructor of a new JBorder Panel object. Makes #SOLID border with color and thickness given.

Parameters:
color - the color for the border
thickness - the thickness of the border

LyJBorderPanel

public LyJBorderPanel(LyAreaBase.Border style)
Class constructor of a new JBorder Panel object. Makes a border of the given style with the default thickness for that style.

Parameters:
style - the style for this border. May be one of the following:
  • #SOLID
  • #RAISED
  • #LOWERED
  • #IN
  • #OUT
  • TransferHandler.NONE

LyJBorderPanel

public LyJBorderPanel(LyAreaBase.Border style,
                      int thickness)
Class constructor of a new JBorder Panel object. Makes border with given style and thickness.

Parameters:
style - the style for this border
thickness - the thickness for this border
See Also:
#LyJBorderPanel(int)
Method Detail

setStyle

public LyJBorderPanel setStyle(LyAreaBase.Border style)
Sets the style of the border.

Parameters:
style - the new style
Returns:
this LyJBorderPanel object
See Also:
getStyle()

getStyle

public LyAreaBase.Border getStyle()
Gets the style of the border.

Returns:
SOLID, RAISED, LOWERED, IN, OUT, or NONE
See Also:
#setStyle(int)

updateBorder

public void updateBorder()
Sets the border of this component depending on its style value.


createBorder

public static javax.swing.border.Border createBorder(LyAreaBase.Border style)
Creates a reusable border for other components.

Parameters:
style - the style of the border
Returns:
a new border for other components

createBorder

public static javax.swing.border.Border createBorder(LyAreaBase.Border style,
                                                     int thickness,
                                                     int gap,
                                                     java.awt.Color color)
Creates a reusable border for other components.

Parameters:
style - the style of the border
thickness - the thickness
gap - the gap
color - the color of the border
Returns:
a new border for other components

createBorder

public static javax.swing.border.Border createBorder(LyAreaBase.Border style,
                                                     int thickness,
                                                     int gap,
                                                     java.awt.Color color,
                                                     java.awt.Font font,
                                                     int alignment,
                                                     java.lang.String text)
This method allows another component to have the same border's style than a LyBorderPanel.

Parameters:
style - the style of the border
thickness - the thickness
gap - the gap
color - the color of the border
font - the font to use
alignment - the alignment policy
text - the text of the title
Returns:
a new border for other components

setThickness

public LyJBorderPanel setThickness(int thickness)
Sets the thickness of the border.

Parameters:
thickness - the new thickness
Returns:
this LyJBorderPanel object
See Also:
getThickness()

getThickness

public int getThickness()
Gets the thickness of the border.

Returns:
the thickness used for this border
See Also:
setThickness(int)

setClosable

public void setClosable(boolean closable)
Sets the closable state of the panel.

Parameters:
closable - the new closable state

setOpenCloseImages

public void setOpenCloseImages(java.awt.Image openImage,
                               java.awt.Image closeImage)
Sets the images used to open / close the panel. Only used when panel is closable.

Parameters:
openImage - the image to be used to open panel
closeImage - the image to be used to close panel
See Also:
#setClosable()

setOpen

public void setOpen(boolean open)
Sets the open state of the panel. Only used when panel is closable.

Parameters:
open - the new open state
See Also:
#setClosable()

setParentView

public void setParentView(LyView view)
Sets the parent LyView instance of this panel.


setGap

public LyJBorderPanel setGap(int gap)
Sets the gap between the border and the contained Component.

Parameters:
gap - the new gap, in pixels
Returns:
this LyJBorderPanel object
See Also:
getGap()

getGap

public int getGap()
Gets the gap between the border and the contained Component.

Returns:
the gap for this border
See Also:
setGap(int)

setColor

public LyJBorderPanel setColor(java.awt.Color color)
Sets the current color for SOLID borders and the caption text color for etched borders.

Parameters:
color - the new color
Returns:
this LyJBorderPanel object
See Also:
getColor()

getColor

public java.awt.Color getColor()
Gets the current color for SOLID borders and the caption text color for etched borders.

Returns:
the color used for borders
See Also:
setColor(Color)

setTextFont

public LyJBorderPanel setTextFont(java.awt.Font font)
Sets the font. Only applies to etched borders.

Parameters:
font - the font for the etched borders
Returns:
this LyJBorderPanel object
See Also:
getTextFont()

getTextFont

public java.awt.Font getTextFont()
Gets the font of the text. Only applies to etched borders.

Returns:
the font of the text
See Also:
setTextFont(Font)

setText

public LyJBorderPanel setText(java.lang.String text)
Sets the text. Only applies to etched borders.

Parameters:
text - the new text
Returns:
this LyJBorderPanel object
See Also:
getText()

getText

public java.lang.String getText()
Gets the text. Only applies to etched borders.

Returns:
the text
See Also:
setText(String)

setAlignment

public LyJBorderPanel setAlignment(int alignment)
Sets the text alignment. Only applies to etched borders.

Parameters:
alignment - the new alignment
Returns:
this LyJBorderPanel object
See Also:
getAlignment()

getAlignment

public int getAlignment()
Gets the text alignment.

Returns:
the text alignment
See Also:
setAlignment(int)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

getBounds

public java.awt.Rectangle getBounds()
Overrides:
getBounds in class java.awt.Component

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com