Esempio n. 1
0
  private JPanel createImageButtonsPanel() {
    replaceImageButton =
        new JButton(mainPanel.translate("button.replace"), View.getIcon("replaceimage16"));
    replaceImageButton.setMargin(new Insets(3, 3, 3, 10));
    replaceImageButton.addActionListener(mainPanel::replaceButtonActionPerformed);
    replaceImageButton.setVisible(false);

    replaceImageAlphaButton =
        new JButton(
            mainPanel.translate("button.replaceAlphaChannel"), View.getIcon("replacealpha16"));
    replaceImageAlphaButton.setMargin(new Insets(3, 3, 3, 10));
    replaceImageAlphaButton.addActionListener(mainPanel::replaceAlphaButtonActionPerformed);
    replaceImageAlphaButton.setVisible(false);

    prevFontsButton = new JButton(mainPanel.translate("button.prev"), View.getIcon("prev16"));
    prevFontsButton.setMargin(new Insets(3, 3, 3, 10));
    prevFontsButton.addActionListener(this::prevFontsButtonActionPerformed);
    prevFontsButton.setVisible(false);

    nextFontsButton = new JButton(mainPanel.translate("button.next"), View.getIcon("next16"));
    nextFontsButton.setMargin(new Insets(3, 3, 3, 10));
    nextFontsButton.addActionListener(this::nextFontsButtonActionPerformed);
    nextFontsButton.setVisible(false);

    ButtonsPanel imageButtonsPanel = new ButtonsPanel();
    imageButtonsPanel.add(replaceImageButton);
    imageButtonsPanel.add(replaceImageAlphaButton);
    imageButtonsPanel.add(prevFontsButton);
    imageButtonsPanel.add(nextFontsButton);
    return imageButtonsPanel;
  }
Esempio n. 2
0
    @Override
    public void onResponseReceived(Request request, Response response) {
      JSONValue j = JSONParser.parseStrict(response.getText());
      JSONObject obj = j.isObject();
      if (obj != null && obj.containsKey("error")) {
        Window.alert(obj.get("error").isString().stringValue());
        changeButtonSelection();
        setTextEnabled(false);
        clearTextBoxes();
        singleSelectionModel.clear();
      } else {
        List<OrganismInfo> organismInfoList =
            OrganismInfoConverter.convertJSONStringToOrganismInfoList(response.getText());
        dataGrid.setSelectionModel(singleSelectionModel);
        MainPanel.getInstance().getOrganismInfoList().clear();
        MainPanel.getInstance().getOrganismInfoList().addAll(organismInfoList);
        changeButtonSelection();
        OrganismChangeEvent organismChangeEvent = new OrganismChangeEvent(organismInfoList);
        organismChangeEvent.setAction(OrganismChangeEvent.Action.LOADED_ORGANISMS);
        Annotator.eventBus.fireEvent(organismChangeEvent);

        // in the case where we just add one . . .we should refresh the app state
        if (organismInfoList.size() == 1) {
          MainPanel.getInstance().getAppState();
        }
      }
      if (savingNewOrganism) {
        savingNewOrganism = false;
        setNoSelection();
        changeButtonSelection(false);
        loadingDialog.hide();
      }
    }
Esempio n. 3
0
  /** Instantiates a new change log panel. */
  private ChangeLogPanel() {

    MainPanel.setCommInfo(true);
    try {
      new RequestBuilder(RequestBuilder.GET, "CHANGELOG")
          .sendRequest(
              "",
              new RequestCallback() {
                @Override
                public void onError(Request res, Throwable throwable) {
                  MainPanel.setCommInfo(false);
                  Log.error(throwable.getMessage());
                }

                @Override
                public void onResponseReceived(Request request, Response response) {
                  MainPanel.setCommInfo(false);
                  String text = response.getText();
                  HTML w = new HTML("<p>" + text + "</p>");
                  d.setWidget(w);
                }
              });
    } catch (RequestException e) {
      MainPanel.setCommInfo(false);
      Log.error(e.getMessage());
    }

    d = new DecoratorPanel();
    d.setWidth("100%");

    initWidget(d);
  }
Esempio n. 4
0
 private void nextFontsButtonActionPerformed(ActionEvent evt) {
   FontTag fontTag = fontPanel.getFontTag();
   int pageCount = getFontPageCount(fontTag);
   fontPageNum = (fontPageNum + 1) % pageCount;
   if (mainPanel.isInternalFlashViewerSelected() /*|| ft instanceof GFxDefineCompactedFont*/) {
     imagePanel.setTimelined(MainPanel.makeTimelined(fontTag, fontPageNum), fontTag.getSwf(), 0);
   }
 }
Esempio n. 5
0
  public void showTextPanel(TextTag textTag) {
    if (mainPanel.isInternalFlashViewerSelected() /*|| ft instanceof GFxDefineCompactedFont*/) {
      showImagePanel(MainPanel.makeTimelined(textTag), textTag.getSwf(), 0);
    }

    showCardRight(CARDTEXTPANEL);
    parametersPanel.setVisible(true);
    textPanel.setText(textTag);
  }
  /*
   * Button or JTextField clicked
   */
  public void switchCards(String s) {
    System.out.println("Switching to " + s);

    CardLayout cl = (CardLayout) (mainPanels.getLayout());
    cl.show(mainPanels, s);
    mainPanels.revalidate();

    CardLayout cl2 = (CardLayout) (sidePanels.getLayout());
    cl2.show(sidePanels, s);
    sidePanels.revalidate();
  }
Esempio n. 7
0
  public void displayGUI() {
    JFrame frame = new JFrame("Mark Up");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    MainPanel mainPanel;
    try {
      UndoRedoManager undoRedoManager = UndoRedoManagerImpl.getInstance();
      BufferedImage image = ImageIO.read(getClass().getResourceAsStream("/images/test3.png"));
      mainPanel = new MainPanel();
      MainPanelModel model = mainPanel.getModel();
      mainPanel.setImage(image);

      AnnotationMouseAdapter ama = new AnnotationMouseAdapter(model);
      model.addPropertyChangeListener(mainPanel);

      mainPanel.addMouseListener(ama);
      mainPanel.addMouseMotionListener(ama);

      JScrollPane scrollTablePane = setUpTable(mainPanel);

      JMenuBar menuBar = new JMenuBar();

      JMenu fileMenu = new JMenu("File");
      menuBar.add(fileMenu);

      JMenu editMenu = new JMenu("Edit");
      UndoAction undoAction =
          new UndoAction("Undo", null, "Undo last command", new Integer(KeyEvent.VK_Z));
      undoRedoManager.addPropertyChangeListener(undoAction);
      RedoAction redoAction =
          new RedoAction("Redo", null, "Redo last command", new Integer(KeyEvent.VK_R));
      undoRedoManager.addPropertyChangeListener(redoAction);
      redoAction.setModel(model);
      undoAction.setMainPanelModel(model);
      JMenuItem undoItem = new JMenuItem(undoAction);
      JMenuItem redoItem = new JMenuItem(redoAction);
      editMenu.add(undoItem);
      editMenu.add(redoItem);
      menuBar.add(editMenu);
      frame.setJMenuBar(menuBar);

      frame.add(scrollTablePane, BorderLayout.EAST);
      frame.add(mainPanel, BorderLayout.WEST);
      frame.pack();
      frame.setVisible(true);

    } catch (IOException ex) {
      Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Esempio n. 8
0
  /** Update user. */
  private void updateUser() {
    if (updateMembers()) {
      UserRole role = Ballance_autosauler_net.sessionId.getUserrole();
      if (role.isAdmin()) {
        MainPanel.setCommInfo(true);
        Services.users.updateUser(
            user,
            new AsyncCallback<Boolean>() {

              @Override
              public void onFailure(Throwable caught) {
                MainPanel.setCommInfo(false);
                new AlertDialog(caught).show();
              }

              @Override
              public void onSuccess(Boolean result) {
                MainPanel.setCommInfo(false);

                if (result) {
                  EditUserDialog.this.hide();
                  receiver.onDialogYesButtonClick("reload", null);

                } else {
                  new AlertDialog(M.users.logCreateError()).show();
                }
              }
            });
      }
    }
  }
Esempio n. 9
0
  /**
   * Gets the user.
   *
   * @return the user
   */
  private void getUser() {
    user = null;
    if (editlogin == null) {
      user = new User();
      user.initAsDefault();
      createGUI();
    } else {
      UserRole role = Ballance_autosauler_net.sessionId.getUserrole();
      if (role.isAdmin()) {
        MainPanel.setCommInfo(true);

        Services.users.getUser(
            editlogin,
            new AsyncCallback<User>() {

              @Override
              public void onFailure(Throwable caught) {
                MainPanel.setCommInfo(false);
                new AlertDialog(caught).show();
              }

              @Override
              public void onSuccess(User result) {
                user = result;
                EditUserDialog.this.createGUI();

                MainPanel.setCommInfo(false);
              }
            });
      }
    }
  }
Esempio n. 10
0
 private void saveGenericTagButtonActionPerformed(ActionEvent evt) {
   genericTagPanel.save();
   Tag tag = genericTagPanel.getTag();
   SWF swf = tag.getSwf();
   swf.clearImageCache();
   swf.updateCharacters();
   tag.getTimelined().resetTimeline();
   swf.assignClassesToSymbols();
   swf.assignExportNamesToSymbols();
   mainPanel.repaintTree();
   mainPanel.setTagTreeSelectedNode(tag);
   genericEditButton.setVisible(true);
   genericSaveButton.setVisible(false);
   genericCancelButton.setVisible(false);
   genericTagPanel.setEditMode(false, null);
 }
Esempio n. 11
0
 private JScrollPane setUpTable(MainPanel mainPanel) {
   MainPanelModel model = mainPanel.getModel();
   AnnotationTableModel tableModel =
       new AnnotationTableModel(mainPanel.getModel().getAnnotationList());
   AnnotationTable table = new AnnotationTable(tableModel);
   AnnotationTableMouseAdaptor atma = new AnnotationTableMouseAdaptor(table, mainPanel);
   table.addMouseListener(atma);
   table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   JScrollPane scrollTablePane = new JScrollPane(table);
   model.addPropertyChangeListener(tableModel);
   model.setTable(table);
   model.getSelectedAnnotation().addPropertyChangeListener(table);
   model.getSelectedAnnotation().addPropertyChangeListener(mainPanel);
   table.getSelectionModel().addListSelectionListener(model);
   return scrollTablePane;
 }
Esempio n. 12
0
 private void saveMetadataButtonActionPerformed(ActionEvent evt) {
   metadataTag.xmlMetadata = metadataEditor.getText().replaceAll(">\r?\n<", "> <");
   metadataTag.setModified(true);
   metadataEditor.setEditable(Configuration.editorMode.get());
   setMetadataModified(false);
   updateMetadataButtonsVisibility();
   mainPanel.repaintTree();
 }
Esempio n. 13
0
 void actionRefresh() {
   try {
     getRemoteCollector().collectDataIncludingCurrentRequests();
     MainPanel.refreshMainTabFromChild(this);
   } catch (final IOException e) {
     showException(e);
   }
 }
Esempio n. 14
0
  private void initializeComponents() {
    mainPanel = new MainPanel(this);
    mainPanel.loadDefaults();

    toolbar = new ToolBar(mainPanel);

    menuBar = new MenuBar(mainPanel);
    setJMenuBar(menuBar);
  }
 final void executeAction(Action action) {
   try {
     final String message =
         getRemoteCollector().executeActionAndCollectData(action, null, null, null, null, null);
     showMessage(message);
     MainPanel.refreshMainTabFromChild(this);
   } catch (final IOException ex) {
     showException(ex);
   }
 }
Esempio n. 16
0
  private JPanel createBinaryButtonsPanel() {
    replaceBinaryButton =
        new JButton(mainPanel.translate("button.replace"), View.getIcon("edit16"));
    replaceBinaryButton.setMargin(new Insets(3, 3, 3, 10));
    replaceBinaryButton.addActionListener(mainPanel::replaceButtonActionPerformed);

    ButtonsPanel binaryButtonsPanel = new ButtonsPanel();
    binaryButtonsPanel.add(replaceBinaryButton);
    return binaryButtonsPanel;
  }
Esempio n. 17
0
  private void importTTFButtonActionPerformed(ActionEvent evt) {
    TreeItem item = mainPanel.tagTree.getCurrentTreeItem();
    if (item instanceof FontTag) {
      FontTag ft = (FontTag) item;

      JFileChooser fc = new JFileChooser();
      fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get()));
      FileFilter ttfFilter =
          new FileFilter() {
            @Override
            public boolean accept(File f) {
              return (f.getName().toLowerCase().endsWith(".ttf")) || (f.isDirectory());
            }

            @Override
            public String getDescription() {
              return "TTF files";
            }
          };
      fc.setFileFilter(ttfFilter);

      fc.setAcceptAllFileFilterUsed(false);
      JFrame fr = new JFrame();
      View.setWindowIcon(fr);
      int returnVal = fc.showOpenDialog(fr);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        Configuration.lastOpenDir.set(
            Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
        File selfile = Helper.fixDialogFile(fc.getSelectedFile());
        Set<Integer> selChars = new HashSet<>();
        try {
          Font f = Font.createFont(Font.TRUETYPE_FONT, selfile);
          int required[] = new int[] {0x0001, 0x0000, 0x000D, 0x0020};
          loopi:
          for (char i = 0; i < Character.MAX_VALUE; i++) {
            for (int r : required) {
              if (r == i) {
                continue loopi;
              }
            }
            if (f.canDisplay((int) i)) {
              selChars.add((int) i);
            }
          }
          fontAddChars(ft, selChars, f);
          mainPanel.reload(true);
        } catch (FontFormatException ex) {
          JOptionPane.showMessageDialog(mainPanel, "Invalid TTF font");
        } catch (IOException ex) {
          Logger.getLogger(FontPanel.class.getName()).log(Level.SEVERE, null, ex);
        }
      }
    }
  }
Esempio n. 18
0
  private JPanel createMetadataButtonsPanel() {
    metadataEditButton = new JButton(mainPanel.translate("button.edit"), View.getIcon("edit16"));
    metadataEditButton.setMargin(new Insets(3, 3, 3, 10));
    metadataEditButton.addActionListener(this::editMetadataButtonActionPerformed);
    metadataSaveButton = new JButton(mainPanel.translate("button.save"), View.getIcon("save16"));
    metadataSaveButton.setMargin(new Insets(3, 3, 3, 10));
    metadataSaveButton.addActionListener(this::saveMetadataButtonActionPerformed);
    metadataSaveButton.setVisible(false);
    metadataCancelButton =
        new JButton(mainPanel.translate("button.cancel"), View.getIcon("cancel16"));
    metadataCancelButton.setMargin(new Insets(3, 3, 3, 10));
    metadataCancelButton.addActionListener(this::cancelMetadataButtonActionPerformed);
    metadataCancelButton.setVisible(false);

    ButtonsPanel metadataTagButtonsPanel = new ButtonsPanel();
    metadataTagButtonsPanel.add(metadataEditButton);
    metadataTagButtonsPanel.add(metadataSaveButton);
    metadataTagButtonsPanel.add(metadataCancelButton);
    return metadataTagButtonsPanel;
  }
Esempio n. 19
0
  private JPanel createGenericTagButtonsPanel() {
    genericEditButton = new JButton(mainPanel.translate("button.edit"), View.getIcon("edit16"));
    genericEditButton.setMargin(new Insets(3, 3, 3, 10));
    genericEditButton.addActionListener(this::editGenericTagButtonActionPerformed);
    genericSaveButton = new JButton(mainPanel.translate("button.save"), View.getIcon("save16"));
    genericSaveButton.setMargin(new Insets(3, 3, 3, 10));
    genericSaveButton.addActionListener(this::saveGenericTagButtonActionPerformed);
    genericSaveButton.setVisible(false);
    genericCancelButton =
        new JButton(mainPanel.translate("button.cancel"), View.getIcon("cancel16"));
    genericCancelButton.setMargin(new Insets(3, 3, 3, 10));
    genericCancelButton.addActionListener(this::cancelGenericTagButtonActionPerformed);
    genericCancelButton.setVisible(false);

    ButtonsPanel genericTagButtonsPanel = new ButtonsPanel();
    genericTagButtonsPanel.add(genericEditButton);
    genericTagButtonsPanel.add(genericSaveButton);
    genericTagButtonsPanel.add(genericCancelButton);
    return genericTagButtonsPanel;
  }
Esempio n. 20
0
  /** Sets the Frequency Panel to ACTIVE stage */
  public static void frequencyPanelActive() {
    SettingsPanel.setStage(FrequencySettingsSubPanel.STAGE);

    FrequencySettingsSubPanel.DISPLAY_HELP_VIDEO = true;

    Program.settingsPanel.setVisible(true);
    Program.cameraPanel.setVisible(true);
    Program.manualPanel.setVisible(false);
    Program.startControlPanel.setVisible(false);
    Program.imagePanel.setVisible(false);

    MainPanel.setLeftStage(Program.cameraPanel);
    Program.frame.glass.setVisible(false);

    /* Sets header back to blue */
    FrequencySettingsSubPanel.headerButton.setToolTipText(
        FrequencySettingsSubPanel.getPanelInformation());
    FrequencySettingsSubPanel.headerButton.setEnabled(false);

    /* Turns on */
    SettingsPanel.frequencyPanel.startFloatInputTextField.setVisible(true);
    SettingsPanel.frequencyPanel.getStartMoreThenLabel().setVisible(true);
    SettingsPanel.frequencyPanel.getStartLessThenLabel().setVisible(true);
    FrequencySettingsSubPanel.nextButton.setVisible(true);
    /* Containers for setting up GUI */
    SettingsPanel.frequencyPanel.continer1.setVisible(true);
    SettingsPanel.frequencyPanel.continer2.setVisible(true);
    SettingsPanel.frequencyPanel.startTextFeildContainer.setVisible(true);
    SettingsPanel.frequencyPanel.continer4.setVisible(true);
    SettingsPanel.frequencyPanel.continer5.setVisible(true);
    SettingsPanel.frequencyPanel.continer6.setVisible(true);
    SettingsPanel.frequencyPanel.startFrequensyContainer.setVisible(true);
    FrequencySettingsSubPanel.backButton.setVisible(true);
    SettingsPanel.frequencyPanel.endFrequensyContainer.setVisible(true);
    FrequencySettingsSubPanel.colorFrequensyVideoPanel.setVisible(true);

    /* New Active dimensions */
    SettingsPanel.frequencyPanel.frequencyPanel.setPreferredSize(
        SettingsPanel.frequencyPanel.FREQUENCY_PANEL_DIMENSION_ACTIVE);
    SettingsPanel.frequencyPanel.headerAndPanelContiner.setPreferredSize(
        SettingsPanel.frequencyPanel.HEADER_AND_PANEL_CONTINER_DIMENSION_ACTIVE);
    SettingsPanel.frequencyPanel.stepContiner.setPreferredSize(
        SettingsPanel.frequencyPanel.STEP_CONTINER_DIMENSION_ACTIVE);

    /* Sets Active colors light blue to border and text */
    SettingsPanel.frequencyPanel
        .getStepLabel()
        .setText(SettingsPanel.frequencyPanel.getStepLightBlueText());
    SettingsPanel.frequencyPanel.frequencyPanel.setBorder(Program.LIGHT_BLUE_BORDER);

    /* Turns off */
    SettingsPanel.frequencyPanel.getFrequencyLabel().setVisible(false);
    SettingsPanel.setFREQUENCY_SELECTED(false);
  }
Esempio n. 21
0
  /** メニュー->新規作成 新しいマップを作成する */
  public void newMap() {
    // マップサイズダイアログを開く
    // rowとcolを設定
    MapSizeDialog dialog = new MapSizeDialog(this);
    dialog.setVisible(true);

    // キャンセルボタンが押されたときは何もしない
    if (!dialog.isOKPressed()) {
      return;
    }

    // メインパネルに新しいマップを作成
    mainPanel.initMap(row, col);

    // パネルの大きさをマップの大きさと同じにする
    // パネルが大きいときは自動的にスクロールバーが表示される
    mainPanel.setPreferredSize(new Dimension(col * MainPanel.CHIP_SIZE, row * MainPanel.CHIP_SIZE));
    // パネルが大きくなったらスクロールバーを表示する
    scrollPane.getViewport().revalidate();
    scrollPane.getViewport().repaint();
  }
Esempio n. 22
0
 /** メニュー->保存 マップを保存する */
 public void saveMap() {
   fileChooser.addChoosableFileFilter(new MapFileFilter()); // ファイルフィルタ
   fileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
   fileChooser.setDialogTitle("マップを保存する");
   int ret = fileChooser.showSaveDialog(null);
   File mapFile;
   if (ret == JFileChooser.APPROVE_OPTION) {
     // もし保存ボタンが押されたらそのマップファイルをセーブする
     mapFile = fileChooser.getSelectedFile();
     mainPanel.saveMap(mapFile);
   }
 }
Esempio n. 23
0
  /** Creates new form InformWindow */
  public InformWindow(String title, String msg, String msg_button) {
    initComponents();

    MainPanel.setBackground(new Color(255, 255, 255));
    this.setTitle(title);
    this.Label.setText(msg);
    this.Button.setText(msg_button);
    setGUIIcon(this);

    this.pack();
    this.setLocationRelativeTo(null);
  }
Esempio n. 24
0
  private JPanel createFlashPlayerPanel(FlashPlayerPanel flashPanel) {
    JPanel pan = new JPanel(new BorderLayout());
    JLabel prevLabel = new HeaderLabel(mainPanel.translate("swfpreview"));
    prevLabel.setHorizontalAlignment(SwingConstants.CENTER);
    // prevLabel.setBorder(new BevelBorder(BevelBorder.RAISED));

    pan.add(prevLabel, BorderLayout.NORTH);

    Component leftComponent;
    if (flashPanel != null) {
      JPanel flashPlayPanel = new JPanel(new BorderLayout());
      flashPlayPanel.add(flashPanel, BorderLayout.CENTER);

      /*JPanel bottomPanel = new JPanel(new BorderLayout());
      JPanel buttonsPanel = new JPanel(new FlowLayout());
      JButton selectColorButton = new JButton(View.getIcon("color16"));
      selectColorButton.addActionListener(mainPanel::selectBkColor);
      selectColorButton.setToolTipText(AppStrings.translate("button.selectbkcolor.hint"));
      buttonsPanel.add(selectColorButton);
      bottomPanel.add(buttonsPanel, BorderLayout.EAST);

      flashPlayPanel.add(bottomPanel, BorderLayout.SOUTH);*/
      JPanel flashPlayPanel2 = new JPanel(new BorderLayout());
      flashPlayPanel2.add(flashPlayPanel, BorderLayout.CENTER);
      flashPlayPanel2.add(new PlayerControls(mainPanel, flashPanel), BorderLayout.SOUTH);
      leftComponent = flashPlayPanel2;
    } else {
      JPanel swtPanel = new JPanel(new BorderLayout());
      swtPanel.add(
          new JLabel(
              "<html><center>" + mainPanel.translate("notavailonthisplatform") + "</center></html>",
              JLabel.CENTER),
          BorderLayout.CENTER);
      swtPanel.setBackground(View.getDefaultBackgroundColor());
      leftComponent = swtPanel;
    }

    pan.add(leftComponent, BorderLayout.CENTER);
    return pan;
  }
Esempio n. 25
0
  /** コンピュータの手を決定する。 */
  public void compute() {
    // Min-Max法で石を打つ場所を決める
    // 戻ってくる値は bestX+bestY*MASU
    int temp = minMax(true, SEARCH_LEVEL);

    // 場所を求める
    int x = temp % MainPanel.MASU;
    int y = temp / MainPanel.MASU;

    // 打った場所、ひっくり返した石の位置を記録
    Undo undo = new Undo(x, y);
    // その場所に実際に石を打つ
    panel.putDownStone(x, y, false);
    // 実際にひっくり返す
    panel.reverse(undo, false);
    // 終了したか調べる
    if (panel.endGame()) return;
    // 手番を変える
    panel.nextTurn();
    // プレイヤーがパスの場合はもう一回
    if (panel.countCanPutDownStone() == 0) {
      System.out.println("Player PASS!");
      panel.nextTurn();
      compute();
    }
  }
Esempio n. 26
0
  /**
   * 評価関数。盤面を評価して評価値を返す。盤面の場所の価値を元にする。
   *
   * @return 盤面の評価値。
   */
  private int valueBoard() {
    int value = 0;

    for (int y = 0; y < MainPanel.MASU; y++) {
      for (int x = 0; x < MainPanel.MASU; x++) {
        // 置かれた石とその場所の価値をかけて足していく
        value += panel.getBoard(x, y) * valueOfPlace[y][x];
      }
    }

    // 白石(AI)が有利なときは負になるので符合を反転する
    return -value;
  }
Esempio n. 27
0
  private void fontAddCharsButtonActionPerformed(ActionEvent evt) {
    String newchars = fontAddCharactersField.getText();

    TreeItem item = mainPanel.tagTree.getCurrentTreeItem();
    if (item instanceof FontTag) {
      Set<Integer> selChars = new TreeSet<>();
      for (int c = 0; c < newchars.length(); c++) {
        selChars.add(newchars.codePointAt(c));
      }
      fontAddChars((FontTag) item, selChars, ((FontFace) fontFaceSelection.getSelectedItem()).font);
      fontAddCharactersField.setText("");
      mainPanel.reload(true);
    }
  }
Esempio n. 28
0
 /** メニュー->開く マップを開く */
 public void openMap() {
   fileChooser.addChoosableFileFilter(new MapFileFilter()); // ファイルフィルタ
   fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
   fileChooser.setDialogTitle("マップを開く");
   int ret = fileChooser.showOpenDialog(null);
   File mapFile;
   if (ret == JFileChooser.APPROVE_OPTION) {
     // もし開くボタンが押されたらそのマップファイルをロードする
     mapFile = fileChooser.getSelectedFile();
     mainPanel.loadMap(mapFile);
     // パネルが大きくなったらスクロールバーを表示する
     scrollPane.getViewport().revalidate();
     scrollPane.getViewport().repaint();
   }
 }
Esempio n. 29
0
  private void createParametersPanel() {
    displayWithPreview = new JPanel(new CardLayout());

    textPanel = new TextPanel(mainPanel);
    displayWithPreview.add(textPanel, CARDTEXTPANEL);

    fontPanel = new FontPanel(mainPanel);
    displayWithPreview.add(fontPanel, CARDFONTPANEL);

    JLabel paramsLabel = new HeaderLabel(mainPanel.translate("parameters"));
    paramsLabel.setHorizontalAlignment(SwingConstants.CENTER);
    // paramsLabel.setBorder(new BevelBorder(BevelBorder.RAISED));

    parametersPanel = new JPanel(new BorderLayout());
    parametersPanel.add(paramsLabel, BorderLayout.NORTH);
    parametersPanel.add(displayWithPreview, BorderLayout.CENTER);
    setRightComponent(parametersPanel);
  }
Esempio n. 30
0
  /** Sets the File Name Panel to a ACTIVE stage */
  public static void fileNamePanelActive() {

    MainPanel.setLeftStage(Program.imagePanel);

    Program.settingsPanel.setVisible(true);
    Program.manualPanel.setVisible(false);
    Program.startControlPanel.setVisible(false);
    Program.cameraPanel.setVisible(false);
    Program.imagePanel.setVisible(true);

    SettingsPanel.setStage(FileNameSettingsSubPanel.STAGE);
    Program.frame.glass.repaint();
    Program.frame.glass.setVisible(true);

    /* Sets active color Blue for header, labels and borders*/
    FileNameSettingsSubPanel.headerButton.setEnabled(
        FileNameSettingsSubPanel.HEADER_BUTTON_ENABLED = false);
    FileNameSettingsSubPanel.headerButton.setDisabledIcon(
        FileNameSettingsSubPanel.headerButton.FILE_NAME_HEADER_DISABLED_BLUE_IMAGE_ICON);
    SettingsPanel.fileNamePanel.stepLabel.setText(SettingsPanel.fileNamePanel.STEP_TEXT_LIGHT_BLUE);
    SettingsPanel.fileNamePanel.fileNamePanel.setBorder(Program.LIGHT_BLUE_BORDER);

    /* Shows buttons and labels */
    FileNameSettingsSubPanel.nextButton.setVisible(true);
    FileNameSettingsSubPanel.backButton.setVisible(true);
    SettingsPanel.fileNamePanel.fileNameInputTextField.setVisible(true);
    SettingsPanel.fileNamePanel.getImputFeildsContainer().setVisible(true);
    SettingsPanel.fileNamePanel.getInputFeildsAButtons().setVisible(true);
    SettingsPanel.fileNamePanel.getInputContainer().setVisible(true);

    /* Changing size of panels when button has been pressed*/
    SettingsPanel.fileNamePanel.fileNamePanel.setPreferredSize(
        SettingsPanel.fileNamePanel.FILE_NAME_PANEL_DIMENSION_ACTIVE);
    SettingsPanel.fileNamePanel.headerAndPanelContiner.setPreferredSize(
        SettingsPanel.fileNamePanel.HEADER_AND_PANEL_CONTINER_DIMENSION_ACTIVE);
    SettingsPanel.fileNamePanel.stepContiner.setPreferredSize(
        SettingsPanel.fileNamePanel.STEP_CONTINER_DIMENSION_ACTIVE);

    /* Turns on Panel */
    SettingsPanel.fileNamePanel.fileNamePanel.setVisible(true);

    /* Doesn't show label */
    SettingsPanel.fileNamePanel.fileNameSelectedLabel.setVisible(false);
  }