Exemple #1
0
  PanelTest() {
    setLayout(new FlowLayout());

    p1 = new Panel();
    p2 = new Panel();
    b1 = new Button("패널2 보이기");
    b2 = new Button("패널2 안보이기");
    b3 = new Button("패널1 보이기");
    b4 = new Button("패널1 안보이기");

    p1.setBackground(Color.CYAN);
    p2.setBackground(Color.LIGHT_GRAY);

    p1.add(b1);
    p1.add(b2);
    p2.add(b3);
    p2.add(b4);

    add(p1);
    add(p2);

    b1.addActionListener(this);
    b2.addActionListener(this);
    b3.addActionListener(this);
    b4.addActionListener(this);

    setSize(400, 500);
    setVisible(true);
  }
Exemple #2
0
  void jbInit() throws Exception {
    panel1.setLayout(borderLayout1);
    panel2.setBackground(Color.yellow);
    panel2.setLayout(borderLayout2);
    ButtonOK.setLabel("OK");
    ButtonOK.addMouseListener(
        new java.awt.event.MouseAdapter() {

          public void mouseClicked(MouseEvent e) {
            ButtonOK_mouseClicked(e);
          }
        });

    String s1 = CallingApp.MotherApplet.GetName();

    textArea1.setBackground(SystemColor.control);
    textArea1.setEditable(false);

    panel1.add(panel2, BorderLayout.CENTER);
    panel2.add(textArea1, BorderLayout.CENTER);
    panel1.add(panel3, BorderLayout.SOUTH);
    panel3.add(ButtonOK, null);
    String s =
        s1
            + " v:"
            + CallingApp.MotherApplet.GetVersionNum()
            + "\n"
            + CallingApp.MotherApplet.GetInfos();
    textArea1.setText(s);
  }
Exemple #3
0
  ComponentSampleI() {
    // analise o uso do método abaixo
    // tf.setPreferredSize(new Dimension(200,20));

    // insere b e tf no painel
    p.add(b);
    p.add(tf);

    // insere o painel no norte do frame
    add(p, BorderLayout.NORTH);

    // atribui cor ao fundo e às letras na área de texto
    ta.setBackground(Color.cyan);
    ta.setForeground(Color.red);
    ta.setPreferredSize(new Dimension(250, 50));

    x.setBackground(Color.yellow);
    add(x, BorderLayout.CENTER); // estica o componente em ambas as direções

    add(ta, BorderLayout.EAST); // estica o componente na horizontal
    add(l, BorderLayout.SOUTH); // estica o componente na vertical

    // descobre as dimensões do monitor
    d = (Toolkit.getDefaultToolkit()).getScreenSize();

    // calcula e posiciona o frame no centro da tela
    setLocation(
        (d.width - this.getSize().width) / 2 - 150, (d.height - this.getSize().height) / 2 - 200);

    setSize(300, 400);
    setVisible(true);
  }
 public void adjustmentValueChanged(AdjustmentEvent e) {
   Object ob = e.getSource();
   int p, q, r;
   p = s1.getValue();
   q = s2.getValue();
   r = s3.getValue();
   Color c = new Color(p, q, r);
   p1.setBackground(c);
 }
Exemple #5
0
  /** init lays out the window and sets up components */
  public void init() {
    /*
     * BorderLayout just makes sure the Object in the Center gets most of
     * the screen
     */
    setLayout(new BorderLayout());
    // Information area where we can put some text occasionally
    info1 = new Label("Welcome !");
    // put it along the top
    add("North", info1);

    // Plotting area - create our own sky class
    theSky = new HealCanvas();
    // put it in the center of the window - most space
    add("Center", theSky);
    theSky.setupScene();
    theSky.showScene();

    // Create a panel to put the controls in - panel is a long strip
    FlowLayout fl = new FlowLayout(FlowLayout.CENTER, 1, 1);
    Panel p = new Panel(fl);

    // Create buttons and add this as Actionlistener - add them to panel
    Button quit = new Button("Quit");
    quit.addActionListener(this);
    p.add("West", quit);
    // put the panel at the bottom of the screen
    add("South", p);

    Panel rp = new Panel();
    rp.setBackground(Color.black);

    // rp.setLayout(new GridLayout(3,1));
    GridBagLayout gridbag = new GridBagLayout();
    rp.setLayout(gridbag);
    GridBagConstraints cons = new GridBagConstraints();
    cons.fill = GridBagConstraints.BOTH;
    cons.gridy = GridBagConstraints.RELATIVE;
    cons.gridx = 0;
    cons.ipadx = 0;
    cons.ipady = 10;

    HealPanel hpan = new HealPanel();
    hpan.setCanvas(theSky);
    gridbag.setConstraints(hpan, cons);
    rp.add(hpan);
    // Create control panel for rotations
    rotPanel = new RotatePanel();
    gridbag.setConstraints(rotPanel, cons);
    rp.add(rotPanel);
    // attach the rotPanel panel to the sky
    rotPanel.setScene(theSky);
    // add to right of screen
    this.add("East", rp);
    rotPanel.start();
  };
  /** Constructor. */
  private HeaderPanel() {
    setBackground(BACKGROUND_COLOR);
    setLayout(cardLayout);

    add(functionCard, FUNCTION);
    add(messageCard, MESSAGE);

    functionCard.setBackground(BACKGROUND_COLOR);
    functionCard.setLayout(new BorderLayout());

    messageCard.setBackground(BACKGROUND_COLOR);
    messageCard.setLayout(new BorderLayout());

    label.setFont(new Font("Dialog", Font.BOLD, 12));
    label.setAlignment(Label.CENTER);
    label.setForeground(Color.black);

    messageCard.add(label, BorderLayout.CENTER);
  }
Exemple #7
0
 /**
  * This method initializes panel1
  *
  * @return java.awt.Panel
  */
 private Panel getPanel1() {
   if (panel1 == null) {
     panel1 = new Panel();
     panel1.setLayout(null);
     panel1.setFont(new Font("Arial", Font.BOLD, 12));
     panel1.setName("");
     panel1.setBounds(new Rectangle(0, 78, 371, 4));
     panel1.setBackground(new Color(91, 155, 213));
   }
   return panel1;
 }
 /**
  * This method initializes PanelExquisiteMembershipLine
  *
  * @return java.awt.Panel
  */
 private Panel getPanelExquisiteMembershipLine() {
   if (PanelExquisiteMembershipLine == null) {
     PanelExquisiteMembershipLine = new Panel();
     PanelExquisiteMembershipLine.setLayout(null);
     PanelExquisiteMembershipLine.setBounds(new Rectangle(0, 78, 371, 4));
     PanelExquisiteMembershipLine.setFont(new Font("Arial", Font.BOLD, 12));
     PanelExquisiteMembershipLine.setMinimumSize(new Dimension(300, 4));
     PanelExquisiteMembershipLine.setName("");
     PanelExquisiteMembershipLine.setBackground(new Color(91, 155, 213));
   }
   return PanelExquisiteMembershipLine;
 }
Exemple #9
0
  public static void main(String[] args) {
    FrameWithPanel fwp = new FrameWithPanel("This is a Panel Test");
    fwp.setLayout(null);

    Panel p = new Panel();
    p.setSize(200, 150);
    p.setBackground(Color.yellow);

    fwp.add(p); // 프레임에  패널 추가
    fwp.setSize(400, 300);
    fwp.setBackground(Color.cyan);
    fwp.setVisible(true);
  }
  public void updateColor(Color c, Object source) {
    // record colour for the object
    rgb = c.getRGB();

    if (source != red && source != green && source != blue) {
      red.setIntValue((rgb & 0xff0000) >> 16);
      green.setIntValue((rgb & 0xff00) >> 8);
      blue.setIntValue((rgb & 0xff));

      hexText.setText("0x" + String.format("%06x", rgb & 0xffffff));
    }

    colorSample.setBackground(c);
    colorSample.repaint();
  }
Exemple #11
0
  public TheWorld() throws HeadlessException {
    super("This is the world, and God syas ...");
    p = new Panel();
    p.setBackground(Color.black);

    add(p);
    btnLand = new LetThereBeLandCommand("Let there be land", p);
    btnLight = new LetThereBeLightCommand("Let there be light", p);
    p.add(btnLand);
    p.add(btnLight);
    btnLight.addActionListener(this);
    btnLand.addActionListener(this);
    setBounds(100, 100, 400, 200);
    setVisible(true);
  }
Exemple #12
0
 /** ClipboardTest constructor comment. */
 public DictAWTView(String cfg) {
   super();
   IDictEngine e = org.dict.server.DatabaseFactory.getEngine(cfg);
   this.engine = e;
   f = new Frame("Dictionary lookup");
   f.setSize(600, 400);
   f.setLayout(new BorderLayout());
   ta = new TextArea();
   ta.setBackground(Color.white);
   ta.setForeground(Color.black);
   ta.addMouseListener(new ML());
   ta.addFocusListener(new FL());
   Button prev = new Button("History");
   prev.addActionListener(new History());
   mode = new Checkbox("Automatic", false);
   db = new Choice();
   for (int i = 0; i < e.getDatabases().length; i++) {
     db.add(e.getDatabases()[i].getName());
   }
   db.add("Any database");
   fontChoice = new Choice();
   fontChoice.add("serif");
   fontChoice.add("monospaced");
   fontChoice.add("dialog");
   fontChoice.addItemListener(new IL());
   sizeChoice = new Choice();
   sizeChoice.add("10");
   sizeChoice.add("12");
   sizeChoice.add("15");
   sizeChoice.addItemListener(new IL());
   Panel north = new Panel();
   north.setBackground(Color.lightGray);
   north.add(mode);
   north.add(db);
   north.add(fontChoice);
   north.add(sizeChoice);
   north.add(prev);
   f.add(north, "North");
   f.add(ta, "Center");
   f.addWindowListener(
       new WindowAdapter() {
         @Override
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   f.setVisible(true);
 }
Exemple #13
0
 /* WARNING: THIS METHOD WILL BE REGENERATED. */
 private java.awt.Panel getPanel1() {
   if (ivjPanel1 == null) {
     try {
       ivjPanel1 = new java.awt.Panel();
       ivjPanel1.setName("Panel1");
       ivjPanel1.setLayout(null);
       ivjPanel1.setBackground(java.awt.Color.white);
       ivjPanel1.setBounds(6, 5, 386, 60);
       // user code begin {1}
       // user code end
     } catch (java.lang.Throwable ivjExc) {
       // user code begin {2}
       // user code end
       handleException(ivjExc);
     }
   }
   return ivjPanel1;
 }
  /**
   * I Layout sono 3 intanto Layout esterno: è di tipo Border e ordina banner a nord e tastiera a
   * sud Layout del banner: è di tipo Border e ordina messaggio e casella di testo Layout tastiera:
   * è ovviamente una grid.
   */
  public void init() { // DICHIARO GLI OGGETTI DELLA APPLET, DEI PANNELLI. LI AGGIUNGO A QUESTA

    setLayout(new BorderLayout());

    Panel banner = new Panel();
    banner.setLayout(new BorderLayout());
    banner.setBackground(Color.RED);

    Label titolo = new Label("benvenuto in pCalc");
    banner.add(titolo, BorderLayout.NORTH);

    TextField risultato = new TextField(30);
    banner.add(risultato, BorderLayout.SOUTH);

    Panel tastiera = new Panel();
    tastiera.setLayout(new GridLayout(3, 3));

    Button tasto0 = new Button("0");
    tastiera.add(tasto0);
    Button tasto1 = new Button("1");
    tastiera.add(tasto1);
    Button tasto2 = new Button("2");
    tastiera.add(tasto2);
    Button tasto3 = new Button("3");
    tastiera.add(tasto3);
    Button tasto4 = new Button("4");
    tastiera.add(tasto4);
    Button tasto5 = new Button("5");
    tastiera.add(tasto5);
    Button tasto6 = new Button("6");
    tastiera.add(tasto6);
    Button tasto7 = new Button("7");
    tastiera.add(tasto7);
    Button tasto8 = new Button("8");
    tastiera.add(tasto8);
    Button tasto9 = new Button("9");
    tastiera.add(tasto9);

    add(banner, BorderLayout.NORTH);
    add(tastiera, BorderLayout.SOUTH);
  }
  public TheWorld() {
    super("This is the world, and God says...");

    p = new Panel();
    p.setBackground(Color.black);

    add(p);
    btnLight = new LetThereBeLightCommand("Let there be light", p);
    btnLand = new LetThereBeLandCommand("Let there be land", p);
    btnReset = new ResetCommand("Reset", p);
    btnExit = new GodRestsCommand("God rests");

    p.add(btnLight);
    p.add(btnLand);
    p.add(btnReset);
    p.add(btnExit);

    btnLight.addActionListener(this);
    btnLand.addActionListener(this);
    btnReset.addActionListener(this);
    btnExit.addActionListener(this);
    setBounds(100, 100, 400, 200);
    setVisible(true);
  }
  public void init() {
    try {
      robot = new Robot();
    } catch (AWTException ex) {
      ex.printStackTrace();
      throw new RuntimeException(ex);
    }
    this.setLayout(new BorderLayout());

    target.setBackground(Color.green);
    target.setName("GreenBox"); // for the ease of debug
    target.setPreferredSize(new Dimension(100, 100));
    String toolkit = Toolkit.getDefaultToolkit().getClass().getName();

    // on X systems two buttons are reserved for wheel though they are countable by MouseInfo.
    int buttonsNumber =
        toolkit.equals("sun.awt.windows.WToolkit")
            ? MouseInfo.getNumberOfButtons()
            : MouseInfo.getNumberOfButtons() - 2;

    for (int i = 0; i < 8; i++) {
      buttonNumber.add("BUTTON" + (i + 1) + "_MASK");
    }

    pressOn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println("Now pressing : " + (buttonNumber.getSelectedIndex() + 1));

            Timer timer = new Timer();
            TimerTask robotInteraction =
                new TimerTask() {
                  public void run() {
                    robot.mouseMove(updateTargetLocation().x, updateTargetLocation().y);
                    robot.mousePress(getMask(buttonNumber.getSelectedIndex() + 1));
                  }
                };
            timer.schedule(robotInteraction, SEND_DELAY);
          }
        });

    releaseOn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println("Now releasing : " + (buttonNumber.getSelectedIndex() + 1));
            Timer timer = new Timer();
            TimerTask robotInteraction =
                new TimerTask() {
                  public void run() {
                    robot.mouseMove(updateTargetLocation().x, updateTargetLocation().y);
                    robot.mouseRelease(getMask(buttonNumber.getSelectedIndex() + 1));
                  }
                };
            timer.schedule(robotInteraction, SEND_DELAY);
          }
        });

    clickOn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println("Now clicking : " + (buttonNumber.getSelectedIndex() + 1));
            Timer timer = new Timer();
            TimerTask robotInteraction =
                new TimerTask() {
                  public void run() {
                    robot.mouseMove(updateTargetLocation().x, updateTargetLocation().y);
                    robot.mousePress(getMask(buttonNumber.getSelectedIndex() + 1));
                    robot.mouseRelease(getMask(buttonNumber.getSelectedIndex() + 1));
                  }
                };
            timer.schedule(robotInteraction, SEND_DELAY);
          }
        });
    target.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
            Sysout.println("" + e);
          }

          public void mouseReleased(MouseEvent e) {
            Sysout.println("" + e);
          }

          public void mouseClicked(MouseEvent e) {
            Sysout.println("" + e);
          }
        });

    String[] instructions = {
      "Do provide an instruction to the robot by",
      "choosing the button number to act and ",
      "pressing appropriate java.awt.Button on the left.",
      "Inspect an output in the TextArea below.",
      "Please don't generate non-natural sequences like Release-Release, etc.",
      "If you use keyboard be sure that you released the keyboard shortly.",
      "If events are generated well press Pass, otherwise Fail."
    };
    Sysout.createDialogWithInstructions(instructions);
  } // End  init()
  void init() {
    int innerWidth = width - border * 2;

    /** Sketch */
    Panel sketchPanel = new Panel();
    sketchPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
    sketchPanel.setBackground(new Color(panelBG));
    sketchPanel.setPreferredSize(new Dimension(innerWidth, 270));

    CheckboxGroup sketchToolsGroup = new CheckboxGroup();
    Checkbox lineTool = new Checkbox("Line", sketchToolsGroup, true);
    lineTool.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.sketch.setCurrentTool(Sketch.Tool.LINE);
          }
        });
    Checkbox polygonTool = new Checkbox("Polygon", sketchToolsGroup, false);
    polygonTool.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.sketch.setCurrentTool(Sketch.Tool.POLYGON);
          }
        });
    Checkbox selectTool = new Checkbox("Select", sketchToolsGroup, false);
    selectTool.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.sketch.setCurrentTool(Sketch.Tool.SELECT);
          }
        });
    Checkbox moveTool = new Checkbox("Move", sketchToolsGroup, false);
    moveTool.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.sketch.setCurrentTool(Sketch.Tool.MOVE);
          }
        });

    strokeColor = new ColorWell();
    strokeColor.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            maker.sketch.setStrokeColor(strokeColor.getColor().getRGB());
          }
        });
    fillColor = new ColorWell();
    fillColor.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            maker.sketch.setFillColor(fillColor.getColor().getRGB());
          }
        });

    snapH = new Checkbox("Snap Horizontal (H)");
    snapH.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.sketch.snapToHorz = snapH.getState();
          }
        });
    snapV = new Checkbox("Snap Vertical (V)");
    snapV.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.sketch.snapToVert = snapV.getState();
          }
        });
    drawCurves = new Checkbox("Draw Curves (C)");
    drawCurves.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.sketch.drawCurves = drawCurves.getState();
          }
        });
    invertCurve = new Checkbox("Invert Curve (I)");
    invertCurve.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.sketch.invertCurve = invertCurve.getState();
          }
        });

    Button clearSketch = new Button("Clear");
    clearSketch.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.sketch.clear();
            maker.redraw();
          }
        });

    showSketchLines = new Checkbox("Grid Lines");
    showSketchLines.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.sketch.drawSnapGrid = showSketchLines.getState();
            maker.redraw();
          }
        });

    Button snapGridDecrement = new Button("Grid -");
    snapGridDecrement.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.sketch.snapGridDecrement();
            maker.redraw();
          }
        });
    Button snapGridIncrement = new Button("Grid +");
    snapGridIncrement.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.sketch.snapGridIncrement();
            maker.redraw();
          }
        });

    sketchPanel.add(new Label("Sketch"));
    sketchPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    sketchPanel.add(new Label("Tools"));
    sketchPanel.add(lineTool);
    sketchPanel.add(polygonTool);
    sketchPanel.add(selectTool);
    sketchPanel.add(moveTool);
    sketchPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    sketchPanel.add(new Label("Stroke"));
    sketchPanel.add(strokeColor);
    sketchPanel.add(new Label("Fill"));
    sketchPanel.add(fillColor);
    sketchPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    sketchPanel.add(snapH);
    sketchPanel.add(snapV);
    sketchPanel.add(drawCurves);
    sketchPanel.add(invertCurve);
    sketchPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    sketchPanel.add(clearSketch);
    sketchPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    sketchPanel.add(snapGridDecrement);
    sketchPanel.add(snapGridIncrement);
    sketchPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    sketchPanel.add(showSketchLines);

    /** Palette */
    Panel palettePanel = new Panel();
    palettePanel.setLayout(new FlowLayout(FlowLayout.LEADING));
    palettePanel.setBackground(new Color(panelBG));
    palettePanel.setPreferredSize(new Dimension(innerWidth, 110));

    Button addToPalette = new Button("Add Sketch Tile");
    addToPalette.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.palette.saveTileToPalette();
            maker.redraw();
          }
        });

    Button editTile = new Button("Edit Tile");
    editTile.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.palette.loadPaletteTileToSketch();
            maker.redraw();
          }
        });

    Button deleteTile = new Button("Delete Tile(s)");
    deleteTile.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.palette.deletePaletteTile();
            maker.redraw();
          }
        });

    Button clearPalette = new Button("Remove All");
    clearPalette.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.palette.clear();
            maker.redraw();
          }
        });

    palettePanel.add(new Label("Palette"));
    palettePanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    palettePanel.add(addToPalette);
    palettePanel.add(editTile);
    palettePanel.add(deleteTile);
    palettePanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    palettePanel.add(clearPalette);

    /** Grid */
    Panel gridPanel = new Panel();
    gridPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
    gridPanel.setBackground(new Color(panelBG));
    gridPanel.setPreferredSize(new Dimension(innerWidth, 270));

    CheckboxGroup toolsGroup = new CheckboxGroup();
    Checkbox paintTool = new Checkbox("Paint", toolsGroup, true);
    paintTool.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.getCurrentLayout().currentTool = Layout.Tool.PAINT;
          }
        });
    Checkbox lockTool = new Checkbox("Lock", toolsGroup, false);
    lockTool.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.getCurrentLayout().currentTool = Layout.Tool.LOCK;
          }
        });
    Checkbox gridSelectTool = new Checkbox("Select", toolsGroup, false);
    gridSelectTool.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.getCurrentLayout().currentTool = Layout.Tool.SELECT;
          }
        });
    Checkbox gridMoveTool = new Checkbox("Move", toolsGroup, false);
    gridMoveTool.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.getCurrentLayout().currentTool = Layout.Tool.MOVE;
          }
        });

    final Choice layoutChoice = new Choice();
    layoutChoice.add("Seamless Progressive");
    layoutChoice.add("Seamless Random");
    layoutChoice.add("Pure Random");

    layoutChoice.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            String l = layoutChoice.getSelectedItem();
            if (l == "Seamless Progressive") {
              maker.getCurrentLayout().currentLayout = Layout.LayoutType.SEAM_PROG;
            } else if (l == "Seamless Random") {
              maker.getCurrentLayout().currentLayout = Layout.LayoutType.SEAM_RND;
            } else if (l == "Pure Random") {
              maker.getCurrentLayout().currentLayout = Layout.LayoutType.RND;
            }
          }
        });

    Scrollbar percentageFull = new Scrollbar(Scrollbar.HORIZONTAL, 100, 20, 0, 120);
    percentageFull.setPreferredSize(new Dimension(innerWidth / 2, 20));
    percentageFull.addAdjustmentListener(
        new AdjustmentListener() {
          @Override
          public void adjustmentValueChanged(AdjustmentEvent e) {
            float amount = (float) e.getValue() / 100;
            maker.getCurrentLayout().percentageFull = amount;
          }
        });

    final Checkbox transformI = new Checkbox("I", true);
    transformI.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.orientationsToUse.put(
                TruchetMaker.Orientation.I.toString(), transformI.getState());
          }
        });
    final Checkbox transform90 = new Checkbox("90", true);
    transform90.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.orientationsToUse.put(
                TruchetMaker.Orientation.R90.toString(), transform90.getState());
          }
        });
    final Checkbox transform180 = new Checkbox("180", true);
    transform180.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.orientationsToUse.put(
                TruchetMaker.Orientation.R180.toString(), transform180.getState());
          }
        });
    final Checkbox transform270 = new Checkbox("270", true);
    transform270.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.orientationsToUse.put(
                TruchetMaker.Orientation.R270.toString(), transform270.getState());
          }
        });
    final Checkbox transformH = new Checkbox("H", true);
    transformH.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.orientationsToUse.put(
                TruchetMaker.Orientation.MH.toString(), transformH.getState());
          }
        });
    final Checkbox transformV = new Checkbox("V", true);
    transformV.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.orientationsToUse.put(
                TruchetMaker.Orientation.MV.toString(), transformV.getState());
          }
        });

    Button doLayout = new Button("Do Layout");
    doLayout.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            for (Layout l : maker.layouts) {
              l.doLayout();
            }
          }
        });

    Button clearGrid = new Button("Clear");
    clearGrid.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.getCurrentLayout().clear();
            maker.redraw();
          }
        });

    Button incrementGrid = new Button("Grid +");
    incrementGrid.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.getCurrentLayout().incrementGridSize();
            maker.redraw();
          }
        });
    Button decrementGrid = new Button("Grid -");
    decrementGrid.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.getCurrentLayout().decrementGridSize();
            maker.redraw();
          }
        });

    final Checkbox showGridLines = new Checkbox("Grid Lines");
    //		showGridLines.setState(maker.grid.drawGridLines); // not available at this point
    showGridLines.setState(true);
    showGridLines.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.getCurrentLayout().drawGridLines = showGridLines.getState();
            maker.redraw();
          }
        });

    showStateOverlay = new Checkbox("Show States");
    showStateOverlay.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            maker.getCurrentLayout().overlayVisible(showStateOverlay.getState());
            maker.redraw();
          }
        });

    gridPanel.add(new Label("Grid"));
    gridPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    gridPanel.add(new Label("Tools"));
    gridPanel.add(paintTool);
    gridPanel.add(lockTool);
    gridPanel.add(gridSelectTool);
    gridPanel.add(gridMoveTool);
    gridPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    gridPanel.add(new Label("Layout"));
    gridPanel.add(layoutChoice);
    gridPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    gridPanel.add(new Label("Empty"));
    gridPanel.add(percentageFull);
    gridPanel.add(new Label("Full"));
    gridPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    gridPanel.add(transformI);
    gridPanel.add(transform90);
    gridPanel.add(transform180);
    gridPanel.add(transform270);
    gridPanel.add(transformH);
    gridPanel.add(transformV);
    gridPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    gridPanel.add(doLayout);
    gridPanel.add(clearGrid);
    gridPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    gridPanel.add(decrementGrid);
    gridPanel.add(incrementGrid);
    gridPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    gridPanel.add(showGridLines);
    gridPanel.add(showStateOverlay);

    add(sketchPanel);
    add(palettePanel);
    add(gridPanel);

    Panel layoutsPanel = new Panel();
    layoutsPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
    layoutsPanel.setBackground(new Color(panelBG));
    layoutsPanel.setPreferredSize(new Dimension(innerWidth, 70));

    final Choice layouts = new Choice();
    layouts.setPreferredSize(new Dimension(100, 20));
    layouts.add("Grid 1");
    layouts.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            int i = layouts.getSelectedIndex();
            maker.setCurrentLayout(maker.layouts.get(i));
            maker.redraw();
          }
        });

    Button addLayout = new Button("Add Grid");
    addLayout.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.addLayout();
            layouts.add("Grid " + maker.layouts.size());
            maker.redraw();
          }
        });
    Button removeLayout = new Button("Remove Grid");
    removeLayout.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            maker.removeLayout();
            layouts.removeAll();
            for (int i = 0; i < maker.layouts.size(); i++) {
              layouts.add("Grid " + (i + 1));
              maker.redraw();
            }
          }
        });

    layoutsPanel.add(addLayout);
    layoutsPanel.add(removeLayout);
    layoutsPanel.add(Box.createRigidArea(new Dimension(innerWidth, 0)));
    layoutsPanel.add(layouts);
    add(layoutsPanel);

    addKeyListener(
        new KeyListener() {
          @Override
          public void keyPressed(KeyEvent e) {
            switch (e.getKeyCode()) {
              case KeyEvent.VK_C:
                maker.sketch.drawCurves = !maker.sketch.drawCurves;
                drawCurves.setState(maker.sketch.drawCurves);
                break;
              case KeyEvent.VK_I:
                maker.sketch.invertCurve = !maker.sketch.invertCurve;
                invertCurve.setState(maker.sketch.invertCurve);
                break;
              case KeyEvent.VK_H:
                maker.sketch.snapToHorz = !maker.sketch.snapToHorz;
                snapH.setState(maker.sketch.snapToHorz);
                break;
              case KeyEvent.VK_V:
                maker.sketch.snapToVert = !maker.sketch.snapToVert;
                snapV.setState(maker.sketch.snapToVert);
                break;
            }
          }

          @Override
          public void keyTyped(KeyEvent e) {
            // TODO Auto-generated method stub
          }

          @Override
          public void keyReleased(KeyEvent e) {
            // TODO Auto-generated method stub
          }
        });

    addWindowListener(
        new WindowListener() {

          @Override
          public void windowClosing(WindowEvent e) {
            //				dispose();
            //				System.exit(0);
          }

          @Override
          public void windowOpened(WindowEvent e) {
            // TODO Auto-generated method stub
          }

          @Override
          public void windowClosed(WindowEvent e) {
            // TODO Auto-generated method stub
          }

          @Override
          public void windowIconified(WindowEvent e) {
            // TODO Auto-generated method stub
          }

          @Override
          public void windowDeiconified(WindowEvent e) {
            // TODO Auto-generated method stub
          }

          @Override
          public void windowActivated(WindowEvent e) {
            // TODO Auto-generated method stub
          }

          @Override
          public void windowDeactivated(WindowEvent e) {
            // TODO Auto-generated method stub
          }
        });
  }
Exemple #18
0
 /**
  * Static Init
  *
  * @throws Exception
  */
 private void jbInit() throws Exception {
   this.setBackground(Color.white);
   this.setName("splash");
   this.setUndecorated(true);
   //
   productLabel.setAlignment(Label.CENTER);
   message.setFont(new java.awt.Font("Serif", 3, 20)); //  italic bold 20 pt
   message.setForeground(SystemColor.activeCaption);
   message.setAlignment(Label.CENTER);
   contentPanel.setLayout(contentLayout);
   contentPanel.setName("splashContent");
   contentPanel.setBackground(Color.white);
   //
   productLabel.setFont(new java.awt.Font("Serif", 2, 10));
   productLabel.setForeground(Color.blue);
   productLabel.setText(Adempiere.getSubtitle());
   //	productLabel.setToolTipText(Adempiere.getURL());
   //
   contentPanel.add(
       cImage,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(10, 5, 0, 10),
           0,
           0));
   contentPanel.add(
       productLabel,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 5, 0, 10),
           0,
           0));
   contentPanel.add(
       message,
       new GridBagConstraints(
           1,
           2,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(5, 5, 10, 10),
           0,
           0));
   //
   this.add(aImage, BorderLayout.WEST);
   this.add(contentPanel, BorderLayout.EAST);
 } //	jbInit
 public void Execute() {
   p.setBackground(Color.black);
 }
Exemple #20
0
/*
Exemple #21
0
  public void init() {
    sounds = new TetrisSound();
    installNewPiece();

    pause_resume_butt.setEnabled(false);
    start_newgame_butt.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            if (start_newgame_butt.getLabel().equals("Start")) startGame();
            else newGame();
          }
        });
    pause_resume_butt.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            if (pause_resume_butt.getLabel().equals("Pause")) pauseGame();
            else resumeGame();
          }
        });

    KeyListener key_listener =
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (timer.isPaused()) return;
            if (e.getKeyCode() == 37 || e.getKeyCode() == 39) {
              int dir = e.getKeyCode() == 37 ? -1 : 1;
              synchronized (timer) {
                cur_piece.cut();
                cur_piece.setX(cur_piece.getX() + dir);
                if (!cur_piece.canPaste()) cur_piece.setX(cur_piece.getX() - dir);
                cur_piece.paste();
              }
              game_grid.repaint();
            } else if (e.getKeyCode() == 38) {
              synchronized (timer) {
                cur_piece.cut();
                cur_piece.rotate();
                if (!cur_piece.canPaste()) cur_piece.rotateBack();
                cur_piece.paste();
              }
              game_grid.repaint();
            }
            if (e.getKeyCode() == 40) {
              timer.setFast(true);
            }
          }
        };

    start_newgame_butt.addKeyListener(key_listener);
    pause_resume_butt.addKeyListener(key_listener);

    Panel right_panel = new Panel(new GridLayout(3, 1));
    right_panel.setBackground(BACKGROUND_COLOR);

    Panel control_panel = new Panel();
    control_panel.add(start_newgame_butt);
    control_panel.add(pause_resume_butt);
    control_panel.setBackground(BACKGROUND_COLOR);
    right_panel.add(control_panel);

    Panel tmp = new Panel(new BorderLayout());
    tmp.add("North", new TetrisLabel("    Next Piece:"));
    tmp.add("Center", next_piece_canvas);
    tmp.setBackground(BACKGROUND_COLOR);
    right_panel.add(tmp);

    Panel stats_panel = new Panel(new GridLayout(4, 2));
    stats_panel.add(new TetrisLabel("    Rows Deleted: "));
    stats_panel.add(rows_deleted_label);
    stats_panel.add(new TetrisLabel("    Level: "));
    stats_panel.add(level_label);
    stats_panel.add(new TetrisLabel("    Score: "));
    stats_panel.add(score_label);
    stats_panel.add(new TetrisLabel("    High Score: "));
    stats_panel.add(high_score_label);
    tmp = new Panel(new BorderLayout());
    tmp.setBackground(BACKGROUND_COLOR);
    tmp.add("Center", stats_panel);
    right_panel.add(tmp);

    this.setLayout(new GridLayout(1, 2));
    this.add(game_grid);
    this.add(right_panel);
    this.setBackground(BACKGROUND_COLOR);
    this.validate();
  }
Exemple #22
0
  /**
   * 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();
  }
  public RatePlotFileDialogue(
      int X, int Y, int width, int height, Color fg, Color bg, String title, String text) {

    this.setLayout(new BorderLayout());
    this.setSize(width, height);
    this.setLocation(X, Y);

    Label topLabel = new Label(text, Label.CENTER);
    topLabel.setFont(warnFont);
    topLabel.setForeground(fg);
    topLabel.setBackground(bg);

    Panel midPanel = new Panel();
    midPanel.setBackground(bg);
    midPanel.setLayout(null);
    midPanel.add(hT);
    hT.setSize(width, 25);
    this.setTitle(title);

    hT.setForeground(fg);
    hT.setBackground(Color.white);
    hT.setFont(inputFont);
    this.add("North", topLabel);
    this.add("Center", midPanel);

    // Add Cancel and Save buttons

    Panel botPanel = new Panel();
    botPanel.setBackground(bg);
    botPanel.setFont(buttonFont);
    Label label1 = new Label();
    Label label2 = new Label();
    Label label3 = new Label();
    label2.setBackground(bg);
    label3.setBackground(bg);

    Button dismissButton = new Button("Cancel");
    Button saveButton = new Button("Save");
    botPanel.add(dismissButton);
    botPanel.add(label1);
    botPanel.add(saveButton);

    this.add("South", botPanel);
    this.add("West", label2);
    this.add("East", label3);

    // Add inner class event handler for Dismiss button

    dismissButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            hide();
            dispose();
          }
        }); // -- end inner class for Dismiss button processing

    // Add inner class event handler for postscript Save button

    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {

            // Following invokes gp.PSfile() to print the PS
            // file.  Can't invoke this method directly from
            // here because object gp is not recognized.  This
            // works by declaring
            // RateGraphicsPad instance gp to be static and then
            // invoking the static method makePS from RatePlotFrame
            // to in turn invoke gp.PSfile(file).  (Note the use
            // of the "RatePlotFileDialogue.this" construction to
            // invoke the "this" reference for the outer class
            // RatePlotFileDialogue from this anonymous inner class.)
            // In other applications, the second line of the if
            // clause would likely require modification to
            // correspond to the particular classes in use.

            if (RatePlotFileDialogue.this.hT.getText().length() > 0) {
              RatePlotFrame.makePS(RatePlotFileDialogue.this.hT.getText());
              hide();
              dispose();
            } else {

              makeTheWarning(
                  100,
                  100,
                  200,
                  100,
                  Color.black,
                  Color.lightGray,
                  "Warning",
                  "You must supply a file name!",
                  true,
                  RatePlotFileDialogue.this);

              return;
            }
          }
        });

    // Add window close button (inner class)

    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            hide();
            dispose();
          }
        });
  }
  public void makeTheWarning(
      int X,
      int Y,
      int width,
      int height,
      Color fg,
      Color bg,
      String title,
      String text,
      boolean oneLine,
      Frame frame) {

    Font warnFont = new java.awt.Font("SanSerif", Font.BOLD, 12);
    FontMetrics warnFontMetrics = getFontMetrics(warnFont);

    // Create Dialog window with modal blocking set to true.
    // Make final so inner class below can access it.

    final Dialog mww = new Dialog(frame, title, true);
    mww.setLayout(new BorderLayout());
    mww.setSize(width, height);
    mww.setLocation(X, Y);

    // Use Label for 1-line warning

    if (oneLine) {
      Label hT = new Label(text, Label.CENTER);
      hT.setForeground(fg);
      hT.setBackground(bg);
      hT.setFont(warnFont);
      mww.add("Center", hT);

      // Use TextArea for multiline warning

    } else {
      TextArea hT = new TextArea("", height, width, TextArea.SCROLLBARS_NONE);
      hT.setEditable(false);
      hT.setForeground(fg);
      hT.setBackground(bg); // no effect once setEditable (false)?
      hT.setFont(warnFont);
      mww.add("Center", hT);
      hT.appendText(text);
    }

    mww.setTitle(title);

    // Add dismiss button

    Panel botPanel = new Panel();
    botPanel.setBackground(Color.lightGray);
    Label label1 = new Label();
    Label label2 = new Label();

    Button dismissButton = new Button("Dismiss");
    botPanel.add(label1);
    botPanel.add(dismissButton);
    botPanel.add(label2);

    // Add inner class event handler for Dismiss button.  This must be
    // added to the dismissButton before botPanel is added to mww.

    dismissButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            mww.hide();
            mww.dispose();
          }
        });

    mww.add("South", botPanel);

    // Add window closing button (inner class)

    mww.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            mww.hide();
            mww.dispose();
          }
        });

    mww.show(); // Note that this show must come after all the above
    // additions; otherwise they are not added before the
    // window is displayed.
  }
Exemple #25
0
  /**
   * 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();
  }