Free.awt
Class FreePanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--Free.awt.FreePanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class FreePanel
extends java.awt.Panel

FreePanel

Since:
1.5
Version:
0.1 30 January 2001
Author:
Rajagopal C.V
See Also:
Serialized Form

Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
(package private)  java.awt.Color backgroundColor
           
(package private)  int bottom
           
(package private)  java.awt.Color darkerColor
           
(package private)  java.awt.GridBagLayout gbl
           
(package private)  int left
           
(package private)  java.awt.Color lighterColor
           
protected  int myHeight
           
protected  int myWidth
           
static int RAISED
           
(package private)  int right
           
protected  int style
           
protected  java.lang.String text
           
static int TEXT_OFFSET
           
protected  int thickness
           
(package private)  int top
           
 
Fields inherited from class java.awt.Container
component, containerListener, layoutMgr, listeningBoundsChildren, listeningChildren, ncomponents
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FreePanel()
           
FreePanel(int style)
           
FreePanel(java.lang.String text)
          Creates a FreePanel
 
Method Summary
 void drawRaisedFrame(java.awt.Graphics g)
           
 void paint(java.awt.Graphics g)
           
 void printCaption(java.awt.Graphics g)
           
 void setFont(java.awt.Font f)
          adds a widget to the FreePanel
static void showSplash(int duration)
          A simple little method, adatped from O'Reilly's 'Java Swing', to show a title screen in the centre of the screen for a certain time.
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusOwner, setLayout, transferFocus, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXT_OFFSET

public static final int TEXT_OFFSET

style

protected int style

thickness

protected int thickness

myWidth

protected int myWidth

myHeight

protected int myHeight

text

protected java.lang.String text

gbl

java.awt.GridBagLayout gbl

RAISED

public static final int RAISED

top

int top

left

int left

bottom

int bottom

right

int right

backgroundColor

java.awt.Color backgroundColor

lighterColor

java.awt.Color lighterColor

darkerColor

java.awt.Color darkerColor
Constructor Detail

FreePanel

public FreePanel()

FreePanel

public FreePanel(int style)

FreePanel

public FreePanel(java.lang.String text)
Creates a FreePanel
Parameters:
text - The text to display in the panel.
Method Detail

setFont

public void setFont(java.awt.Font f)
adds a widget to the FreePanel
Overrides:
setFont in class java.awt.Container
Parameters:
row - The row to insert at.
col - The column to insert at.
high - The height of the component.
wide - The width of the component.
padx - Padding on the X-axis.
pady - Padding on the Y-axis.
fill - The fill (integer).
weightx - X-axis weighting.
weighty - Y-axis weighting.
theComponent - The actual component to add. public void addComponent(int row, int col, int high, int wide, int padx, int pady, int fill, float weightx, float weighty, Component theComponent){ GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = col; gbc.gridy = row; gbc.ipady = pady; gbc.ipadx = padx; gbc.gridwidth = wide; gbc.gridheight = high; gbc.fill = fill; gbc.anchor = anchor; gbc.weightx = weightx; gbc.weighty = weighty; gbc.insets = new Insets(top, left, bottom, right); gbl.setConstraints( theComponent, gbc); setLayout(gbl); add( theComponent); } public void setInsets( int Top, int Left, int Bottom, int Right ){ top = Top; left = Left; bottom=Bottom; right = Right; } int anchor = GridBagConstraints.CENTER; public void setAnchor( int Anchor ) { anchor = Anchor; } public void setGridWidths( int colWidths[] ) { gbl.columnWidths = colWidths; } public void setGridHeights( int rowHeights[] ) { gbl.rowHeights = rowHeights; } public void addNotify() { super.addNotify(); // get parent bacground colors // backgroundColor = getParent().getBackground(); lighterColor = backgroundColor.brighter( ); darkerColor = backgroundColor.darker(); getMetrics(); } public Insets getInsets() { int space = thickness + 1; int topSpace = space; int leftSpace = space; int rightSpace = space; //if ( isStyleSet( CAPTION ) ) if ( text != "") { FontMetrics fm = getFontMetrics( getFont() ); if ( fm != null ) topSpace += ( fm.getHeight() / 2 ) + 1; } return( new Insets( topSpace, space, space, space ) ); } // getMetrics // Figures out the size I should be based on what I contain // public void getMetrics() { Dimension d = getMinimumSize(); setSize( d.width, d.height ); } /* // minimumSize * // public Dimension getMinimumSize() { int tempWidth, tempHeight; if ( myWidth != 0 && myHeight != 0 ) { tempWidth = myWidth + ( thickness * 2 ); tempHeight = myHeight + ( thickness * 2 ); return( new Dimension( tempWidth, tempHeight ) ); } Dimension d = super.getMinimumSize(); FontMetrics fm = getFontMetrics( getFont() ); if ( fm != null && text != null ) { int extra = ( thickness * 2 ) + ( TEXT_OFFSET * 2 ); d.height += fm.getHeight() + extra; d.width += fm.stringWidth( text ) + extra; } d.width += thickness * 2; d.height += thickness * 2; return( d ); } // preferredSize // public Dimension getPreferredSize() { return( getMinimumSize() ); }

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Container

drawRaisedFrame

public void drawRaisedFrame(java.awt.Graphics g)

printCaption

public void printCaption(java.awt.Graphics g)

showSplash

public static void showSplash(int duration)
A simple little method, adatped from O'Reilly's 'Java Swing', to show a title screen in the centre of the screen for a certain time.
Parameters:
duration - The time to show the screen for