コード例 #1
0
  private void pageChanged() {
    switch (currentPage) {
      case 0:
        caption.setText("Specify where " + appName + " is to be installed");

        nextButton.setText("Next");
        prevButton.setEnabled(true);
        break;
      case 1:
        caption.setText("Installing " + appName);

        nextButton.setText("Finish");
        prevButton.setEnabled(false);
        nextButton.setEnabled(false);
        install();
        break;
      case 2:
        caption.setText("Installation complete");

        nextButton.setText("Finish");
        prevButton.setEnabled(false);
        nextButton.setEnabled(true);
        cancelButton.setEnabled(false);
        break;
    }

    getRootPane().invalidate();
    getRootPane().validate();
  }
コード例 #2
0
 /** Pause/resume the module. */
 public void setIsPaused(boolean isPaused) {
   this.isPaused = isPaused;
   if (isPaused) {
     btnPauseResume.setText("Resume");
   } else {
     btnPauseResume.setText("Pause");
   }
 }
コード例 #3
0
 public void updateKeyboardUI() {
   if (Skin.VIETNAMESE_KEY.isEnabled()) {
     chkVietnamese.setText(" V ");
     chkVietnamese.setBackground(Color.yellow);
     chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.red, 1));
   } else {
     chkVietnamese.setText(" E ");
     chkVietnamese.setBackground(Color.cyan);
     chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.blue, 1));
   }
 }
コード例 #4
0
  /**
   * Set the current panel
   *
   * @param panel the panel
   */
  protected void setCurrentPanel(WizardPanel panel) {

    currentPanel = panel;
    currentPanel.prepare();

    cardLayout.show(cardPanel, currentPanel.toString());

    backButton.setEnabled(currentPanel != firstPanel);
    cancelButton.setText("Cancel");
    nextButton.setText("Next");
    cancelButton.setEnabled(true);
  }
コード例 #5
0
ファイル: GridDemo.java プロジェクト: laboon/cs0401
 public void actionPerformed(ActionEvent e) {
   GridDemo.printInMethod();
   JButton source = (JButton) e.getSource();
   System.out.println(source);
   String currentText = source.getText();
   if (currentText.equals("_")) {
     source.setText("X");
   } else if (currentText.equals("X")) {
     source.setText("O");
   } else {
     source.setText("_");
   }
 }
コード例 #6
0
  /** Initialisation */
  private void initComponents() {
    setBackground(new java.awt.Color(114, 159, 255));
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog();
          }
        });
    getContentPane().setLayout(new java.awt.BorderLayout());

    JPanel actionPanel = new JPanel();
    actionPanel.setLayout(new java.awt.GridLayout(1, 0));
    detailedArea.setEditable(false);
    detailedArea.setVisible(true);
    detailedArea.setSize(500, 300);
    detailedArea.setFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 11));
    StringWriter opDetail = new StringWriter();
    actionPrint(new PrintWriter(opDetail));
    detailedArea.setText(new String(opDetail.getBuffer()));
    JScrollPane scroll = new JScrollPane(detailedArea);
    actionPanel.add(scroll);
    getContentPane().add(actionPanel, "Center");

    northToolBar = new javax.swing.JToolBar();
    northToolBar.setLayout(new java.awt.FlowLayout());
    northToolBar.setFloatable(false);

    jbn_Print = new javax.swing.JButton();
    jbn_Print.setText("   Print   ");
    jbn_Print.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbn_PrintActionPerformed();
          }
        });
    northToolBar.add(jbn_Print);

    jbn_OK = new javax.swing.JButton();
    jbn_OK.setText("   Close   ");
    jbn_OK.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbn_OKActionPerformed();
          }
        });
    northToolBar.add(jbn_OK);

    getContentPane().add(northToolBar, "South");
  }
コード例 #7
0
ファイル: CompanionInfoTab.java プロジェクト: kne1p/pcgen
 @Override
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   background.getTableCellRendererComponent(table, null, true, false, row, column);
   container.setBackground(background.getBackground());
   selectedElement = table.getValueAt(row, 0);
   if (selectedElement instanceof CompanionFacade) {
     button.setText(LanguageBundle.getString("in_companionRemove")); // $NON-NLS-1$
     button.setActionCommand(REMOVE_COMMAND);
   } else {
     button.setText(LanguageBundle.getString("in_companionCreateNew")); // $NON-NLS-1$
     button.setActionCommand(CREATE_COMMAND);
   }
   return container;
 }
コード例 #8
0
 private void showNextCard() {
   currentCard = cardList.get(currentCardIndex);
   currentCardIndex++;
   display.setText(currentCard.getQuestion());
   nextButton.setText("Show Answer");
   isShowAnswer = true;
 }
コード例 #9
0
    /** Returns the tool bar for the panel. */
    protected JComponent getToolBar() {
      JToolBar tbarDir = new JToolBar();
      JButton btnNew = new JButton();
      // m_btnSave = new JButton("Save File");
      // i118n
      // btnNew.setText("New Label");
      btnNew.setText(Util.getAdmLabel("_adm_New_Label"));
      btnNew.setActionCommand("new");
      // m_btnSave.setActionCommand("save");

      ActionListener alTool =
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              doAction(e);
            }
          };

      btnNew.addActionListener(alTool);
      // m_btnSave.addActionListener(alTool);

      tbarDir.setFloatable(false);
      tbarDir.add(btnNew);
      /*tbarDir.add(new JLabel("        "));
      tbarDir.add(m_btnSave);*/

      return tbarDir;
    }
コード例 #10
0
 private void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20);
   contentPane.setBorder(border1);
   contentPane.setLayout(borderLayout1);
   controlsPane.setLayout(gridLayout1);
   gridLayout1.setColumns(1);
   gridLayout1.setHgap(10);
   gridLayout1.setRows(0);
   gridLayout1.setVgap(10);
   okButton.setVerifyInputWhenFocusTarget(true);
   okButton.setMnemonic('O');
   okButton.setText("OK");
   buttonsPane.setLayout(flowLayout1);
   flowLayout1.setAlignment(FlowLayout.CENTER);
   messagePane.setEditable(false);
   messagePane.setText("");
   borderLayout1.setHgap(10);
   borderLayout1.setVgap(10);
   this.setTitle("Subscription Authorization");
   this.getContentPane().add(contentPane, BorderLayout.CENTER);
   contentPane.add(controlsPane, BorderLayout.SOUTH);
   controlsPane.add(responsesComboBox, null);
   controlsPane.add(buttonsPane, null);
   buttonsPane.add(okButton, null);
   contentPane.add(messageScrollPane, BorderLayout.CENTER);
   messageScrollPane.getViewport().add(messagePane, null);
 }
コード例 #11
0
ファイル: WorkingView.java プロジェクト: BackupTheBerlios/tbe
  /**
   * Installs a Tool in the Toolbar
   *
   * @param toolbar as JToolbar
   * @param tool, Tool to install
   */
  public void installToolInToolBar(JToolBar toolbar, final Tool tool) {
    final JButton button;
    button = new JButton();

    button.setMargin(new Insets(0, 0, 0, 0));

    if (tool.getItemType() != null) {
      button.setIcon(tool.getItemType().getIcon());
      button.setToolTipText(tool.getItemType().getDescription());

    } else {
      button.setText("Tool"); // For Debugging
    }
    toolbar.add(button);
    toolButtons.add(button);
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.setTool(tool, button);
          }
        });
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.addMouseListener(
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(true);
          }

          public void mouseExited(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(false);
          }
        });
  }
コード例 #12
0
ファイル: CompanionInfoTab.java プロジェクト: kne1p/pcgen
 public void setCompanionType(String type) {
   companionType = type;
   model.setCompanionType(type);
   selectButton.setText(
       LanguageBundle.getFormattedString("in_companionCreateType", type)); // $NON-NLS-1$
   newCompanion = null;
 }
コード例 #13
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == ctl) {
     this.menu();
   } else if (e.getSource() == exit) {
     exitPerform();
   } else if (e.getSource() == rank) {
     if (count != 0) {
       card.show(mainPanel, "four");
       rankPanel.setMemory(memory, count - 1);
       buttonPanel.removeAll();
       buttonPanel.setBounds(width - 200, height - 80, 190, 50);
       buttonPanel.add(exit);
       check = 4;
       count--;
     }
   } else if (e.getSource() == back) {
     if (secondPanel.clip != null) {
       secondPanel.clip.stop();
       System.out.printf("test");
     }
     check = 0;
     card.previous(mainPanel);
     buttonPanel.removeAll();
     ctl.setText("- Play -");
     buttonPanel.add(ctl);
     buttonPanel.add(rank);
     buttonPanel.add(exit);
     buttonPanel.setOpaque(false);
     buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100);
   }
 }
コード例 #14
0
 public void changePanel() {
   card.next(mainPanel);
   buttonPanel.removeAll();
   ctl.setText("- Play -");
   buttonPanel.add(ctl);
   buttonPanel.add(rank);
   buttonPanel.add(exit);
   buttonPanel.setOpaque(false);
   buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100);
   count++;
   memory[count] = new Memory();
   menuPanel.setMemory(memory[count]);
   secondPanel.setMemory(memory[count]);
   gamePanel.setMemory(memory[count]);
   rankPanel.setMemory(memory, count);
   check = 0;
   System.out.println(
       count
           + " "
           + memory[count - 1].name
           + " "
           + memory[count - 1].song
           + " "
           + memory[count - 1].score);
 }
コード例 #15
0
  /** Shuffle the numbers on the buttons */
  private void shuffle() {
    // Randomize the order
    if (solution) solution = false;
    else Collections.shuffle(current);

    // Reset the stats
    moves = 0;
    solved = false;

    // Reset each of the buttons to reflect the randomized
    // order
    for (int i = 0; i < buttons.size(); i++) {
      JButton b = (JButton) buttons.get(i);
      String value = (String) current.get(i);
      int val = Integer.parseInt(value) - 1;
      b.setText(value);
      b.setBackground(java.awt.Color.orange);
      b.setIcon(icons[val]);
      if (value.equals("16")) {
        b.setVisible(false);
        hiddenIndex = i;
      } else {
        b.setVisible(true);
      }
    }

    // Reset the status line
    getStatusLabel().setText("Number of moves: " + moves);
  }
コード例 #16
0
    public void createColorPanel() {
      JPanel colorPanel = new JPanel(new GridLayout(0, 1));
      int curRow = 0;
      for (int i = 0; i < colorString.length / 5; i++) {
        JPanel row = new JPanel(new GridLayout(1, 0, 2, 1));
        row.setBorder(new EmptyBorder(2, 2, 2, 2));

        for (int j = curRow; j < curRow + 5; j++) {
          final JLabel colorLabel =
              new JLabel(null, new ColoredIcon(color[j], 14, 14), JLabel.CENTER);
          colorLabel.setOpaque(true);
          final Border emb = BorderFactory.createEmptyBorder(2, 1, 2, 1);
          final Border lnb = BorderFactory.createLineBorder(Color.black);
          final Border cmb = BorderFactory.createCompoundBorder(lnb, emb);
          colorLabel.setBorder(emb);
          colorLabel.addMouseListener(
              new MouseAdapter() {

                public void mouseClicked(MouseEvent e) {
                  JButton btn = (JButton) getTarget();
                  Color selColor = ((ColoredIcon) colorLabel.getIcon()).getCurrentColor();
                  btn.setIcon(new ColoredIcon(selColor));
                  setVisible(false);
                  btn.doClick();
                  oldLabel.setBackground(null);
                  colorLabel.setBackground(new Color(150, 150, 200));
                  colorLabel.setBorder(emb);
                  oldLabel = colorLabel;
                }

                public void mouseEntered(MouseEvent e) {
                  colorLabel.setBorder(cmb);
                  colorLabel.setBackground(new Color(150, 150, 200));
                }

                public void mouseExited(MouseEvent e) {
                  colorLabel.setBorder(emb);
                  colorLabel.setBackground(null);
                }
              });
          row.add(colorLabel);
        }
        colorPanel.add(row);
        curRow += row.getComponentCount();
        // System.out.println(curRow);
      }

      add(colorPanel, BorderLayout.CENTER);

      // More Colors Button
      moreColors = new JButton(new ColorChooserAction((JButton) target));
      moreColors.setText("More Colors...");
      moreColors.setIcon(null);
      moreColors.setFont(new Font("Verdana", Font.PLAIN, 10));
      //
      JPanel c = new JPanel(new FlowLayout(FlowLayout.CENTER));
      c.add(moreColors);
      add(c, BorderLayout.SOUTH);
    }
コード例 #17
0
 /**
  * Creates a JButton.
  *
  * @param Default text for the button
  * @return The JButton Object
  */
 private JButton createButton(String text) {
   JButton b = new JButton();
   b.setText(text);
   b.setBackground(java.awt.Color.orange);
   b.addMouseListener(buttonEvents);
   b.addMouseMotionListener(buttonEvents);
   return b;
 }
コード例 #18
0
  public void stop() {
    started = false;
    runner = null;

    startBtn.setText("Start");
    writeBtn.setVisible(true);
    paramsBtn.setVisible(true);
  }
コード例 #19
0
  private void affectLibelle() {
    setTitle(ConcoursJeunes.ajrLibelle.getResourceString("criterion.titre"));

    jlCode.setText(ConcoursJeunes.ajrLibelle.getResourceString("criterion.code"));
    jlLibelle.setText(ConcoursJeunes.ajrLibelle.getResourceString("criterion.libelle"));
    jlSortOrder.setText(ConcoursJeunes.ajrLibelle.getResourceString("criterion.ordretri"));
    jcbSortOrder.removeAllItems();
    jcbSortOrder.addItem(ConcoursJeunes.ajrLibelle.getResourceString("criterion.ordretri.asc"));
    jcbSortOrder.addItem(ConcoursJeunes.ajrLibelle.getResourceString("criterion.ordretri.desc"));
    jcbPlacementCriterion.setText(
        ConcoursJeunes.ajrLibelle.getResourceString("criterion.placement"));
    jcbClassementCriterion.setText(
        ConcoursJeunes.ajrLibelle.getResourceString("criterion.classement"));

    jbValider.setText(ConcoursJeunes.ajrLibelle.getResourceString("bouton.valider"));
    jbAnnuler.setText(ConcoursJeunes.ajrLibelle.getResourceString("bouton.annuler"));
  }
コード例 #20
0
  public void menu() {
    if (check == 0) {
      buttonPanel.removeAll();
      buttonPanel.setBounds(width - 200, height - 80, 200, 50);
      card.next(mainPanel);
      ctl.setText("- Play -");
      buttonPanel.add(back);
      buttonPanel.add(ctl);
      menuPanel.savename();
      check = 1;
      secondPanel.musiclist.clearSelection();
      gamePanel.setSecond(0);
    } else if (check == 1) {
      if (memory[count].getSong() == null) {
        Container con = getContentPane();

        String title = "--Warning--";
        String message = "Please Choice a Music Before Playing!";
        int type = JOptionPane.WARNING_MESSAGE;

        JOptionPane.showMessageDialog(con, message, title, type);
      } else {
        card.next(mainPanel);
        secondPanel.clip.stop();
        buttonPanel.removeAll();
        buttonPanel.setBounds(width - 200, height - 80, 190, 50);
        ctl.setText("- Stop -");
        buttonPanel.add(ctl);
        buttonPanel.add(exit);
        check = 2;
        gamePanel.playmusic();
        gamePanel.setRun(true);
      }
    } else if (check == 2) {
      ctl.setText("- Resume -");
      gamePanel.clip.stop();
      gamePanel.setRun(false);
      check = 3;
    } else if (check == 3) {
      ctl.setText("- Stop -");
      gamePanel.clip.start();
      gamePanel.setRun(true);
      check = 2;
    }
  }
コード例 #21
0
 public void blankScreen() {
   int numc = calCorrectAnswer();
   lblmess.setText("Your score is: " + numc + "/10");
   panel.remove(choice1);
   panel.remove(choice2);
   panel.remove(choice3);
   panel.remove(choice4);
   btnext.setText("Try again");
 }
コード例 #22
0
ファイル: CompanionInfoTab.java プロジェクト: kne1p/pcgen
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   background.getTableCellRendererComponent(table, null, isSelected, hasFocus, row, column);
   setBackground(background.getBackground());
   value = table.getValueAt(row, 0);
   if (value instanceof CompanionFacade) {
     button.setText(LanguageBundle.getString("in_companionRemove")); // $NON-NLS-1$
   } else {
     button.setText(LanguageBundle.getString("in_companionCreateNew")); // $NON-NLS-1$
   }
   value = table.getValueAt(row, 1);
   if (value instanceof Boolean) {
     button.setEnabled((Boolean) value);
   } else {
     button.setEnabled(true);
   }
   return this;
 }
コード例 #23
0
ファイル: ChatClient.java プロジェクト: renetbutler/Online
  // 部屋に入室している状態のコンポーネント設定
  private void enteredRoom(String roomName) {
    this.roomName = roomName;
    setTitle(APPNAME + " " + roomName);

    msgTextField.setEnabled(true);
    submitButton.setEnabled(true);

    addRoomButton.setEnabled(false);
    enterRoomButton.setText("退室");
    enterRoomButton.setActionCommand("exitRoom");
  }
コード例 #24
0
  /**
   * React to the pushing of the given button
   *
   * @param index The number of the button pushed
   */
  private void slide(int index) {

    // Don't do anything if the puzzle is solved
    if (solved) return;

    // if not a valid click return
    if (!check(index)) {
      return;
    }

    // swap positions
    current.set(index, current.set(hiddenIndex, current.get(index)));

    // swap strings
    JButton b = (JButton) buttons.get(index);
    b.setText((String) current.get(index));
    b.setIcon(icons[Integer.parseInt(current.get(index)) - 1]);
    b.setVisible(false);
    b = (JButton) buttons.get(hiddenIndex);
    b.setText((String) current.get(hiddenIndex));
    b.setIcon(icons[Integer.parseInt(current.get(hiddenIndex)) - 1]);
    b.setVisible(true);

    // update the position of the blanked spot
    hiddenIndex = index;

    // Increment the number of moves and update status
    moves++;
    getStatusLabel().setText("Number of moves: " + moves);

    // if you've won
    if (current.equals(correct)) {
      solved = true;
      getStatusLabel().setText("Solved the game in " + moves + " moves.");
      // Change the buttons colors to green
      Iterator itr = buttons.iterator();
      while (itr.hasNext()) {
        ((JButton) itr.next()).setBackground(java.awt.Color.green);
      }
    }
  }
コード例 #25
0
 // Resets the game
 public void reset() {
   panel.remove(btnext);
   panel.add(choice1);
   panel.add(choice2);
   panel.add(choice3);
   panel.add(choice4);
   panel.add(btnext);
   quizAnswerID = 0;
   map.clear();
   readQuestionAnswer(quizAnswerID);
   btnext.setText("Next");
 }
コード例 #26
0
ファイル: ChatClient.java プロジェクト: renetbutler/Online
  // 部屋に入室していない状態のコンポーネント設定
  private void exitedRoom() {
    roomName = null;
    setTitle(APPNAME);

    msgTextField.setEnabled(false);
    submitButton.setEnabled(false);

    addRoomButton.setEnabled(true);
    enterRoomButton.setText("入室");
    enterRoomButton.setActionCommand("enterRoom");
    userList.setModel(new DefaultListModel());
  }
コード例 #27
0
 public void setShowNames(boolean b) {
   if (shownames == b) return;
   shownames = b;
   Iterator it = buttons.keySet().iterator();
   while (it.hasNext()) {
     String command = (String) it.next();
     JButton button = (JButton) buttons.get(command);
     button.setText((shownames) ? command : "");
     button.setToolTipText((!shownames) ? command : "");
   }
   setButtonsSize();
 }
コード例 #28
0
ファイル: DateTimer.java プロジェクト: dea1495/workspace
  /** Create the frame */
  public DateTimer() {
    super();
    setTitle("v14 CountDown");
    getContentPane().setLayout(null);
    setBounds(100, 100, 500, 375);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    final JLabel finishtimeLabel = new JLabel();
    finishtimeLabel.setText("CountDown Time");
    finishtimeLabel.setBounds(10, 36, 119, 15);
    getContentPane().add(finishtimeLabel);
    finishtime =
        new JFormattedTextField(
            new DateFormatter(new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa", Locale.ENGLISH)));
    finishtime.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {}
        });

    finishtime.setValue(new Date());
    finishtime.setBounds(135, 34, 187, 19);
    getContentPane().add(finishtime);

    final JButton startButton = new JButton();
    startButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            startCount();
          }
        });
    startButton.setText("Start!!!");
    startButton.setBounds(334, 31, 111, 25);
    getContentPane().add(startButton);

    countLabel = new JLabel();
    countLabel.setHorizontalAlignment(SwingConstants.CENTER);
    countLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    countLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 14));
    countLabel.setBorder(new LineBorder(Color.black, 1, false));
    countLabel.setText("Countdown not Started");
    countLabel.setBounds(10, 162, 435, 47);
    getContentPane().add(countLabel);

    final JLabel credits = new JLabel();
    credits.setHorizontalAlignment(SwingConstants.RIGHT);
    credits.setText("");
    credits.setBounds(253, 328, 237, 15);
    getContentPane().add(credits);
  }
コード例 #29
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource().equals(toggleDropParts)) {
      if (toggleDropParts.getText().equals("Enable Parts Robot Drop Parts")) {
        toggleDropParts.setText("Disable Parts Robot Drop Parts");
        app.setDropParts(true);
      } else {
        toggleDropParts.setText("Enable Parts Robot Drop Parts");
        app.setDropParts(false);
      }
    }

    if (e.getSource() == sendButton) {
      for (int i = 1; i < 9; i++) {
        if (badKit.getConfigClicks().get(i - 1) == false) {
          app.getKitDrops().set(i, true);
        } else {
          app.getKitDrops().set(i, false);
        }
      }
      app.getKitDrops().set(0, true);
      sent.setText("Non-Norm Sent");
    }
  }
コード例 #30
0
ファイル: SourcePanel.java プロジェクト: cecemel/Util
 public void actionPerformed(ActionEvent evt) {
   Component parent = extensionButton.getParent();
   while ((parent != null) && !(parent instanceof Frame)) parent = parent.getParent();
   String newExtensions =
       JOptionPane.showInputDialog(
           parent,
           "Edit the extension list.\nSeparate extensions by commas.\n\n",
           filter.getExtensionString());
   if ((newExtensions != null) && !newExtensions.trim().equals("")) {
     newExtensions = newExtensions.replaceAll("\\s", "");
     filter.setExtensions(newExtensions);
     extensionButton.setText(filter.getDescription());
     properties.setProperty("extensions", filter.getExtensionString());
     directoryPane.reloadTree();
   }
 }