コード例 #1
0
ファイル: ImageJ.java プロジェクト: Jondeen/imagej1
  /**
   * If 'applet' is not null, creates a new ImageJ frame that runs as an applet. If 'mode' is
   * ImageJ.EMBEDDED and 'applet is null, creates an embedded (non-standalone) version of ImageJ.
   */
  public ImageJ(java.applet.Applet applet, int mode) {
    super("ImageJ");
    embedded = applet == null && (mode == EMBEDDED || mode == NO_SHOW);
    this.applet = applet;
    String err1 = Prefs.load(this, applet);
    if (IJ.isLinux()) {
      backgroundColor = new Color(240, 240, 240);
      setBackground(backgroundColor);
    }
    Menus m = new Menus(this, applet);
    String err2 = m.addMenuBar();
    m.installPopupMenu(this);
    setLayout(new GridLayout(2, 1));

    // Tool bar
    toolbar = new Toolbar();
    toolbar.addKeyListener(this);
    add(toolbar);

    // Status bar
    statusBar = new Panel();
    statusBar.setLayout(new BorderLayout());
    statusBar.setForeground(Color.black);
    statusBar.setBackground(backgroundColor);
    statusLine = new Label();
    statusLine.setFont(SansSerif12);
    statusLine.addKeyListener(this);
    statusLine.addMouseListener(this);
    statusBar.add("Center", statusLine);
    progressBar = new ProgressBar(120, 20);
    progressBar.addKeyListener(this);
    progressBar.addMouseListener(this);
    statusBar.add("East", progressBar);
    statusBar.setSize(toolbar.getPreferredSize());
    add(statusBar);

    IJ.init(this, applet);
    addKeyListener(this);
    addWindowListener(this);
    setFocusTraversalKeysEnabled(false);

    Point loc = getPreferredLocation();
    Dimension tbSize = toolbar.getPreferredSize();
    int ijWidth = tbSize.width + 10;
    int ijHeight = 100;
    setCursor(Cursor.getDefaultCursor()); // work-around for JDK 1.1.8 bug
    if (mode != NO_SHOW) {
      if (IJ.isWindows())
        try {
          setIcon();
        } catch (Exception e) {
        }
      setBounds(loc.x, loc.y, ijWidth, ijHeight); // needed for pack to work
      setLocation(loc.x, loc.y);
      pack();
      setResizable(!(IJ.isMacintosh() || IJ.isWindows())); // make resizable on Linux
      show();
    }
    if (err1 != null) IJ.error(err1);
    if (err2 != null) {
      IJ.error(err2);
      IJ.runPlugIn("ij.plugin.ClassChecker", "");
    }
    m.installStartupMacroSet();
    if (IJ.isMacintosh() && applet == null) {
      Object qh = null;
      qh = IJ.runPlugIn("MacAdapter", "");
      if (qh == null) IJ.runPlugIn("QuitHandler", "");
    }
    if (applet == null) IJ.runPlugIn("ij.plugin.DragAndDrop", "");
    String str = m.getMacroCount() == 1 ? " macro" : " macros";
    IJ.showStatus(version() + m.getPluginCount() + " commands; " + m.getMacroCount() + str);
    // if (applet==null && !embedded && Prefs.runSocketListener)
    //	new SocketListener();
    configureProxy();
    if (applet == null) loadCursors();
  }
コード例 #2
0
ファイル: ImageJ.java プロジェクト: chrisp87/ImageJA
  /**
   * If 'applet' is not null, creates a new ImageJ frame that runs as an applet. If 'mode' is
   * ImageJ.EMBEDDED and 'applet is null, creates an embedded (non-standalone) version of ImageJ.
   */
  public ImageJ(java.applet.Applet applet, int mode) {
    super("ImageJ");
    if ((mode & DEBUG) != 0) IJ.setDebugMode(true);
    mode = mode & 255;
    if (IJ.debugMode) IJ.log("ImageJ starting in debug mode: " + mode);
    embedded = applet == null && (mode == EMBEDDED || mode == NO_SHOW);
    this.applet = applet;
    String err1 = Prefs.load(this, applet);
    setBackground(backgroundColor);
    Menus m = new Menus(this, applet);
    String err2 = m.addMenuBar();
    m.installPopupMenu(this);
    setLayout(new BorderLayout());

    // Tool bar
    toolbar = new Toolbar();
    toolbar.addKeyListener(this);
    add("Center", toolbar);

    // Status bar
    statusBar = new Panel();
    statusBar.setLayout(new BorderLayout());
    statusBar.setForeground(Color.black);
    statusBar.setBackground(backgroundColor);
    statusLine = new JLabel();
    statusLine.setFont(new Font("SansSerif", Font.PLAIN, 13));
    statusLine.addKeyListener(this);
    statusLine.addMouseListener(this);
    statusBar.add("Center", statusLine);
    progressBar = new ProgressBar(120, 20);
    progressBar.addKeyListener(this);
    progressBar.addMouseListener(this);
    statusBar.add("East", progressBar);
    add("South", statusBar);

    IJ.init(this, applet);
    addKeyListener(this);
    addWindowListener(this);
    setFocusTraversalKeysEnabled(false);
    m.installStartupMacroSet(); // add custom tools
    runStartupMacro();

    Point loc = getPreferredLocation();
    Dimension tbSize = toolbar.getPreferredSize();
    setCursor(Cursor.getDefaultCursor()); // work-around for JDK 1.1.8 bug
    if (mode != NO_SHOW) {
      if (IJ.isWindows())
        try {
          setIcon();
        } catch (Exception e) {
        }
      setLocation(loc.x, loc.y);
      setResizable(!IJ.isMacOSX());
      pack();
      setVisible(true);
    }
    if (err1 != null) IJ.error(err1);
    if (err2 != null) {
      IJ.error(err2);
      IJ.runPlugIn("ij.plugin.ClassChecker", "");
    }
    if (IJ.isMacintosh() && applet == null) {
      Object qh = null;
      qh = IJ.runPlugIn("MacAdapter", "");
      if (qh == null) IJ.runPlugIn("QuitHandler", "");
    }
    if (applet == null) IJ.runPlugIn("ij.plugin.DragAndDrop", "");
    String str = m.getMacroCount() == 1 ? " macro" : " macros";
    IJ.showStatus(version() + m.getPluginCount() + " commands; " + m.getMacroCount() + str);
    configureProxy();
    if (applet == null) loadCursors();
  }
コード例 #3
0
ファイル: d.java プロジェクト: krzysiobal/proze_literaczki
 public d(
     e e1, int i1, boolean flag, boolean flag1, Color acolor[], String s, Component acomponent[]) {
   p = e1;
   e1 = i1 != 2 || !flag1 ? 0 : 1;
   a = i1 + i1 % 2;
   c = 0;
   d = new m[a];
   h = new Button[a];
   i = new Button[a];
   l = new Panel[a];
   k = new Panel[a];
   n = new CardLayout[a];
   m = new CardLayout[a];
   if (flag) e = new Label[a];
   if (flag1) f = new Label[a];
   if (s != null) g = new Label[a];
   if (acolor != null) j = new x[a];
   if (e1 != 0) o = new x[a];
   setLayout(new GridLayout(a / 2, 2, 4, 6));
   for (acomponent = 0; acomponent < a; acomponent++) {
     Panel panel;
     (panel = new Panel()).setLayout(new BorderLayout(0, a > 1 ? 4 : 1));
     if (e1 != 0) panel.add("North", o[acomponent] = new x(new Dimension(25, 17), 2));
     Panel panel1;
     (panel1 = new Panel()).setBackground(a.a);
     panel1.setLayout(new BorderLayout(0, 1));
     Panel panel3;
     Panel panel4;
     (panel4 = c.n.a(panel3 = new Panel(), 1, new String[] {"East", "West", "North"}))
         .setFont(c.n.a(0));
     panel4.setForeground(Color.lightGray);
     Object obj;
     ((Container) (obj = new Panel())).setLayout(new GridLayout(1, 2, 0, 0));
     ((Container) (obj)).setLayout(new BorderLayout(0, 0));
     if (acolor != null)
       ((Container) (obj)).add("West", j[acomponent] = new x(acolor[acomponent]));
     Object obj1;
     ((Component) (obj1 = c.n.b(p.c(acomponent), 0, 2, 9))).setBackground(a.a);
     ((Component) (obj1)).setFont(c.n.a(0));
     ((Container) (obj)).add(acolor == null ? "West" : "Center", ((Component) (obj1)));
     if (s != null) {
       ((Component) (obj1 = c.n.b(s + "     ", acolor == null ? 0 : 2, 2, 8))).setFont(c.n.a(0));
       ((Container) (obj))
           .add(acolor == null ? "Center" : "East", g[acomponent] = ((Label) (obj1)));
     }
     panel4.add("Center", ((Component) (obj)));
     panel1.add("North", panel3);
     ((Container) (obj1 = new Panel())).setLayout(new BorderLayout(0, 0));
     l[acomponent] = new Panel();
     l[acomponent].setLayout(n[acomponent] = new CardLayout());
     panel4 = c.n.a(panel3 = new Panel(), 1, new String[] {"East", "West", "South"}, 0);
     d[acomponent] = new m("", 0, 0, -4);
     d[acomponent].setFont(c.n.a(5));
     d[acomponent].setBackground(Color.white);
     d[acomponent].setForeground(Color.black);
     panel4.add("Center", d[acomponent]);
     k[acomponent] = new Panel();
     k[acomponent].setLayout(m[acomponent] = new CardLayout());
     ((Component) (obj = c.n.g(""))).setBackground(Color.white);
     k[acomponent].add("0", ((Component) (obj)));
     k[acomponent].add("x", i[acomponent] = c.n.a("x", 3));
     panel4.add("East", k[acomponent]);
     l[acomponent].add("name", panel3);
     h[acomponent] = c.n.c(p.c("bl_sit"));
     l[acomponent].add("but", h[acomponent]);
     ((Container) (obj1)).add("Center", l[acomponent]);
     panel1.add("Center", ((Component) (obj1)));
     panel.add("Center", panel1);
     if (flag || flag1) {
       Panel panel2;
       (panel2 = new Panel()).setLayout(new GridLayout(1, 2, 3, 0));
       if (flag) {
         e[acomponent] = p.a(g.m.e.b(0), 1, 0, 4);
         Color color;
         if ((color = p.getBackground()) != null) e[acomponent].setBackground(color.brighter());
         panel2.add(e[acomponent]);
       }
       if (flag1) {
         f[acomponent] = c.n.b("00:00", flag ? 1 : 0, 0, 4);
         if (!flag && a <= 2) f[acomponent].setFont(c.n.a(6));
         panel2.add(f[acomponent]);
       } else {
         panel2.add(new Canvas());
       }
       if (!flag) panel2.add(new Canvas());
       panel.add("South", panel2);
     }
     if (acomponent < i1) add(panel);
     else add(new Panel());
   }
 }