Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
PlugInFrame.java
1 package ij.plugin.frame;
2 import java.awt.*;
3 import java.awt.event.*;
4 import ij.*;
5 import ij.plugin.*;
6 import javax.swing.*;
7 
9 public class PlugInFrame extends JFrame implements PlugIn, WindowListener, FocusListener {
10 
11  String title;
12 
13  public PlugInFrame(String title) {
14  super(title);
15  enableEvents(AWTEvent.WINDOW_EVENT_MASK);
16  this.title = title;
17  ImageJ ij = IJ.getInstance();
18  addWindowListener(this);
19  addFocusListener(this);
20  setBackground(Color.white);
21  if (IJ.debugMode) IJ.log("opening "+title);
22  setSize(220, 440);
23  Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
24  setLocation(screen.width - 240, (screen.height / 2) - 220);
25  }
26 
27  public void run(String arg) {
28  }
29 
30  public void windowClosing(WindowEvent e) {
31  if (e.getSource()==this)
32  close();
33  }
34 
36  public void close() {
37  setVisible(false);
38  dispose();
39  }
40 
41  public void windowActivated(WindowEvent e) {
42  if (IJ.isMacintosh() && IJ.getInstance()!=null) {
43  IJ.wait(1); // needed for 1.4.1 on OS X
44  setJMenuBar(Menus.getMenuBar());
45  }
46  }
47 
48  public void focusGained(FocusEvent e) {
49  //IJ.log("PlugInFrame: focusGained");
50  }
51 
52  public void windowOpened(WindowEvent e) {}
53  public void windowClosed(WindowEvent e) {}
54  public void windowIconified(WindowEvent e) {}
55  public void windowDeiconified(WindowEvent e) {}
56  public void windowDeactivated(WindowEvent e) {}
57  public void focusLost(FocusEvent e) {}
58 }