fi.hut.tml.xsmiles.gui.components.havi
Class HaviSelectBoolean

java.lang.Object
  extended byfi.hut.tml.xsmiles.gui.components.general.ComponentBase
      extended byfi.hut.tml.xsmiles.gui.components.havi.HaviStylableComponent
          extended byfi.hut.tml.xsmiles.gui.components.havi.HaviSelectBase
              extended byfi.hut.tml.xsmiles.gui.components.havi.HaviSelectBoolean
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, org.ftv.ui.event.HActionListener, java.awt.ItemSelectable, XComponent, XSelect, XSelectBoolean

public class HaviSelectBoolean
extends HaviSelectBase
implements XSelectBoolean, org.ftv.ui.event.HActionListener, java.awt.ItemSelectable

An implementation of XSelectBoolean = a single checkbox

Author:
Mikko Honkala

Field Summary
protected  org.ftv.ui.HToggleButton button
           
protected  java.lang.String name
           
 
Fields inherited from class fi.hut.tml.xsmiles.gui.components.general.ComponentBase
content, currentFont, currentZoom, defaultBGColor, defaultFont, defaultSize, fInputMode, hintText, style
 
Constructor Summary
HaviSelectBoolean()
          A plain swing button
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          public Image loadImage(String s, Component comp) { try { Image image = null; URL resURL=this.getClass().getResource(s); Toolkit tk = Toolkit.getDefaultToolkit(); MediaTracker mt = new MediaTracker(comp); System.out.println(resURL.getFile()); // 1st try to find the image in the resources, 2nd from a file if (resURL!=null) image=tk.getImage(resURL); else image = tk.getImage(s); // mt.addImage(image, 1); // try { // mt.waitForID(1); // } catch (InterruptedException e) { // System.out.println("Error:" + e); // } return image; } catch (Throwable t) { t.printStackTrace(System.err); return null; } }
 java.awt.Component createComponent()
          creates the content component
 java.awt.Color getDefaultBackgroundColor()
          the default background color for this component null = transparent.
 java.awt.Dimension getMinimumSize()
          return the minimum size for this component at zoom level 1.0
 boolean getSelected()
           
 java.lang.Object[] getSelectedObjects()
           
 java.awt.Image loadImage(java.lang.String name, java.awt.Component comp)
           
 void setCaptionText(java.lang.String text)
           
 void setLabel(java.lang.String t)
           
 void setSelected(boolean selected)
           
 
Methods inherited from class fi.hut.tml.xsmiles.gui.components.havi.HaviSelectBase
addItemListener, addSelection, getSelectedIndex, removeAll, removeItemListener, removeSelection, setSelected, setSelectedIndex
 
Methods inherited from class fi.hut.tml.xsmiles.gui.components.havi.HaviStylableComponent
setBackground
 
Methods inherited from class fi.hut.tml.xsmiles.gui.components.general.ComponentBase
addActionListener, addFocusListener, addHelpListener, addMouseListener, getAddableComponent, getComponent, getDefaultSize, getEnabled, getFormatter, getHeight, getPreferredSize, getSizableComponent, getSize, getStylableComponent, getStyle, getWidth, getX, getY, removeActionListener, removeFocusListener, removeHelpListener, removeMouseListener, setBounds, setDefaultSize, setEnabled, setFocus, setFont, setForeground, setHintText, setInputMode, setStyle, setVisible, setZoom, sizeComponent, sizeComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fi.hut.tml.xsmiles.gui.components.XSelectBoolean
addItemListener, removeItemListener
 
Methods inherited from interface fi.hut.tml.xsmiles.gui.components.XComponent
addActionListener, addFocusListener, addHelpListener, addMouseListener, getComponent, getEnabled, getHeight, getSize, getStyle, getWidth, getX, getY, removeActionListener, removeFocusListener, removeHelpListener, removeMouseListener, setBackground, setBounds, setEnabled, setFocus, setForeground, setHintText, setInputMode, setStyle, setVisible, setZoom
 
Methods inherited from interface java.awt.ItemSelectable
addItemListener, removeItemListener
 

Field Detail

button

protected org.ftv.ui.HToggleButton button

name

protected java.lang.String name
Constructor Detail

HaviSelectBoolean

public HaviSelectBoolean()
A plain swing button

Method Detail

createComponent

public java.awt.Component createComponent()
creates the content component

Specified by:
createComponent in class HaviSelectBase

getDefaultBackgroundColor

public java.awt.Color getDefaultBackgroundColor()
the default background color for this component null = transparent.

Overrides:
getDefaultBackgroundColor in class ComponentBase

setCaptionText

public void setCaptionText(java.lang.String text)

setLabel

public void setLabel(java.lang.String t)

getMinimumSize

public java.awt.Dimension getMinimumSize()
return the minimum size for this component at zoom level 1.0

Overrides:
getMinimumSize in class ComponentBase

setSelected

public void setSelected(boolean selected)
Specified by:
setSelected in interface XSelectBoolean

getSelected

public boolean getSelected()
Specified by:
getSelected in interface XSelectBoolean

loadImage

public java.awt.Image loadImage(java.lang.String name,
                                java.awt.Component comp)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
public Image loadImage(String s, Component comp) { try { Image image = null; URL resURL=this.getClass().getResource(s); Toolkit tk = Toolkit.getDefaultToolkit(); MediaTracker mt = new MediaTracker(comp); System.out.println(resURL.getFile()); // 1st try to find the image in the resources, 2nd from a file if (resURL!=null) image=tk.getImage(resURL); else image = tk.getImage(s); // mt.addImage(image, 1); // try { // mt.waitForID(1); // } catch (InterruptedException e) { // System.out.println("Error:" + e); // } return image; } catch (Throwable t) { t.printStackTrace(System.err); return null; } }

Specified by:
actionPerformed in interface java.awt.event.ActionListener

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Specified by:
getSelectedObjects in interface java.awt.ItemSelectable


X-Smiles 1.2