com.cbse.jeasy
Class JEButton

java.lang.Object
  extended by com.cbse.jeasy.JEObject
      extended by com.cbse.jeasy.JEButton
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.util.EventListener

public class JEButton
extends JEObject
implements java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener

A class using JButton. The text of the button can be in html if you start the text with <html>text. In html you can create multiline text in colors and different fonts.

Properties
name values comment
id * Id of the object. Let it begin with BT_
text   Text inside the button
font To set an other font then defined in global
background   Id of a color used as the background
rolloverBackground   Id of a color used as the background if the mouse is over
foreground   Id of a color used as the textcolor
rolloverForeground   Id of a color used as the textcolor if the mouse is over
focusPainted true
false
On focus a rectangle is drawn around the button
contentAreaFilled true
false
Paint the region around the text on click
visibletrue
false
Set to false will hide the button.
enabledtrue
false
Enables or disables the component.
focusText   Text will be shown when the button has the focus.
rolloverText   Text will be shown when mouse is over the button.
pressedText   Text will be shown when the button is pressed.
icon   File for creating an ImageIcon
insets   An insets used to set the margins of the button
focusIcon   Icon will be shown when the button has the focus.
rolloverIcon   Icon will be shown when mouse is over the button.
pressedIcon   Icon will be shown when the button is pressed.
tooltip   Text in Tooltip
buttonConstraints   Constraints when added in GridBagLayout
horizontalAlignment LEADING
LEFT
CENTER
RIGHT
TRAILING
Sets the horizontal alignment of the icon and text.
verticalAlignment CENTER
TOP
BOTTOM
Sets the vertical alignment of the icon and text.
horizontalTextPosition LEADING
LEFT
CENTER
RIGHT
TRAILING
Sets the horizontal position of the text relative to the icon.
verticalTextPosition CENTER
TOP
BOTTOM
Sets the vertical position of the text relative to the icon.
* = property you have to set; bold = default value

Version:
%I%, %G%
Author:
H.Pfohl

Field Summary
 
Fields inherited from class com.cbse.jeasy.JEObject
DEVELOPPING, INPUT_ERROR_DATE, INPUT_ERROR_LENGTH, INPUT_ERROR_MANDATORY, INPUT_ERROR_PARSE, INPUT_ERROR_RANGE, INPUT_ERROR_TIME, INPUT_ERRORS, NO_INPUT_ERROR, RUNNING
 
Constructor Summary
JEButton(java.lang.String s)
          Reads the properties from a string
 
Method Summary
 void doClick()
          Programmatically perform a "click".
 void doClick(int pressTime)
          Programmatically perform a "click".
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 boolean getAntialiasing()
          Gets the anialialising flag
 java.awt.Color getBackground()
           
 javax.swing.JButton getButton()
          Gets the button
 JEButton getClonedButton()
          Gets a new instance of the JButton.
 javax.swing.JComponent getComponent()
          Gets the JComponent based on this JEasy Object
 java.awt.Font getFont()
          Gets the font
 java.awt.Color getForeground()
           
 java.awt.GradientPaint getGradientPaint()
           
 java.lang.String getIcon()
          Gets the icon
 java.awt.Insets getMargin()
           
 java.awt.Color getRolloverBackground()
           
 java.awt.Color getRolloverForeground()
           
 java.lang.String getText()
          Gets the text of the button
 java.awt.TexturePaint getTexturePaint()
           
 boolean isVisible()
          False if the Datafield should not be shown in a Table or Panel
 void JEadd(java.awt.Container co)
          Adds the JButton to a Container
 void JEadd(java.awt.Container co, java.awt.LayoutManager lm)
          Adds the JButton to a Container.
 void JEadd(java.lang.String border, java.awt.Container co)
          Adds the JButton to a Container with a BorderLayout
 void JEaddTab(javax.swing.JTabbedPane co, java.awt.LayoutManager lm)
          Adds the JButton to a JTabbedPane with its LayoutManager
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void setEnabled(boolean b)
          Sets the button enabled or disabled
 void setGradientPaint(java.awt.GradientPaint gp)
           
 void setText(java.lang.String s)
          Sets the text of the button
 void setVisible(boolean bv)
          setVisible of the label textfield and the button
 void start()
          Creates jfc-Objects with the given properties.
 
Methods inherited from class com.cbse.jeasy.JEObject
backupEntry, clear, deserializeValue, getApplet, getApplLocale, getCenter, getEast, getElementAt, getElementSize, getId, getJCallBack, getJClass, getLabel, getMode, getName, getNorth, getObjLocale, getParentId, getPreview, getProjectDirectory, getProperty, getRegisterText, getSouth, getStarted, getTitle, getType, getWest, getXMLtag, isEditable, isEnabled, isEnterprise, isProfessional, isStandard, JEadd, JEadd, JEadd, JEadd, JEadd, JEadd, JEadd, JEadd, removeProperties, removeProperty, restoreEntry, serializeValue, setApplet, setApplLocale, setEditable, setEditable, setEnabled, setFocus, setJCallBack, setMarkable, setMarkable, setMode, setObjLocale, setParentId, setPreview, setProjectDirectory, setProperty, setStarted, setVisible, wasEntryChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JEButton

public JEButton(java.lang.String s)
Reads the properties from a string

Parameters:
s - contains properties and values
See Also:
JE#PropertyString
Method Detail

doClick

public void doClick(int pressTime)
Programmatically perform a "click". This does the same thing as if the user had pressed and released the button. The button stays visually "pressed" for pressTime milliseconds.

Parameters:
pressTime -

doClick

public void doClick()
Programmatically perform a "click". This does the same thing as if the user had pressed and released the button.


getText

public java.lang.String getText()
Gets the text of the button

Returns:
String

setText

public void setText(java.lang.String s)
Sets the text of the button


getComponent

public javax.swing.JComponent getComponent()
Gets the JComponent based on this JEasy Object

Overrides:
getComponent in class JEObject
Returns:
JComponent

getIcon

public java.lang.String getIcon()
Gets the icon

Returns:
String

getFont

public java.awt.Font getFont()
Gets the font

Returns:
String

getButton

public javax.swing.JButton getButton()
Gets the button

Returns:
JButton

getClonedButton

public JEButton getClonedButton()
Gets a new instance of the JButton. The xml string to construct the JEButton is used again.

Returns:
JEButton

getBackground

public java.awt.Color getBackground()

getRolloverBackground

public java.awt.Color getRolloverBackground()

getForeground

public java.awt.Color getForeground()

getRolloverForeground

public java.awt.Color getRolloverForeground()

getMargin

public java.awt.Insets getMargin()

setGradientPaint

public void setGradientPaint(java.awt.GradientPaint gp)

getGradientPaint

public java.awt.GradientPaint getGradientPaint()

getTexturePaint

public java.awt.TexturePaint getTexturePaint()

setEnabled

public void setEnabled(boolean b)
Sets the button enabled or disabled

Overrides:
setEnabled in class JEObject

setVisible

public void setVisible(boolean bv)
setVisible of the label textfield and the button

Overrides:
setVisible in class JEObject

isVisible

public boolean isVisible()
False if the Datafield should not be shown in a Table or Panel

Overrides:
isVisible in class JEObject
Returns:
visible

getAntialiasing

public boolean getAntialiasing()
Gets the anialialising flag


start

public void start()
Creates jfc-Objects with the given properties. The font of the text is set to global.labelFont.

Overrides:
start in class JEObject

JEadd

public void JEadd(java.awt.Container co,
                  java.awt.LayoutManager lm)
Adds the JButton to a Container. Uses the constraints when the LayoutManager is a GridBagLayout.

Overrides:
JEadd in class JEObject
Parameters:
Container - where the JButton is added

JEadd

public void JEadd(java.lang.String border,
                  java.awt.Container co)
Adds the JButton to a Container with a BorderLayout

Overrides:
JEadd in class JEObject
Parameters:
String - "North" "South" "West" "East" "Center"
Container - where the JButton is added

JEadd

public void JEadd(java.awt.Container co)
Adds the JButton to a Container

Overrides:
JEadd in class JEObject
Parameters:
Container - where the JButton is added

JEaddTab

public void JEaddTab(javax.swing.JTabbedPane co,
                     java.awt.LayoutManager lm)
Adds the JButton to a JTabbedPane with its LayoutManager

Overrides:
JEaddTab in class JEObject
Parameters:
JTabbedPane - to hold the JEObject
LayoutManager - of the JTabbedPane

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener