Example #1
0
  private void generateContent(JPanel buttonJP) {

    buttonJP.setLayout(new BoxLayout(buttonJP, BoxLayout.LINE_AXIS));
    buttonJP.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    JButton save = new JButton("Save");
    save.setSize(100, 50);
    save.setMaximumSize(save.getSize());
    save.addMouseListener(generateSaveMouseListener());
    save.setFocusable(false);

    JButton load = new JButton("Load");
    load.setSize(100, 50);
    load.setMaximumSize(load.getSize());
    load.addMouseListener(generateLoadMouseListener());
    load.setFocusable(false);

    this.fileNameTF = new JTextField();
    this.fileNameTF.setSize(190, 50);
    this.fileNameTF.setMaximumSize(this.fileNameTF.getSize());
    this.fileNameTF.setText("Mr.Freezer");

    buttonJP.add(save);
    buttonJP.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonJP.add(load);
    buttonJP.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonJP.add(this.fileNameTF);
  }
  /** Display the forwards window history in a menu. */
  private void onShowForwardHistory() {

    UIScrollableMenu hist =
        new UIScrollableMenu(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.forwardHistory"),
            0); //$NON-NLS-1$

    Vector views = history.getForwardHistory();
    int currentIndex = history.getCurrentPosition();

    int count = views.size();
    if (count == 0) return;

    JMenuItem item = null;
    for (int i = 0; i < count; i++) {
      View view = (View) views.elementAt(i);
      item = new JMenuItem(view.getLabel());

      final View fview = view;
      final int fi = (currentIndex + 1) + i;
      item.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              if (history.goToHistoryItem(fi)) oParent.addViewToDesktop(fview, fview.getLabel());
            }
          });

      hist.add(item);
    }

    JPopupMenu pop = hist.getPopupMenu();
    pop.pack();

    Point loc = pbShowForwardHistory.getLocation();
    Dimension size = pbShowForwardHistory.getSize();
    Dimension popsize = hist.getPreferredSize();
    Point finalP = SwingUtilities.convertPoint(tbrToolBar.getParent(), loc, oParent.getDesktop());

    int x = 0;
    int y = 0;
    if (oManager.getLeftToolBarController().containsBar(tbrToolBar)) {
      x = finalP.x + size.width;
      y = finalP.y;
    } else if (oManager.getRightToolBarController().containsBar(tbrToolBar)) {
      x = finalP.x - popsize.width;
      y = finalP.y;
    } else if (oManager.getTopToolBarController().containsBar(tbrToolBar)) {
      x = finalP.x;
      y = finalP.y + size.width;
    } else if (oManager.getBottomToolBarController().containsBar(tbrToolBar)) {
      x = finalP.x;
      y = finalP.y - popsize.height;
    }

    hist.setPopupMenuVisible(true);
    pop.show(oParent.getDesktop(), x, y);
  }
Example #3
0
  private void generatePlayButtonPanelContent(JPanel buttonJP) {

    buttonJP.setLayout(new BoxLayout(buttonJP, BoxLayout.X_AXIS));
    buttonJP.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    JButton next = new JButton("Next");
    next.setSize(75, 50);
    next.setMaximumSize(next.getSize());
    next.addMouseListener(generateNextMouseListener());
    next.setFocusable(false);

    JButton viewRanking = new JButton("Ranking");
    viewRanking.setSize(85, 50);
    viewRanking.setMaximumSize(viewRanking.getSize());
    viewRanking.addMouseListener(generateViewRankingMouseListener());
    viewRanking.setFocusable(false);

    this.scoreL = new JLabel("Score so far: ");
    this.scoreL.setSize(200, 50);
    this.scoreL.setMaximumSize(this.scoreL.getSize());

    JButton saveScore = new JButton("Save Score");
    saveScore.setSize(100, 50);
    saveScore.setMaximumSize(saveScore.getSize());
    saveScore.addMouseListener(generateSaveScoreMouseListener());
    saveScore.setFocusable(false);

    JButton end = new JButton("End");
    end.setSize(100, 50);
    end.setMaximumSize(saveScore.getSize());
    end.addMouseListener(generateEndMouseListener());
    end.setFocusable(false);

    buttonJP.add(next);
    buttonJP.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonJP.add(viewRanking);
    buttonJP.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonJP.add(this.scoreL);
    buttonJP.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonJP.add(saveScore);
    buttonJP.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonJP.add(end, BorderLayout.AFTER_LAST_LINE);
  }
Example #4
0
  public void doPlugin() {
    JPopupMenu popup = new JPopupMenu();
    int classification = StarMadeLogic.getInstance().getCurrentModel().getClassification();
    List<IBlocksPlugin> plugins =
        StarMadeLogic.getBlocksPlugins(classification, IBlocksPlugin.SUBTYPE_PAINT);
    if (plugins.isEmpty()) {
      popup.add("no plugins");
    }

    for (IBlocksPlugin plugin : plugins) {
      BlocksPluginAction action = new BlocksPluginAction(getClient(), plugin);
      JMenuItem men = new JMenuItem(action);
      popup.add(men);
    }
    Dimension d = mPlugins.getSize();
    popup.show(mPlugins, d.width, d.height);
  }
Example #5
0
  private void addComponents() {
    @SuppressWarnings("unused")
    LabelsMousePointGet labelsMousePointGet = new LabelsMousePointGet();
    for (int i = 0; i < 4; i++) {
      this.add(LabelsMousePointGet.label[i]);
    }
    JLabel pageLabel = new JLabel("");
    panelTable = new PanelTable(pageLabel);
    // ------Add align all button-----
    ButtonAllCheck buttonAllCheck = new ButtonAllCheck(panelTable, ButtonAllCheck.ALIGN_ALL);
    this.add(buttonAllCheck);
    buttonAllCheck.setBounds(
        PANEL_TABLE_SIZE.width / 5, PANEL_TABLE_SIZE.height + 55, dialWidth, dialHeight);
    // ------
    // ------Add align none button-----
    ButtonAllCheck buttonAllUnCheck = new ButtonAllCheck(panelTable, ButtonAllCheck.ALIGN_NONE);
    this.add(buttonAllUnCheck);
    buttonAllUnCheck.setBounds(
        PANEL_TABLE_SIZE.width * 3 / 5, PANEL_TABLE_SIZE.height + 55, dialWidth, dialHeight);

    // ------
    this.add(panelTable);
    panelTable.setBounds(0, 50, PANEL_TABLE_SIZE.width, PANEL_TABLE_SIZE.height);
    this.add(pageLabel);
    pageLabel.setBounds(PANEL_TABLE_SIZE.width / 2 - 50, PANEL_TABLE_SIZE.height + 50, 100, 20);

    // panelTable.setData(ArrayOfTrgWord, ArrayOfSrcWord, ArrayOfMappingData);
    InputFileDialog trgDialog = new InputFileDialog(InputFileDialog.TRG);
    InputFileDialog srcDialog = new InputFileDialog(InputFileDialog.SRC);
    InputFileDialog alignDialog = new InputFileDialog(InputFileDialog.ALIGN);
    this.add(trgDialog);
    this.add(srcDialog);
    this.add(alignDialog);

    srcDialog.setBounds(10, 10, dialWidth, dialHeight);
    trgDialog.setBounds(20 + dialWidth, 10, dialWidth, dialHeight);
    alignDialog.setBounds(30 + dialWidth * 2, 10, dialWidth, dialHeight);
    try {
      ButtonPanelControl buttonNext = new ButtonPanelControl(ButtonPanelControl.NEXT, panelTable);
      ButtonPanelControl buttonPrevious =
          new ButtonPanelControl(ButtonPanelControl.PREVIOUS, panelTable);
      this.add(buttonNext);
      buttonNext.setBounds(
          PANEL_TABLE_SIZE.width - ButtonPanelControl.size.width - 10,
          PANEL_TABLE_SIZE.height + 50 + 5,
          ButtonPanelControl.size.width,
          ButtonPanelControl.size.height);
      this.add(buttonPrevious);
      buttonPrevious.setBounds(
          PANEL_TABLE_SIZE.width - ButtonPanelControl.size.width * 2 - 15,
          PANEL_TABLE_SIZE.height + panelTable.getY() + 5,
          ButtonPanelControl.size.width,
          ButtonPanelControl.size.height);
    } catch (IOException e) {
      // TODO �����������ꂽ catch �u���b�N
      e.printStackTrace();
    }
    button.setBounds(600, 10, 100, dialHeight);
    button.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            panelTable.reGenerateTable();
            isFileOpened = true;
          }
        });
    this.add(button);
    SaveButton saveButton = new SaveButton();
    saveButton.setBounds(
        button.getX() + button.getSize().width + 50,
        button.getY(),
        button.getSize().width,
        button.getSize().height);
    this.add(saveButton);
  }