Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Attributes | Package Attributes
rene.gui.ColorIcon Class Reference
Inheritance diagram for rene.gui.ColorIcon:
Inheritance graph
[legend]
Collaboration diagram for rene.gui.ColorIcon:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ColorIcon (IconBar bar, String name, Color colors[])
void dopaint (Graphics g)
 Paint a button with an image.
void pressed (MouseEvent e)
 Go up and down the pictures.
void setSelected (int s)
int getSelected ()
void processKeyEvent (KeyEvent e)
void paint (Graphics g)
 Paint a button with an image.
void showFocus (Graphics g)
void update (Graphics g)
void mousePressed (MouseEvent e)
 User pressed the mouse key over this button.
void mouseReleased (MouseEvent e)
 User released the mouse key again.
void mouseClicked (MouseEvent e)
synchronized void mouseEntered (MouseEvent e)
 Start a thread, that waits for one second, then tells the icon bar to display the proper help text.
void run ()
 A thread to display an icon help.
synchronized void mouseExited (MouseEvent e)
 Tell the run method, that display is no longer necessary, and remove the help text.
int width ()
void setPosition (int x, int y)
Point getPosition ()
void setEnabled (boolean flag)
String getName ()
boolean hasFocus ()
void setFocus (boolean flag)
boolean isSet ()
void unset (boolean flag)
void unset ()

Static Public Attributes

static int Size = 22

Package Attributes

Color Colors []
int N
Image I []
int Selected
int X []
int Y []
int W []
int H []
IconBar Bar
String Name
boolean Enabled
boolean On
boolean Focus = false
boolean MouseOver
boolean MouseDown
boolean Unset
Thread T
boolean Control

Detailed Description

Author:
Rene A toggle icon for several colors.

Definition at line 499 of file IconBar.java.


Constructor & Destructor Documentation

rene.gui.ColorIcon.ColorIcon ( IconBar  bar,
String  name,
Color  colors[] 
) [inline]

Definition at line 501 of file IconBar.java.

       {      super(bar,name);
              N=colors.length;
              Colors=colors;
       }

Member Function Documentation

void rene.gui.ColorIcon.dopaint ( Graphics  g) [inline]

Paint a button with an image.

Reimplemented from rene.gui.MultipleIcon.

Definition at line 506 of file IconBar.java.

       {      g.setColor(Colors[Selected]);
              g.fill3DRect(5,5,Size-10,Size-10,true);
       }      
String rene.gui.BasicIcon.getName ( ) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 277 of file IconBar.java.

       {      return Name;
       }

Here is the caller graph for this function:

Point rene.gui.BasicIcon.getPosition ( ) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 267 of file IconBar.java.

       {      return getLocationOnScreen();
       }
int rene.gui.MultipleIcon.getSelected ( ) [inline, inherited]

Definition at line 476 of file IconBar.java.

       {      return Selected;
       }
boolean rene.gui.BasicIcon.hasFocus ( ) [inline, inherited]

Definition at line 281 of file IconBar.java.

{ return Focus; }
boolean rene.gui.BasicIcon.isSet ( ) [inline, inherited]

Definition at line 286 of file IconBar.java.

       {      return !Unset;
       }      

Here is the caller graph for this function:

void rene.gui.BasicIcon.mouseClicked ( MouseEvent  e) [inline, inherited]

Reimplemented in rene.gui.StateDisplay.

Definition at line 189 of file IconBar.java.

{}
synchronized void rene.gui.BasicIcon.mouseEntered ( MouseEvent  e) [inline, inherited]

Start a thread, that waits for one second, then tells the icon bar to display the proper help text.

Definition at line 198 of file IconBar.java.

       {      if (T!=null) return;
              if (Enabled) MouseOver=true;
              repaint();
              if (!Global.getParameter("iconbar.showtips",true)) return;
              Control=e.isControlDown();
              T=new Thread(this);
              T.start();
       }

Here is the call graph for this function:

synchronized void rene.gui.BasicIcon.mouseExited ( MouseEvent  e) [inline, inherited]

Tell the run method, that display is no longer necessary, and remove the help text.

Definition at line 250 of file IconBar.java.

       {      T=null;
              MouseOver=false;
              repaint();
              Bar.removeHelp();
       }

Here is the call graph for this function:

void rene.gui.BasicIcon.mousePressed ( MouseEvent  e) [inline, inherited]

User pressed the mouse key over this button.

Reimplemented in rene.gui.StateDisplay.

Definition at line 149 of file IconBar.java.

       {      if (!Enabled) return;
              MouseDown=true; repaint();
       }
void rene.gui.BasicIcon.mouseReleased ( MouseEvent  e) [inline, inherited]

User released the mouse key again.

Reimplemented in rene.gui.StateDisplay.

Definition at line 157 of file IconBar.java.

       {      if (!Enabled) return;
              MouseDown=false;
              Dimension d=getSize();
              if (e.getX()<0 || e.getX()>d.width ||
                     e.getY()<0 || e.getY()>d.height) 
              {      repaint(); return;
              }
              Unset=false;
              pressed(e); // call method for children to change states etc.
              repaint();
              T=null; // stop icon help thread
              // Notify Iconbar about activation:
              long time=System.currentTimeMillis();
              Bar.iconPressed(Name,e.isShiftDown(),e.isControlDown());
              // Necessary, since Java 1.4 does not report
              // MouseExited, if a modal dialog is active:
              time=System.currentTimeMillis()-time;
              if (MouseOver && time>1000) 
              {      MouseOver=false;
                     repaint();
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.BasicIcon.paint ( Graphics  g) [inline, inherited]

Paint a button with an image.

Reimplemented in rene.gui.StateDisplay.

Definition at line 87 of file IconBar.java.

       {      if (MouseDown)
              {      g.setColor(getBackground());
                     g.fill3DRect(0,0,Size,Size,false);
              }
              else
              {      if (MouseOver)
                     {      if (On)
                            {      Color c=getBackground();
                                   g.setColor(
                                          new SaveColor(c.getRed()-30,c.getGreen()-30,c.getBlue()));
                            }
                            else g.setColor(getBackground());
                            g.fill3DRect(0,0,Size,Size,true);
                     }
                     else
                     {      if (On)
                            {      Color c=getBackground();
                                   g.setColor(c);
                                   g.fillRect(0,0,Size,Size);
                                   g.setColor(
                                          new SaveColor(c.getRed()-100,c.getGreen()-100,c.getBlue()));
                                   g.fillRect(3,3,Size-2,Size-2);
                                   g.setColor(
                                          new SaveColor(c.getRed()-50,c.getGreen()-50,c.getBlue()));
                                   g.fillRect(1,1,Size-2,Size-2);
                            }
                            else
                            {      g.setColor(getBackground());
                                   g.fillRect(0,0,Size,Size);
                            }
                     }
              }
              dopaint(g);   
              if (Unset)
              {      Color c=getBackground();
                     g.setColor(
                            new SaveColor(c.getRed()-100,c.getGreen(),c.getBlue()));
                     g.drawLine(0,0,Size,Size);
              }      
              if (Focus) showFocus(g);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.MultipleIcon.pressed ( MouseEvent  e) [inline, inherited]

Go up and down the pictures.

Reimplemented from rene.gui.BasicIcon.

Definition at line 459 of file IconBar.java.

       {      if (e.isMetaDown())
              {      Selected--; 
                     if (Selected<0) Selected=N-1;
              }
              else
              {      Selected++; 
                     if (Selected>=N) Selected=0;
              }
       }
void rene.gui.BasicIcon.processKeyEvent ( KeyEvent  e) [inline, inherited]

Definition at line 80 of file IconBar.java.

       {      Bar.getKey(e);
       }

Here is the call graph for this function:

void rene.gui.BasicIcon.run ( ) [inline, inherited]

A thread to display an icon help.

Definition at line 211 of file IconBar.java.

       {      try
              {      Thread.sleep(1000);
              }
              catch (Exception e) {}
              if (T!=null)
              {      synchronized(this)
                     {      try
                            {      Point P=getLocationOnScreen();
                                   String help=Global.name("iconhelp."+Name,"");
                                   if (help.equals("") && Name.length()>1)
                                   {      help=Global.name("iconhelp."+
                                                 Name.substring(0,Name.length()-1)+"?","");
                                   }
                                   if (help.equals(""))
                                          help=Bar.getHelp(Name);
                                   if (help.equals(""))
                                          help=Global.name("iconhelp.nohelp","No help available");
                                   if (Control)
                                   {      String hc=Global.name("iconhelp.control."+Name,"");
                                          if (!hc.equals("")) help=hc;
                                   }
                                   Bar.displayHelp(this,help);
                            }
                            catch (Exception e) {}
                     }
                     try
                     {      Thread.sleep(5000);
                     }
                     catch (Exception e) {}
                     if (T!=null) Bar.removeHelp();
                     T=null;
              }
       }

Here is the call graph for this function:

void rene.gui.BasicIcon.setEnabled ( boolean  flag) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 271 of file IconBar.java.

       {      if (Enabled==flag) return;
              Enabled=flag;
              repaint();
       }

Here is the caller graph for this function:

void rene.gui.BasicIcon.setFocus ( boolean  flag) [inline, inherited]

Definition at line 282 of file IconBar.java.

{ Focus=flag; repaint(); }  

Here is the caller graph for this function:

void rene.gui.BasicIcon.setPosition ( int  x,
int  y 
) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 263 of file IconBar.java.

       {      setLocation(x,y);
       }
void rene.gui.MultipleIcon.setSelected ( int  s) [inline, inherited]

Definition at line 470 of file IconBar.java.

       {      if (Selected==s) return;
              Selected=s;
              repaint();
       }
void rene.gui.BasicIcon.showFocus ( Graphics  g) [inline, inherited]

Definition at line 130 of file IconBar.java.

       {      g.setColor(Color.white);
              g.drawRect(4,4,1,1);
              g.drawRect(Size-5,4,1,1);
              g.drawRect(4,Size-5,1,1);
              g.drawRect(Size-5,Size-5,1,1);
       }

Here is the caller graph for this function:

void rene.gui.BasicIcon.unset ( boolean  flag) [inline, inherited]

Definition at line 289 of file IconBar.java.

       {      Unset=flag;
       }

Here is the caller graph for this function:

void rene.gui.BasicIcon.unset ( ) [inline, inherited]

Reimplemented in rene.gui.ToggleIcon.

Definition at line 292 of file IconBar.java.

       {      unset(true);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.BasicIcon.update ( Graphics  g) [inline, inherited]

Definition at line 142 of file IconBar.java.

       {      paint(g);
       }

Here is the call graph for this function:

int rene.gui.BasicIcon.width ( ) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 259 of file IconBar.java.

       {      return Size;
       }

Here is the caller graph for this function:


Member Data Documentation

IconBar rene.gui.BasicIcon.Bar [package, inherited]

Definition at line 64 of file IconBar.java.

Color rene.gui.ColorIcon.Colors[] [package]

Definition at line 500 of file IconBar.java.

boolean rene.gui.BasicIcon.Control [package, inherited]

Definition at line 192 of file IconBar.java.

boolean rene.gui.BasicIcon.Enabled [package, inherited]

Definition at line 66 of file IconBar.java.

boolean rene.gui.BasicIcon.Focus = false [package, inherited]

Definition at line 68 of file IconBar.java.

int rene.gui.MultipleIcon.H[] [package, inherited]

Definition at line 395 of file IconBar.java.

Image rene.gui.MultipleIcon.I[] [package, inherited]

Definition at line 393 of file IconBar.java.

boolean rene.gui.BasicIcon.MouseDown [package, inherited]

Definition at line 70 of file IconBar.java.

boolean rene.gui.BasicIcon.MouseOver [package, inherited]

Definition at line 70 of file IconBar.java.

int rene.gui.MultipleIcon.N [package, inherited]

Definition at line 392 of file IconBar.java.

String rene.gui.BasicIcon.Name [package, inherited]

Definition at line 65 of file IconBar.java.

boolean rene.gui.BasicIcon.On [package, inherited]

Definition at line 67 of file IconBar.java.

int rene.gui.MultipleIcon.Selected [package, inherited]

Definition at line 394 of file IconBar.java.

int rene.gui.BasicIcon.Size = 22 [static, inherited]

Definition at line 69 of file IconBar.java.

Thread rene.gui.BasicIcon.T [package, inherited]

Definition at line 191 of file IconBar.java.

boolean rene.gui.BasicIcon.Unset [package, inherited]

Definition at line 71 of file IconBar.java.

int rene.gui.MultipleIcon.W[] [package, inherited]

Definition at line 395 of file IconBar.java.

int rene.gui.MultipleIcon.X[] [package, inherited]

Definition at line 395 of file IconBar.java.

int rene.gui.MultipleIcon.Y[] [package, inherited]

Definition at line 395 of file IconBar.java.


The documentation for this class was generated from the following file: