Back to index

wims  3.65+svn20090927
Public Member Functions | Static Package Attributes
rene.gui.CloseFrame Class Reference

A Frame, which can be closed with the close button in the window frame. More...

Inheritance diagram for rene.gui.CloseFrame:
Inheritance graph
[legend]
Collaboration diagram for rene.gui.CloseFrame:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CloseFrame (String s)
 CloseFrame ()
void windowActivated (WindowEvent e)
void windowClosed (WindowEvent e)
void windowClosing (WindowEvent e)
void windowDeactivated (WindowEvent e)
void windowDeiconified (WindowEvent e)
void windowIconified (WindowEvent e)
void windowOpened (WindowEvent e)
boolean close ()
void actionPerformed (ActionEvent e)
void doAction (String o)
void doclose ()
 Closes the frame.
void itemAction (String o, boolean flag)
void seticon (String file)
void focusGained (FocusEvent e)
 Override to set the focus somewhere.
void focusLost (FocusEvent e)
void notePosition (String name)
 Note window position in Global.
void setPosition (String name)
 Set window position and size.
void front ()
void center ()
void centerOut (Frame f)

Static Package Attributes

static Hashtable Icons = new Hashtable()

Detailed Description

A Frame, which can be closed with the close button in the window frame.

This frame may set an icon. The icon file must be a GIF with 16x16 dots in 256 colors. We use the simple method, which does not work in the Netscape browser.

This Frame is a DoActionListener. Thus it is possible to use TextFieldAction etc. in it. Override doAction(String) and itemAction(String,boolean) to react on events.

Sometimes the Frame wants to set the focus to a certain text field. To support this, override focusGained().

Definition at line 50 of file CloseFrame.java.


Constructor & Destructor Documentation

rene.gui.CloseFrame.CloseFrame ( String  s) [inline]

Definition at line 52 of file CloseFrame.java.

{      public CloseFrame (String s)
       {      super(s);
           addWindowListener(this);
           addFocusListener(this);
       }

Here is the call graph for this function:

Definition at line 57 of file CloseFrame.java.

       {      addWindowListener(this);
           addFocusListener(this);
       }

Here is the caller graph for this function:


Member Function Documentation

void rene.gui.CloseFrame.actionPerformed ( ActionEvent  e) [inline]

Definition at line 76 of file CloseFrame.java.

       {   doAction(e.getActionCommand());
       }

Here is the call graph for this function:

void rene.gui.CloseFrame.center ( ) [inline]

Definition at line 184 of file CloseFrame.java.

       {      Dimension dscreen=getToolkit().getScreenSize();
              Dimension d=getSize();
              setLocation((dscreen.width-d.width)/2,(dscreen.height-d.height)/2);
       }

Here is the caller graph for this function:

void rene.gui.CloseFrame.centerOut ( Frame  f) [inline]

Definition at line 190 of file CloseFrame.java.

       {      Dimension si=f.getSize(),d=getSize(),
                     dscreen=getToolkit().getScreenSize();
              Point lo=f.getLocation();
              int x=lo.x+si.width-getSize().width+20;
              int y=lo.y+si.height/2+40;
              if (x+d.width>dscreen.width) x=dscreen.width-d.width-10;
              if (x<10) x=10;
              if (y+d.height>dscreen.height) y=dscreen.height-d.height-10;
              if (y<10) y=10;
              setLocation(x,y);
       }
Returns:
if the frame should close now.

Definition at line 73 of file CloseFrame.java.

       {      return true;
       }

Here is the caller graph for this function:

void rene.gui.CloseFrame.doAction ( String  o) [inline]

Implements rene.gui.DoActionListener.

Definition at line 79 of file CloseFrame.java.

       {   if ("Close".equals(o) && close()) doclose();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.CloseFrame.doclose ( ) [inline]

Closes the frame.

Override, if necessary, and call super.doclose().

Definition at line 87 of file CloseFrame.java.

       {      setMenuBar(null); // for Linux ?!
              setVisible(false); 
              // Because of a bug in Linux Java 1.4.2 etc.
              // dispose in a separate thread.
              Thread t=new Thread ()
              {      public void run ()
                     {      dispose();
                     }
              };
              t.start();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.CloseFrame.focusGained ( FocusEvent  e) [inline]

Override to set the focus somewhere.

Definition at line 133 of file CloseFrame.java.

{}
void rene.gui.CloseFrame.focusLost ( FocusEvent  e) [inline]

Definition at line 134 of file CloseFrame.java.

{}
void rene.gui.CloseFrame.front ( ) [inline]

Definition at line 180 of file CloseFrame.java.

       {      new ToFrontDelay(this);
       }
void rene.gui.CloseFrame.itemAction ( String  o,
boolean  flag 
) [inline]

Implements rene.gui.DoActionListener.

Definition at line 99 of file CloseFrame.java.

{}
void rene.gui.CloseFrame.notePosition ( String  name) [inline]

Note window position in Global.

Definition at line 139 of file CloseFrame.java.

       {      Point l=getLocation();
              Dimension d=getSize();
              Global.setParameter(name+".x",l.x);
              Global.setParameter(name+".y",l.y);
              Global.setParameter(name+".w",d.width);
              if (d.height-Global.getParameter(name+".h",0)!=19)
                     // works around a bug in Windows
                     Global.setParameter(name+".h",d.height);
              boolean maximized=false;
              if ((getExtendedState()&Frame.MAXIMIZED_BOTH)!=0)
                     Global.setParameter(name+".maximized",true);
              else
                     Global.removeParameter(name+".maximized");
       }

Here is the call graph for this function:

void rene.gui.CloseFrame.seticon ( String  file) [inline]

Definition at line 103 of file CloseFrame.java.

       {      try
              {      Object o=Icons.get(file);
                     if (o==null)
                     {      Image i;
                            InputStream in=getClass().getResourceAsStream("/"+file);
                            int pos=0;
                            int n=in.available();
                            byte b[]=new byte[20000];
                            while (n>0)
                            {      int k=in.read(b,pos,n);
                                   if (k<0) break;
                                   pos+=k;
                                   n=in.available();
                            }
                            i=Toolkit.getDefaultToolkit().createImage(b,0,pos);
                            MediaTracker T=new MediaTracker(this);
                            T.addImage(i,0);
                            T.waitForAll();
                            Icons.put(file,i);
                            setIconImage(i);
                     }
                     else
                     {      setIconImage((Image)o);
                     }
              } catch (Exception e) {}
       }
void rene.gui.CloseFrame.setPosition ( String  name) [inline]

Set window position and size.

Definition at line 158 of file CloseFrame.java.

       {      if (Global.getParameter(name+".maximized",false))
              {      setExtendedState(Frame.MAXIMIZED_BOTH);
                     return;
              }
              Point l=getLocation();
              Dimension d=getSize();
              Dimension dscreen=getToolkit().getScreenSize();
              int x=Global.getParameter(name+".x",l.x);
              int y=Global.getParameter(name+".y",l.y);
              int w=Global.getParameter(name+".w",d.width);
              int h=Global.getParameter(name+".h",d.height);
              if (w>dscreen.width) w=dscreen.width;
              if (h>dscreen.height) h=dscreen.height;
              if (x<0) x=0;
              if (x+w>dscreen.width) x=dscreen.width-w;
              if (y<0) y=0;
              if (y+h>dscreen.height) y=dscreen.height-h;
              setLocation(x,y);
              setSize(w,h);
       }

Here is the call graph for this function:

void rene.gui.CloseFrame.windowActivated ( WindowEvent  e) [inline]

Definition at line 61 of file CloseFrame.java.

{}
void rene.gui.CloseFrame.windowClosed ( WindowEvent  e) [inline]

Definition at line 62 of file CloseFrame.java.

{}
void rene.gui.CloseFrame.windowClosing ( WindowEvent  e) [inline]

Definition at line 63 of file CloseFrame.java.

       {   if (close()) doclose();
       }

Here is the call graph for this function:

void rene.gui.CloseFrame.windowDeactivated ( WindowEvent  e) [inline]

Definition at line 66 of file CloseFrame.java.

{}
void rene.gui.CloseFrame.windowDeiconified ( WindowEvent  e) [inline]

Definition at line 67 of file CloseFrame.java.

{}
void rene.gui.CloseFrame.windowIconified ( WindowEvent  e) [inline]

Definition at line 68 of file CloseFrame.java.

{}
void rene.gui.CloseFrame.windowOpened ( WindowEvent  e) [inline]

Definition at line 69 of file CloseFrame.java.

{}

Member Data Documentation

Hashtable rene.gui.CloseFrame.Icons = new Hashtable() [static, package]

Definition at line 102 of file CloseFrame.java.


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