[.home.]
[.hacks.]
[.java.]

Class Awt

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--Awt
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.AdjustmentListener, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.event.KeyListener, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable
Direct Known Subclasses:
AwtText, Cal, Caption, ImageCanvas, MultiColumnList, TabbedPanel

public class Awt
extends java.awt.Panel
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener, java.awt.event.AdjustmentListener, java.awt.event.FocusListener, java.awt.ItemSelectable

(#)Awt.java

Version:
3.2 19-Mar-2004

Implements some useful (static) AWT routines and acts as baseclass for several gui items
Overview of mode bits used in this class:
    misc     effect   position
  0 0 0 0   0 0 0 0   0 0 0 0
  - - H F   U B S R   W S E N
      r i   l u u a   e o a o
      e l   i l n i   s u s r
      f l   n k k s   t t t t
            e   e e     h   h
                n d
 
This class also implements a simple text formating mechanism. Unicode escape sequences can be used to change fonts alignment, color etc. The syntax is pretty easy. A formatting directive is always constructed from + . The prefix for setting the font to serif and the color to white woud be Esc + Serif + Esc + White.
A summary of all attributes:
  Font Family       FFnn
  Serif             FF00
  SansSerif         FF01
  Monospaced        FF02
  
Font style FBnn Plain FB00 Bold FB01 Italic FB02 Bolditalic FB03 Font Size rel. F0nn Smaller F000 two pixel smaller Larger F001 two pixel larger Font Size Absolut F5nn nn = size in pixel (hex) Text Alignment A00n North A001 East A002 South A004 West A008 NorthWest A009 SouthWest A00C NorthEast A003 SouthEast A00A Center A00F Text Tabs Dnnn Left tabs only nnn = no of char to tab Tab0 D000 Effects Ennn Flat E000 default effect Raised E001 makes objects looking raised Sunken E002 makes objects looking sunken Bulk E003 actually a drawing mode @see setBorderType() Uline E004 underline Href E0D1 start of a href Hrefend E0D0 end of a href Darker E0C1 make foreground color darker Brighter E0C2 make foreground color brighter Background E0C3 make foreground equal to current backgroundcolor Colors Cnnn nnn = rgb - eight bits per color White C000 Black CFFF
Author:
Holger Pfaff
See Also:
Serialized Form

Field Summary
protected  java.awt.event.ActionListener actionListener
          ActionListener to notify clients
static char Background
          make fg color equal to bg color
protected  java.lang.Object bg
          our Background
protected  java.awt.Graphics big
          Grphics for bim
protected  java.awt.Image bim
          backing image for flickerfree drawing
static char Black
          the color black
static char BlueMask
          used to determine the blue portion of this color spec
static char Bold
          font style bold
static char Bolditalic
          font style bolditalic
protected  int borderDepth
          borderdepth - thickness of border
protected  int borderType
          bordertype - one of NONE, RAISED, SUNKEN, BULK, TOP
static int BOTTOM
          Bottom position
static char Brighter
          make fg color brighter
static char Bulk
          Used to specify a border mode in property files. not used for text
static int BULK
          a highlighted border/text
static int C
          Center position
static char Center
          Center alignment
static int CENTER
          Center position
static char ColorMask
          colors use the format C, where each color value can range from 0 to F.
protected  java.util.Hashtable componentStates
          save components states if this panel is set to disable
static char Darker
          make fg color darker
static int E
          East position
static char East
          East alignment
static int EFFECT_MASK
          effect mask - bits 4-7
static char Esc
          Unicode replacement char.
static int FILL
          fill object (rectangle/triangle) - Outline is default
static char Flat
          the default 'effect'
static char FontMask
          Mask for computing fontsizes
protected static java.util.Hashtable fonts
          font cache
static char FontSize0
          font sizes absolute
static char FontSizeMask
          Mask for computing fontsizes
static char Foreground
          make fg color equal to fg color (same as setting it to default)
static char GreenMask
          used to determine the green portion of this color spec
static char Href
          start of a href
static int HREF
          the following text is a href
static char Hrefend
          end of a href (or use flat/default)
protected  java.awt.Insets innerInsets
          insets within this comp
protected  java.awt.Insets insets
          insets around this comp
static char Italic
          font style italic
protected  java.awt.event.ItemListener itemListener
          ItemListener to notify clients
protected static java.lang.String jvendor
          java vendor
protected static java.lang.String jversion
          java version
static char Larger
          font size relative larger
static int LEFT
          Left position
protected  java.awt.Dimension minimumDimension
          the dimension for comp
static int MISC_MASK
          mode mask - bits 8-11
static char Monospaced
          font family Monospaced
static int N
          North position
static int NE
          NorthEast position
static char None
          reset all styles to default
static int NONE
          One special mode
static char North
          North alignment
static char NorthEast
          NorthEast alignment
static char NorthWest
          NorthWest alignment
static char Null
          Unicode null char.
static int NW
          NorthWest position
static char Plain
          font style plain
static int POSITION_MASK
          positions / directions mask - the lowest 4 bits 0-3
static char Raised
          shadow effect to emphasize text
static int RAISED
          a raised border
static char RedMask
          used to determine the red portion of this color spec
static int RIGHT
          Right position
static int S
          South position
static char SansSerif
          font family SansSerif
static int SE
          SouthEast position
static char Serif
          font family Serif
static char Smaller
          font size relative smaller
static char South
          South alignment
static char SouthEast
          SouthEast alignment
static char SouthWest
          SouthWest alignment
static char Sunken
          shadow effect to make text look inaktive
static int SUNKEN
          a sunken border
static int SW
          SouthWest position
static char Tab0
          Tab positions absolute; Format: Dnnn nnn is the pos in hex ranging from 0 - 7FF
static char TabMask
          Tab mask to determine tabs
static char TabSizeMask
          Tab mask to determine tab positions
static int TOP
          Top position
static char Uline
          Underline text
static int ULINE
          underline effect
static int W
          West position
static char West
          West alignment
static char White
          the color white
 
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
Awt()
          Contructor for an Awt component
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          adds an actionListener
 void addItemListener(java.awt.event.ItemListener l)
          adds an itemListener
 void addNotify()
          override java.awt.Panel.addNotify() called shortly after instantiation first chance to call measure()
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
          implement java.awt.event.AdjustmentListener
static java.awt.Insets Array2Insets(int[] i)
          Return Insets from an int array (used to set Insets from property file)
static java.awt.Font bold(java.awt.Font f)
          Returns a bold font with same size and family
static java.awt.Font bolditalic(java.awt.Font f)
          Returns a bolditalic font with same size and family
static java.awt.Color brighter(java.awt.Color c)
          Return a brighter version of color c
static void centerWindow(java.awt.Window w)
          Center a window on screen.
static java.lang.String Color2Esc(java.awt.Color c)
          Returns the escape sequence for Color c
static java.awt.Color darker(java.awt.Color c)
          Return a darker version of color c
static java.awt.Color dim(java.awt.Color c, int v)
          Return a dimmed version of color c
 void doHref(java.lang.String s, int x, int y, int w, int h)
          callback routine for dynamic caption content should be overwritten by implementing classes
 void doMeasure()
          Utility function for Awt Components re-measures an invalidates if dims changed
static void drawCaption(java.awt.Graphics g, java.awt.Color c, java.awt.Font f, java.lang.String s, int x, int y, int w, int h, int m, java.lang.String dl)
          Draws a caption within the given box. drawCaption recognizes the escape sequences above for changing text characteristics and supports multiple lines
static void drawCaption(java.awt.Graphics g, java.awt.Color c, java.awt.Font f, java.lang.String s, int x, int y, int w, int h, int m, java.lang.String dl, Awt awt)
          Draws a caption within the given box. drawCaption recognizes the escape sequences above for changing text characteristics and supports multiple lines
static void drawLine(java.awt.Graphics g, java.awt.Color c, int x, int y, int X, int Y, int d, int m)
          Draws a line between the given points
static void drawRectangle(java.awt.Graphics g, java.awt.Color c, int x, int y, int w, int h, int d, int m)
          Draws a rectangle within the given box
static java.awt.Dimension drawString(java.awt.Graphics g, java.awt.Color c, java.awt.Font f, java.lang.String s, int x, int y, int w, int h, int m)
          Draws a string within the given box.
static java.awt.Dimension drawString(java.awt.Graphics g, java.awt.Color c, java.awt.Font f, java.lang.String s, int x, int y, int w, int h, int m, Awt awt)
          Draws a string within the given box.
static void drawTriangle(java.awt.Graphics g, java.awt.Color c, int x, int y, int w, int h, int d, int m)
          Draws a triangle within the given box
static void error(java.lang.Object m, java.awt.Component c)
          Creates a nicely formatted error popup.
static java.lang.String exHref(java.lang.String s)
          Returns the invisible (left or href) part of a string resp. href.
static java.lang.String exString(java.lang.String s)
          Returns the visible (right) part of a string resp. href.
 void focusGained(java.awt.event.FocusEvent e)
          implement java.awt.event.FocusListener
 void focusLost(java.awt.event.FocusEvent e)
          implement java.awt.event.FocusListener
static java.applet.AppletContext getAppletContext(java.awt.Component c)
          Gets the current applet context if any
 java.lang.Object getBG()
          return the object currently used as BG for this comp Attn: all BG's are converted to Image the first time used So this routine usually returns Object type Image
 java.awt.Image getBGImage()
          get the BG Image if any
 Awt getBGParent()
          walk up the component tree to find a parent with a BG !
 java.awt.Image getBGParentImage()
          walk up the component tree to find a BG !
 int getBorderDepth()
          get borderdepth
 java.awt.Rectangle getBorderRectangle()
          Get this comps rectangle within border totalsize - insets - borderDepth
 int getBorderType()
          get bodertype
static java.awt.Color getColor(char u, java.awt.Color c, java.awt.Color dc, java.awt.Color bg)
          Returns the modified color for escape char u leaves color unchanged if u does not descibe any color characteristics
static java.awt.Color getColor(java.lang.Object o)
          Try to get color.
static java.awt.Font getFont(char u, java.awt.Font f, java.awt.Font df)
          Returns the modified font for escape char u leaves font unchanged if u does not descibe any font characteristics
static java.awt.Font getFont(java.lang.Object o)
          Try to get a font.
static java.awt.Font getFont(java.lang.String name, int style, int size)
          Try to get a font from our cache.
 java.awt.Insets getInnerInsets()
          get current inner border
 java.awt.Rectangle getInnerRectangle()
          Get this comps inner rectangle totalsize - insets - borderDepth - innerInsets
 java.awt.Insets getInsets()
          get current border
static java.awt.FontMetrics getMetrics(java.awt.Font f)
          Returns Metrics for font
 java.awt.Dimension getMinimumSize()
          override java.awt.Panel.getMinimumSize()
static int getMode(char u, int m, int dm)
          Returns the modified mode for escape char u leaves mode unchanged if u does not descibe any mode characteristics
static int getPosition(int m)
          Exctract position bits from m.
 java.awt.Dimension getPreferredSize()
          override java.awt.Panel.getPreferredSize() and return our minimum size
 java.awt.Rectangle getRectangle()
          Get this comps rectangle totalsize - insets
 java.lang.Object[] getSelectedObjects()
          implement java.awt.ItemSelectable
static int getTab(char u, java.awt.Font f, int dt)
          Returns the tab position for escape char u return default tab if u does not descibe any tab position
static java.awt.Component getTopComponent(java.awt.Component c)
          Gets the toplevel component (usually a frame)
 void invalidate()
          Overwrite java.awt.component.invalidate() to do measuring .
static boolean isBulk(int m)
          True if m describes effect Bulk.
static boolean isEffect(int m)
          True if m describes an effect (see above).
static boolean isFill(int m)
          True if m describes effect Fill.
static boolean isHref(int m)
          True if we are in Href mode.
static boolean isMSJVM()
          Check if this is a MS JVM
static boolean isNS4JVM()
          Check if this is a Netscape 4 JVM
static boolean isRaised(int m)
          True if m describes effect Raised.
static boolean isSunken(int m)
          True if m describes effect Sunken.
static boolean isUline(int m)
          True if m describes effect Underline.
static java.awt.Font italic(java.awt.Font f)
          Returns a italic font with same size and family
 void keyPressed(java.awt.event.KeyEvent e)
          implement java.awt.event.KeyListener
 void keyReleased(java.awt.event.KeyEvent e)
          implement java.awt.event.KeyListener
 void keyTyped(java.awt.event.KeyEvent e)
          implement java.awt.event.KeyListener
static java.awt.Font larger(java.awt.Font f)
          Returns a larger font with same family and style
 java.awt.Image loadImage(java.lang.String n)
          Creates an image either form URL or Archive Returns null on failure.
static java.awt.Image loadImageFromArchive(java.lang.String n)
          Creates an image from a Archive At least this is what Netscape 4.x does.
static java.awt.Image loadImageFromStream(java.io.InputStream i)
          Creates an image from an InputStream
static java.awt.Image loadImageFromURL(java.lang.String n)
          Creates an image from an url.
 void makeBim()
           
 java.awt.Dimension measure()
          Return currently needed Dimension Should be overridden by Awt Components
static java.awt.Dimension measureCaption(java.lang.String s, java.awt.Font f, java.awt.Font df, java.lang.String dl)
          Calculates the box needed to draw the caption
static java.awt.Dimension measureString(java.lang.String s, java.awt.Font f)
          Calculates the box needed to draw the string
static java.awt.Font monospaced(java.awt.Font f)
          Returns a monospaced font with same size and style
 void mouseClicked(java.awt.event.MouseEvent e)
          implement java.awt.event.MouseListener
 void mouseDragged(java.awt.event.MouseEvent e)
          implement java.awt.event.MouseListener
 void mouseEntered(java.awt.event.MouseEvent e)
          implement java.awt.event.MouseListener
 void mouseExited(java.awt.event.MouseEvent e)
          implement java.awt.event.MouseListener
 void mouseMoved(java.awt.event.MouseEvent e)
          implement java.awt.event.MouseListener
 void mousePressed(java.awt.event.MouseEvent e)
          implement java.awt.event.MouseListener
 void mouseReleased(java.awt.event.MouseEvent e)
          implement java.awt.event.MouseListener
protected  void notifyActionListeners(java.awt.event.ActionEvent e)
          notifies all actionListeners
protected  void notifyItemListeners(java.awt.event.ItemEvent e)
          notifies all itemListeners
 void paint(java.awt.Graphics g)
          Actually do the work ... this basic paint() routine just draws the border.
 void paintBackground(java.awt.Graphics g)
          Paint the Background
 void paintBackground(java.awt.Graphics g, int x, int y, int w, int h)
          Paint the Background
 void paintBim(java.awt.Graphics g)
           
 void paintBorder(java.awt.Graphics g, int x, int y, int w, int h)
          Paint the border
static java.awt.Font plain(java.awt.Font f)
          Returns a plain font with same size and family
 void refresh()
          Refresh (force new layout) starting from this component down the tree
static void refresh(java.awt.Component c)
          Refresh (force new layout) starting from component up the tree
 void refreshAll()
          Refresh (force new layout) starting from root component up the tree
 void removeActionListener(java.awt.event.ActionListener l)
          removes an actionListener
 void removeItemListener(java.awt.event.ItemListener l)
          removes an itemListener
static java.awt.Font sansserif(java.awt.Font f)
          Returns a sansserif font with same size and style
static java.awt.Font serif(java.awt.Font f)
          Returns a serif font with same size and style
static void setBackground(java.awt.Component c)
          Set BG color of a (AWT) component
 void setBG(java.lang.Object b)
          set the BG for this comp.
 void setBGIfNull(java.lang.Object b)
          set the BG for this comp only if none is currently present (even from parent)
 void setBorderDepth(int d)
          set borderdepth
 void setBorderType(int t)
          set bodertype
 void setBorderType(java.lang.String t)
          set bodertype - String version (attributes from property file)
 void setBounds(int x, int y, int w, int h)
          Overwrite Component.setBounds() to recognize resizing
 void setEnabled(boolean enabled)
          override java.awt.Panel.setEnabled() just to recocnize state change
 void setFont(java.awt.Font f)
          override java.awt.Panel.setFont(Font font) just to recognize the change
static void setFont(java.awt.TextComponent tc)
          Set font of a (AWT) textcomponent
static void setForeground(java.awt.Component c)
          Set FG color of a (AWT) component
 void setInnerInsets(java.awt.Insets i)
          sets a new border
 void setInsets(java.awt.Insets i)
          sets a new border
 void setVisible(boolean v)
          override java.awt.Panel.setVisible() just to recocnize state change
static java.awt.Font smaller(java.awt.Font f)
          Returns a smaller font with same family and style
 java.awt.Image tile(java.awt.Image i, java.awt.Dimension d)
          scale (grow only) an Image to specified size by just filling it with the original from left to right, top down w, h will be rounded to the next multiple of original size
 java.awt.Image tile(java.awt.Image i, int w, int h)
          scale (grow only) an Image to specified size by just filling it with the original from left to right, top down w, h will be rounded to the next multiple of original size
 void update(java.awt.Graphics g)
          Overwrite java.awt.component.update() to avoid flickering .
 java.awt.Image waitForImage(java.awt.Image i)
          wait for an Image to load completely
 
Methods inherited from class java.awt.Panel
getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, 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, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, 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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
One special mode

See Also:
Constant Field Values

POSITION_MASK

public static final int POSITION_MASK
positions / directions mask - the lowest 4 bits 0-3

See Also:
Constant Field Values

N

public static final int N
North position

See Also:
Constant Field Values

E

public static final int E
East position

See Also:
Constant Field Values

S

public static final int S
South position

See Also:
Constant Field Values

W

public static final int W
West position

See Also:
Constant Field Values

NW

public static final int NW
NorthWest position

See Also:
Constant Field Values

SW

public static final int SW
SouthWest position

See Also:
Constant Field Values

NE

public static final int NE
NorthEast position

See Also:
Constant Field Values

SE

public static final int SE
SouthEast position

See Also:
Constant Field Values

C

public static final int C
Center position

See Also:
Constant Field Values

CENTER

public static final int CENTER
Center position

See Also:
Constant Field Values

TOP

public static final int TOP
Top position

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Right position

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Bottom position

See Also:
Constant Field Values

LEFT

public static final int LEFT
Left position

See Also:
Constant Field Values

EFFECT_MASK

public static final int EFFECT_MASK
effect mask - bits 4-7

See Also:
Constant Field Values

RAISED

public static final int RAISED
a raised border

See Also:
Constant Field Values

SUNKEN

public static final int SUNKEN
a sunken border

See Also:
Constant Field Values

BULK

public static final int BULK
a highlighted border/text

See Also:
Constant Field Values

ULINE

public static final int ULINE
underline effect

See Also:
Constant Field Values

MISC_MASK

public static final int MISC_MASK
mode mask - bits 8-11

See Also:
Constant Field Values

FILL

public static final int FILL
fill object (rectangle/triangle) - Outline is default

See Also:
Constant Field Values

HREF

public static final int HREF
the following text is a href

See Also:
Constant Field Values

Esc

public static final char Esc
Unicode replacement char. Used as indicator that the following char is interpreted as formatting information

See Also:
Constant Field Values

Null

public static final char Null
Unicode null char. Not a char at all. Used as placeholder

See Also:
Constant Field Values

None

public static final char None
reset all styles to default

See Also:
Constant Field Values

Serif

public static final char Serif
font family Serif

See Also:
Constant Field Values

SansSerif

public static final char SansSerif
font family SansSerif

See Also:
Constant Field Values

Monospaced

public static final char Monospaced
font family Monospaced

See Also:
Constant Field Values

Plain

public static final char Plain
font style plain

See Also:
Constant Field Values

Bold

public static final char Bold
font style bold

See Also:
Constant Field Values

Italic

public static final char Italic
font style italic

See Also:
Constant Field Values

Bolditalic

public static final char Bolditalic
font style bolditalic

See Also:
Constant Field Values

Smaller

public static final char Smaller
font size relative smaller

See Also:
Constant Field Values

Larger

public static final char Larger
font size relative larger

See Also:
Constant Field Values

FontSize0

public static final char FontSize0
font sizes absolute

See Also:
Constant Field Values

FontMask

public static final char FontMask
Mask for computing fontsizes

See Also:
Constant Field Values

FontSizeMask

public static final char FontSizeMask
Mask for computing fontsizes

See Also:
Constant Field Values

North

public static final char North
North alignment

See Also:
Constant Field Values

East

public static final char East
East alignment

See Also:
Constant Field Values

South

public static final char South
South alignment

See Also:
Constant Field Values

West

public static final char West
West alignment

See Also:
Constant Field Values

NorthWest

public static final char NorthWest
NorthWest alignment

See Also:
Constant Field Values

SouthWest

public static final char SouthWest
SouthWest alignment

See Also:
Constant Field Values

NorthEast

public static final char NorthEast
NorthEast alignment

See Also:
Constant Field Values

SouthEast

public static final char SouthEast
SouthEast alignment

See Also:
Constant Field Values

Center

public static final char Center
Center alignment

See Also:
Constant Field Values

Tab0

public static final char Tab0
Tab positions absolute; Format: Dnnn nnn is the pos in hex ranging from 0 - 7FF

See Also:
Constant Field Values

TabMask

public static final char TabMask
Tab mask to determine tabs

See Also:
Constant Field Values

TabSizeMask

public static final char TabSizeMask
Tab mask to determine tab positions

See Also:
Constant Field Values

Flat

public static final char Flat
the default 'effect'

See Also:
Constant Field Values

Raised

public static final char Raised
shadow effect to emphasize text

See Also:
Constant Field Values

Sunken

public static final char Sunken
shadow effect to make text look inaktive

See Also:
Constant Field Values

Bulk

public static final char Bulk
Used to specify a border mode in property files. not used for text

See Also:
Constant Field Values

Uline

public static final char Uline
Underline text

See Also:
Constant Field Values

Href

public static final char Href
start of a href

See Also:
Constant Field Values

Hrefend

public static final char Hrefend
end of a href (or use flat/default)

See Also:
Constant Field Values

Darker

public static final char Darker
make fg color darker

See Also:
Constant Field Values

Brighter

public static final char Brighter
make fg color brighter

See Also:
Constant Field Values

Foreground

public static final char Foreground
make fg color equal to fg color (same as setting it to default)

See Also:
Constant Field Values

Background

public static final char Background
make fg color equal to bg color

See Also:
Constant Field Values

ColorMask

public static final char ColorMask
colors use the format C, where each color value can range from 0 to F. See examples below

See Also:
Constant Field Values

RedMask

public static final char RedMask
used to determine the red portion of this color spec

See Also:
Constant Field Values

GreenMask

public static final char GreenMask
used to determine the green portion of this color spec

See Also:
Constant Field Values

BlueMask

public static final char BlueMask
used to determine the blue portion of this color spec

See Also:
Constant Field Values

White

public static final char White
the color white

See Also:
Constant Field Values

Black

public static final char Black
the color black

See Also:
Constant Field Values

jversion

protected static final java.lang.String jversion
java version


jvendor

protected static final java.lang.String jvendor
java vendor


fonts

protected static final java.util.Hashtable fonts
font cache


insets

protected java.awt.Insets insets
insets around this comp


innerInsets

protected java.awt.Insets innerInsets
insets within this comp


borderDepth

protected int borderDepth
borderdepth - thickness of border


borderType

protected int borderType
bordertype - one of NONE, RAISED, SUNKEN, BULK, TOP


minimumDimension

protected java.awt.Dimension minimumDimension
the dimension for comp


actionListener

protected java.awt.event.ActionListener actionListener
ActionListener to notify clients


itemListener

protected java.awt.event.ItemListener itemListener
ItemListener to notify clients


componentStates

protected java.util.Hashtable componentStates
save components states if this panel is set to disable


bg

protected java.lang.Object bg
our Background


bim

protected java.awt.Image bim
backing image for flickerfree drawing


big

protected java.awt.Graphics big
Grphics for bim

Constructor Detail

Awt

public Awt()
Contructor for an Awt component

Method Detail

error

public static void error(java.lang.Object m,
                         java.awt.Component c)
Creates a nicely formatted error popup.

Parameters:
m - the message; usually string or exception
c - comp used as parent for popup or null

loadImageFromStream

public static java.awt.Image loadImageFromStream(java.io.InputStream i)
Creates an image from an InputStream


loadImageFromArchive

public static java.awt.Image loadImageFromArchive(java.lang.String n)
Creates an image from a Archive At least this is what Netscape 4.x does.

Parameters:
n - the name of the image.

loadImageFromURL

public static java.awt.Image loadImageFromURL(java.lang.String n)
Creates an image from an url. Returns null on failure.

Parameters:
n - the name/url of the image.

loadImage

public java.awt.Image loadImage(java.lang.String n)
Creates an image either form URL or Archive Returns null on failure.

Parameters:
n - the name/url of the image.

isNS4JVM

public static boolean isNS4JVM()
Check if this is a Netscape 4 JVM

Returns:
true if this is a Netscape 4 JVM

isMSJVM

public static boolean isMSJVM()
Check if this is a MS JVM

Returns:
true if this is a MS JVM

centerWindow

public static void centerWindow(java.awt.Window w)
Center a window on screen. Reduces window size if larger than screen.

Parameters:
w - the window to center.

setBackground

public static void setBackground(java.awt.Component c)
Set BG color of a (AWT) component

Parameters:
c - Component

setForeground

public static void setForeground(java.awt.Component c)
Set FG color of a (AWT) component

Parameters:
c - Component

setFont

public static void setFont(java.awt.TextComponent tc)
Set font of a (AWT) textcomponent

Parameters:
tc - TextComponent

refresh

public static void refresh(java.awt.Component c)
Refresh (force new layout) starting from component up the tree

Parameters:
c - the component to refresh.

refresh

public void refresh()
Refresh (force new layout) starting from this component down the tree


refreshAll

public void refreshAll()
Refresh (force new layout) starting from root component up the tree


getTopComponent

public static java.awt.Component getTopComponent(java.awt.Component c)
Gets the toplevel component (usually a frame)

Parameters:
c - the component to find the toplevel component for.

getAppletContext

public static java.applet.AppletContext getAppletContext(java.awt.Component c)
Gets the current applet context if any

Parameters:
c - the component to find the applet context for.

getFont

public static java.awt.Font getFont(java.lang.Object o)
Try to get a font. obj can be a standard font name or already a font object.

Returns:
null on failure.

getFont

public static java.awt.Font getFont(java.lang.String name,
                                    int style,
                                    int size)
Try to get a font from our cache. Create a new one if none was found.

Parameters:
name - Font name/family
style - Font.PAIN Font.BOLD Font.ITALIC
size - Font size in points

getMetrics

public static java.awt.FontMetrics getMetrics(java.awt.Font f)
Returns Metrics for font

Parameters:
f - font to use.

larger

public static java.awt.Font larger(java.awt.Font f)
Returns a larger font with same family and style

Parameters:
f - use this as base font.

smaller

public static java.awt.Font smaller(java.awt.Font f)
Returns a smaller font with same family and style

Parameters:
f - use this as base font.

serif

public static java.awt.Font serif(java.awt.Font f)
Returns a serif font with same size and style

Parameters:
f - use this as base font.

sansserif

public static java.awt.Font sansserif(java.awt.Font f)
Returns a sansserif font with same size and style

Parameters:
f - use this as base font.

monospaced

public static java.awt.Font monospaced(java.awt.Font f)
Returns a monospaced font with same size and style

Parameters:
f - use this as base font.

bold

public static java.awt.Font bold(java.awt.Font f)
Returns a bold font with same size and family

Parameters:
f - use this as base font.

italic

public static java.awt.Font italic(java.awt.Font f)
Returns a italic font with same size and family

Parameters:
f - use this as base font.

bolditalic

public static java.awt.Font bolditalic(java.awt.Font f)
Returns a bolditalic font with same size and family

Parameters:
f - use this as base font.

plain

public static java.awt.Font plain(java.awt.Font f)
Returns a plain font with same size and family

Parameters:
f - use this as base font.

Color2Esc

public static java.lang.String Color2Esc(java.awt.Color c)
Returns the escape sequence for Color c

Parameters:
c - the color

getColor

public static java.awt.Color getColor(java.lang.Object o)
Try to get color. obj can be color name or a numeric value or already a color object.

Parameters:
o - color specification.
Returns:
null on failure.

dim

public static java.awt.Color dim(java.awt.Color c,
                                 int v)
Return a dimmed version of color c

Parameters:
c - original color
v - value to dim

brighter

public static java.awt.Color brighter(java.awt.Color c)
Return a brighter version of color c

Parameters:
c - original color

darker

public static java.awt.Color darker(java.awt.Color c)
Return a darker version of color c

Parameters:
c - original color

Array2Insets

public static java.awt.Insets Array2Insets(int[] i)
Return Insets from an int array (used to set Insets from property file)

Parameters:
i - insets values (as in Insets constructor)

drawLine

public static void drawLine(java.awt.Graphics g,
                            java.awt.Color c,
                            int x,
                            int y,
                            int X,
                            int Y,
                            int d,
                            int m)
Draws a line between the given points

Parameters:
g - Graphics object to use
c - color to use as base for shadow, or null
d - thickness of line in pixel
m - RAISED or SUNKEN

drawRectangle

public static void drawRectangle(java.awt.Graphics g,
                                 java.awt.Color c,
                                 int x,
                                 int y,
                                 int w,
                                 int h,
                                 int d,
                                 int m)
Draws a rectangle within the given box

Parameters:
g - Graphics object to use
c - color to use as base for shadow, or null
x - x-position of describing rect
y - y-position of describing rect
w - width of describing rect
h - height of describing rect
d - thickness of the line in pixel
m - combination of FILL RAISED SUNKEN

drawTriangle

public static void drawTriangle(java.awt.Graphics g,
                                java.awt.Color c,
                                int x,
                                int y,
                                int w,
                                int h,
                                int d,
                                int m)
Draws a triangle within the given box

Parameters:
g - Graphics object to use
c - color to use as base for shadow, or null
x - x-position of describing rect
y - y-position of describing rect
w - width of describing rect
h - height of describing rect
d - thickness of the line in pixel
m - combination of LINE FILL RAISED SUNKEN and Direction (N E S W etc)

drawString

public static java.awt.Dimension drawString(java.awt.Graphics g,
                                            java.awt.Color c,
                                            java.awt.Font f,
                                            java.lang.String s,
                                            int x,
                                            int y,
                                            int w,
                                            int h,
                                            int m)
Draws a string within the given box.

Parameters:
g - Graphics object to use
c - color to use or null
f - font to use or null
s - the string
x - x-position of describing rect
y - y-position of describing rect
w - width of describing rect
h - height of describing rect
m - mode including position & effect & misc

drawString

public static java.awt.Dimension drawString(java.awt.Graphics g,
                                            java.awt.Color c,
                                            java.awt.Font f,
                                            java.lang.String s,
                                            int x,
                                            int y,
                                            int w,
                                            int h,
                                            int m,
                                            Awt awt)
Draws a string within the given box.

Parameters:
g - Graphics object to use
c - color to use or null
f - font to use or null
s - the string
x - x-position of describing rect
y - y-position of describing rect
w - width of describing rect
h - height of describing rect
m - mode including position & effect & misc
awt - comp used as callback for hrefs

measureString

public static java.awt.Dimension measureString(java.lang.String s,
                                               java.awt.Font f)
Calculates the box needed to draw the string

Parameters:
s - the string
f - the base font to use

drawCaption

public static void drawCaption(java.awt.Graphics g,
                               java.awt.Color c,
                               java.awt.Font f,
                               java.lang.String s,
                               int x,
                               int y,
                               int w,
                               int h,
                               int m,
                               java.lang.String dl)
Draws a caption within the given box. drawCaption recognizes the escape sequences above for changing text characteristics and supports multiple lines

Parameters:
g - Graphics object to use
c - color to use or null
f - font to use or null
s - the string
x - x-position of describing rect
y - y-position of describing rect
w - width of describing rect
h - height of describing rect
m - mode including position & effect
dl - the line delimiter usually "\n" specify "" for a single line

drawCaption

public static void drawCaption(java.awt.Graphics g,
                               java.awt.Color c,
                               java.awt.Font f,
                               java.lang.String s,
                               int x,
                               int y,
                               int w,
                               int h,
                               int m,
                               java.lang.String dl,
                               Awt awt)
Draws a caption within the given box. drawCaption recognizes the escape sequences above for changing text characteristics and supports multiple lines

Parameters:
g - Graphics object to use
c - color to use or null
f - font to use or null
s - the string
x - x-position of describing rect
y - y-position of describing rect
w - width of describing rect
h - height of describing rect
m - mode including position & effect
dl - the line delimiter usually "\n" specify "" for a single line
awt - comp used as callback for hrefs

measureCaption

public static java.awt.Dimension measureCaption(java.lang.String s,
                                                java.awt.Font f,
                                                java.awt.Font df,
                                                java.lang.String dl)
Calculates the box needed to draw the caption

Parameters:
s - the string
f - the base font to use
df - the default font to use
dl - the line delimiter usually "\n" specify "" for a single line

exString

public static java.lang.String exString(java.lang.String s)
Returns the visible (right) part of a string resp. href. Parts are separated using the unicode null char

Parameters:
s - the orig. string

exHref

public static java.lang.String exHref(java.lang.String s)
Returns the invisible (left or href) part of a string resp. href. Parts are separated using the unicode null char

Parameters:
s - the orig. string

getFont

public static java.awt.Font getFont(char u,
                                    java.awt.Font f,
                                    java.awt.Font df)
Returns the modified font for escape char u leaves font unchanged if u does not descibe any font characteristics

Parameters:
u - the escape char
f - the base font to use
df - the default font to use

getColor

public static java.awt.Color getColor(char u,
                                      java.awt.Color c,
                                      java.awt.Color dc,
                                      java.awt.Color bg)
Returns the modified color for escape char u leaves color unchanged if u does not descibe any color characteristics

Parameters:
u - the escape char
c - the base color to use
dc - the default color to use

getTab

public static int getTab(char u,
                         java.awt.Font f,
                         int dt)
Returns the tab position for escape char u return default tab if u does not descibe any tab position

Parameters:
u - the escape char
f - the base font to use
dt - the default tab to use

getMode

public static int getMode(char u,
                          int m,
                          int dm)
Returns the modified mode for escape char u leaves mode unchanged if u does not descibe any mode characteristics

Parameters:
u - the escape char
m - the base mode to use
dm - the default mode to use

getPosition

public static int getPosition(int m)
Exctract position bits from m.

Parameters:
m - mode

isEffect

public static boolean isEffect(int m)
True if m describes an effect (see above).

Parameters:
m - mode

isRaised

public static boolean isRaised(int m)
True if m describes effect Raised.

Parameters:
m - mode

isSunken

public static boolean isSunken(int m)
True if m describes effect Sunken.

Parameters:
m - mode

isBulk

public static boolean isBulk(int m)
True if m describes effect Bulk.

Parameters:
m - mode

isUline

public static boolean isUline(int m)
True if m describes effect Underline.

Parameters:
m - mode

isHref

public static boolean isHref(int m)
True if we are in Href mode.

Parameters:
m - mode

isFill

public static boolean isFill(int m)
True if m describes effect Fill.

Parameters:
m - mode

doHref

public void doHref(java.lang.String s,
                   int x,
                   int y,
                   int w,
                   int h)
callback routine for dynamic caption content should be overwritten by implementing classes

Parameters:
s - the href string (including href & text)
x - x pos of describing rect
y - y pos of describing rect
w - width of describing rect
h - height of describing rect

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Overwrite Component.setBounds() to recognize resizing

Overrides:
setBounds in class java.awt.Component

measure

public java.awt.Dimension measure()
Return currently needed Dimension Should be overridden by Awt Components


doMeasure

public void doMeasure()
Utility function for Awt Components re-measures an invalidates if dims changed


getRectangle

public java.awt.Rectangle getRectangle()
Get this comps rectangle totalsize - insets


getBorderRectangle

public java.awt.Rectangle getBorderRectangle()
Get this comps rectangle within border totalsize - insets - borderDepth


getInnerRectangle

public java.awt.Rectangle getInnerRectangle()
Get this comps inner rectangle totalsize - insets - borderDepth - innerInsets


invalidate

public void invalidate()
Overwrite java.awt.component.invalidate() to do measuring .

Overrides:
invalidate in class java.awt.Container

addNotify

public void addNotify()
override java.awt.Panel.addNotify() called shortly after instantiation first chance to call measure()

Overrides:
addNotify in class java.awt.Panel

getPreferredSize

public java.awt.Dimension getPreferredSize()
override java.awt.Panel.getPreferredSize() and return our minimum size

Overrides:
getPreferredSize in class java.awt.Container

getMinimumSize

public java.awt.Dimension getMinimumSize()
override java.awt.Panel.getMinimumSize()

Overrides:
getMinimumSize in class java.awt.Container
See Also:
getPreferredSize()

update

public void update(java.awt.Graphics g)
Overwrite java.awt.component.update() to avoid flickering .

Overrides:
update in class java.awt.Container

paint

public void paint(java.awt.Graphics g)
Actually do the work ... this basic paint() routine just draws the border. Should be overwritten.

Overrides:
paint in class java.awt.Container
Parameters:
g - Graphics object to use

paintBorder

public void paintBorder(java.awt.Graphics g,
                        int x,
                        int y,
                        int w,
                        int h)
Paint the border

Parameters:
g - Graphics object to use
x - x-position of describing rect
y - y-position of describing rect
w - width of describing rect
h - height of describing rect

paintBackground

public void paintBackground(java.awt.Graphics g)
Paint the Background

Parameters:
g - Graphics object to use

paintBackground

public void paintBackground(java.awt.Graphics g,
                            int x,
                            int y,
                            int w,
                            int h)
Paint the Background

Parameters:
g - Graphics object to use
x - x-position of describing rect
y - y-position of describing rect
w - width of describing rect
h - height of describing rect

paintBim

public void paintBim(java.awt.Graphics g)

makeBim

public void makeBim()

setBG

public void setBG(java.lang.Object b)
set the BG for this comp. BG can be one of null - use parent BG (or none) Image - use this Image String - use this filename/URL to load an Image Awt - inherit BG from this Awt component


setBGIfNull

public void setBGIfNull(java.lang.Object b)
set the BG for this comp only if none is currently present (even from parent)


getBG

public java.lang.Object getBG()
return the object currently used as BG for this comp Attn: all BG's are converted to Image the first time used So this routine usually returns Object type Image


getBGImage

public java.awt.Image getBGImage()
get the BG Image if any


getBGParent

public Awt getBGParent()
walk up the component tree to find a parent with a BG != null


getBGParentImage

public java.awt.Image getBGParentImage()
walk up the component tree to find a BG != null


waitForImage

public java.awt.Image waitForImage(java.awt.Image i)
wait for an Image to load completely

Parameters:
i - the image

tile

public java.awt.Image tile(java.awt.Image i,
                           java.awt.Dimension d)
scale (grow only) an Image to specified size by just filling it with the original from left to right, top down w, h will be rounded to the next multiple of original size

Parameters:
i - orinigal image
d - new dims

tile

public java.awt.Image tile(java.awt.Image i,
                           int w,
                           int h)
scale (grow only) an Image to specified size by just filling it with the original from left to right, top down w, h will be rounded to the next multiple of original size

Parameters:
i - orinigal image
w - new width
h - new height

setEnabled

public void setEnabled(boolean enabled)
override java.awt.Panel.setEnabled() just to recocnize state change

Overrides:
setEnabled in class java.awt.Component
Parameters:
enabled - enabled?

setVisible

public void setVisible(boolean v)
override java.awt.Panel.setVisible() just to recocnize state change

Overrides:
setVisible in class java.awt.Component
Parameters:
v - visible?

setInsets

public void setInsets(java.awt.Insets i)
sets a new border

Parameters:
i - the border around the component

getInsets

public java.awt.Insets getInsets()
get current border

Overrides:
getInsets in class java.awt.Container

setInnerInsets

public void setInnerInsets(java.awt.Insets i)
sets a new border


getInnerInsets

public java.awt.Insets getInnerInsets()
get current inner border


setBorderDepth

public void setBorderDepth(int d)
set borderdepth

Parameters:
d - depth in pixel

getBorderDepth

public int getBorderDepth()
get borderdepth


setBorderType

public void setBorderType(int t)
set bodertype

Parameters:
t - bordertype [TOP NONE BULK RAISED SUNKEN

setBorderType

public void setBorderType(java.lang.String t)
set bodertype - String version (attributes from property file)

Parameters:
t - bordertype [North(Top) None Bulk Raised Sundekn]

getBorderType

public int getBorderType()
get bodertype


setFont

public void setFont(java.awt.Font f)
override java.awt.Panel.setFont(Font font) just to recognize the change

Overrides:
setFont in class java.awt.Container

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
implement java.awt.event.MouseListener

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
implement java.awt.event.MouseListener

Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
implement java.awt.event.MouseListener

Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
implement java.awt.event.MouseListener

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
implement java.awt.event.MouseListener

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
implement java.awt.event.MouseListener

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
implement java.awt.event.MouseListener

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
implement java.awt.event.KeyListener

Specified by:
keyTyped in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
implement java.awt.event.KeyListener

Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
implement java.awt.event.KeyListener

Specified by:
keyReleased in interface java.awt.event.KeyListener

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
implement java.awt.event.AdjustmentListener

Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener

focusGained

public void focusGained(java.awt.event.FocusEvent e)
implement java.awt.event.FocusListener

Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
implement java.awt.event.FocusListener

Specified by:
focusLost in interface java.awt.event.FocusListener

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
implement java.awt.ItemSelectable

Specified by:
getSelectedObjects in interface java.awt.ItemSelectable

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
adds an actionListener

Parameters:
l - the actionListener to add

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
removes an actionListener

Parameters:
l - the actionListener to remove

notifyActionListeners

protected void notifyActionListeners(java.awt.event.ActionEvent e)
notifies all actionListeners

Parameters:
e - the event to post

addItemListener

public void addItemListener(java.awt.event.ItemListener l)
adds an itemListener

Specified by:
addItemListener in interface java.awt.ItemSelectable
Parameters:
l - the itemListener to add

removeItemListener

public void removeItemListener(java.awt.event.ItemListener l)
removes an itemListener

Specified by:
removeItemListener in interface java.awt.ItemSelectable
Parameters:
l - the itemListener to remove

notifyItemListeners

protected void notifyItemListeners(java.awt.event.ItemEvent e)
notifies all itemListeners

Parameters:
e - the event to post

[.home.]
[.hacks.]
[.java.]