예제 #1
0
 public void actionPerformed(ActionEvent ev) {
   if (button.getText().equals("Hello")) {
     button.setText("World");
   } else {
     button.setText("Hello");
   }
 }
예제 #2
0
 private void multiConnect() {
   if (jButtonMultiConnect.getText().equals("Multi-Connect")) {
     String res =
         JOptionPane.showInputDialog(this, "Enter number of connections", "Multi-Connect");
     if (res != null) {
       jButtonMultiConnect.setText("Multi-Disconnect");
       jMenuItemTestMulticonnect.setEnabled(false);
       jMenuItemTestMultidisconnect.setEnabled(true);
       int count = Integer.parseInt(res);
       MultiSessions = new Session[count];
       for (int i = 0; i < count; i++) {
         MultiSessions[i] = new Session();
         try {
           MultiSessions[i].connect(
               this.jTextFieldServer.getText(), this.jTextFieldUser.getText() + String.valueOf(i));
         } catch (ConnectionException ex1) {
         }
       }
     }
   } else {
     for (int i = 0; i < MultiSessions.length; i++) {
       try {
         ((Session) MultiSessions[i]).disconnect();
       } catch (Exception ex) {
         System.out.println("Error disconnectiong from session");
       }
     }
     jButtonMultiConnect.setText("Multi-Connect");
     jMenuItemTestMulticonnect.setEnabled(true);
     jMenuItemTestMultidisconnect.setEnabled(false);
   }
 }
예제 #3
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();
  }
예제 #4
0
 /** Pause/resume the module. */
 public void setIsPaused(boolean isPaused) {
   this.isPaused = isPaused;
   if (isPaused) {
     btnPauseResume.setText("Resume");
   } else {
     btnPauseResume.setText("Pause");
   }
 }
예제 #5
0
 private void setupLanguage() {
   jLabel1.setText(SanBootView.res.getString("ProfileChooser.label.name"));
   jLabel2.setText(SanBootView.res.getString("ProfileChooser.label.type"));
   if (mode == MODE_OPEN)
     openButton.setText(SanBootView.res.getString("ProfileChooser.button.open"));
   else openButton.setText(SanBootView.res.getString("ProfileChooser.button.save"));
   cancelButton.setText(SanBootView.res.getString("common.button.cancel"));
 }
예제 #6
0
 /** force the search button to be large enough for the longer of the two texts */
 private void setSearchButtonSizes() {
   search.setText(Globals.lang("Search specified field(s)"));
   Dimension size1 = search.getPreferredSize();
   search.setText(Globals.lang("Search all fields"));
   Dimension size2 = search.getPreferredSize();
   size2.width = Math.max(size1.width, size2.width);
   search.setMinimumSize(size2);
   search.setPreferredSize(size2);
 }
예제 #7
0
 private void jbInit() throws Exception {
   panel1.setLayout(xYLayout1);
   panel1.setBackground(new Color(251, 236, 175));
   jToggleButton5.setText("Done");
   jToggleButton5.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           jToggleButton5_actionPerformed(e);
         }
       });
   jLabel1.setToolTipText("");
   jList1.addMouseListener(
       new java.awt.event.MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           jList1_mouseClicked(e);
         }
       });
   HireFire.setText("Hire/Fire");
   HireFire.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           HireFire_actionPerformed(e);
         }
       });
   jButtonAdvertise.setText("Advertise");
   jButtonAdvertise.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           jButtonAdvertise_actionPerformed(e);
         }
       });
   jTextFieldWage.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           jTextFieldWage_actionPerformed(e);
         }
       });
   jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
   jLabel3.setText("Amount");
   jLabel5.setText("jLabel5");
   jTextFieldWage.setText("100");
   panel1.add(jList1, new XYConstraints(9, 10, 206, 250));
   panel1.add(jTextPane2, new XYConstraints(9, 262, 467, 109));
   panel1.add(jLabel1, new XYConstraints(476, 9, 10, 226));
   panel1.add(jLabel2, new XYConstraints(2, 454, 58, 12));
   panel1.add(jToggleButton5, new XYConstraints(385, 397, 75, 26));
   panel1.add(HireFire, new XYConstraints(9, 429, 134, 26));
   panel1.add(jPanel1, new XYConstraints(217, 10, 259, 250));
   this.getContentPane().add(panel1, BorderLayout.SOUTH);
   panel1.add(jButtonAdvertise, new XYConstraints(183, 401, 116, -1));
   panel1.add(jTextFieldWage, new XYConstraints(69, 403, 102, 24));
   panel1.add(jLabel3, new XYConstraints(19, 400, 46, 29));
   panel1.add(jLabel4, new XYConstraints(155, 460, 44, 6));
   panel1.add(jLabel5, new XYConstraints(507, 92, 5, 47));
   this.setVisible(true);
 }
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == pauseButton) {
     if (pauseButton.getText().equals("Pause Agents")) {
       pauseButton.setText("Resume Agents");
       Agent.pause = true;
     } else {
       pauseButton.setText("Pause Agents");
       Agent.pause = false;
     }
   }
 }
예제 #9
0
파일: User.java 프로젝트: EtherFrog/iutjava
 private void jbInit() throws Exception {
   this.getContentPane().setLayout(null);
   Bienvenue.setFont(new java.awt.Font("Garamond", 1, 24));
   Bienvenue.setForeground(SystemColor.textHighlight);
   Bienvenue.setRequestFocusEnabled(true);
   Bienvenue.setVerifyInputWhenFocusTarget(true);
   Bienvenue.setText("Bienvenue dans JChat");
   Bienvenue.setBounds(new Rectangle(125, 28, 305, 44));
   Pseudo_L.setFont(new java.awt.Font("Dialog", 1, 14));
   Pseudo_L.setText("Pseudonyme :");
   Pseudo_L.setBounds(new Rectangle(75, 94, 128, 28));
   nom.setText("");
   nom.setBounds(new Rectangle(229, 95, 108, 24));
   pwd.setText("");
   pwd.setBounds(new Rectangle(230, 135, 108, 25));
   pwd_L.setFont(new java.awt.Font("Dialog", 1, 14));
   pwd_L.setText("Mot de passe :");
   pwd_L.setBounds(new Rectangle(76, 133, 122, 31));
   gestionnaire_B gestionnaire = new gestionnaire_B();
   Connect.addActionListener(gestionnaire);
   Connect.setBackground(new Color(239, 240, 234));
   Connect.setBounds(new Rectangle(281, 251, 142, 30));
   Connect.setText("Connexion");
   Connect.setIcon(new ImageIcon(image_c));
   Annuler.addActionListener(gestionnaire);
   Annuler.setBackground(new Color(239, 240, 234));
   Annuler.setBounds(new Rectangle(104, 252, 140, 29));
   Annuler.setText("Annuler");
   Annuler.setIcon(new ImageIcon(image_d));
   this.getContentPane().setBackground(new Color(239, 240, 234));
   this.setForeground(new Color(239, 240, 234));
   this.setTitle("Interface de connexion des clients au serveur de chat");
   jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));
   jLabel1.setText("Adresse du serveur :");
   jLabel1.setBounds(new Rectangle(75, 176, 156, 26));
   jTextField1.setBounds(new Rectangle(230, 176, 108, 25));
   Icon siegle = new ImageIcon(image);
   siegle_L = new JLabel("", siegle, SwingConstants.LEFT);
   siegle_L.setBounds(new Rectangle(0, 1, 76, 105));
   this.getContentPane().add(jLabel1, null);
   this.getContentPane().add(pwd_L, null);
   this.getContentPane().add(Pseudo_L, null);
   this.getContentPane().add(jTextField1, null);
   this.getContentPane().add(nom, null);
   this.getContentPane().add(pwd, null);
   this.getContentPane().add(Bienvenue, null);
   this.getContentPane().add(Connect, null);
   this.getContentPane().add(Annuler, null);
   this.getContentPane().add(siegle_L, null);
   this.setSize(new Dimension(439, 321));
   this.setResizable(false);
   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   this.setVisible(true);
 }
예제 #10
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));
   }
 }
 public void actionPerformed(ActionEvent e) {
   if (e.getSource().equals(pausePlay)) {
     if (pausePlay.getText().equals("Play")) {
       pausePlay.setText("Pause");
       LifeSimulation.timer().start();
     } else {
       pausePlay.setText("Play");
       LifeSimulation.timer().stop();
     }
   }
 }
예제 #12
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);
  }
예제 #13
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("_");
   }
 }
예제 #14
0
  protected void initBtn() {
    bOk.setText("确定");
    bOk.setToolTipText("确定");
    bOk.setMargin(new Insets(0, 0, 0, 0));
    bOk.setIcon(ExplorerIcons.getExplorerIcon("jprofiler/checkbox_16.png"));
    bOk.addActionListener(this);

    bExit.setText("取消");
    bExit.setToolTipText("取消");
    bExit.setMargin(new Insets(0, 0, 0, 0));
    bExit.setIcon(ExplorerIcons.getExplorerIcon("jprofiler/delete.png"));
    bExit.addActionListener(this);
  }
예제 #15
0
  public static void changeProfile(String name) throws Exception {
    String workingDir = System.getProperty("user.dir");
    System.out.println(workingDir);
    File data = new File(workingDir + "/" + name + ".txt");
    if (data.exists()) {
      System.out.println("File exists Writer");
    } else {
      data.createNewFile();

      FileWriter fileW = new FileWriter(data);
      BufferedWriter buffW = new BufferedWriter(fileW);

      for (int i = 0; i < 8; i++) {
        buffW.newLine();
      }
      buffW.close();
    }

    FileReader file = new FileReader(name + ".txt");
    BufferedReader reader = new BufferedReader(file);

    String line = reader.readLine();
    line = reader.readLine();
    t1 = line;
    line = reader.readLine();
    t2 = line;
    line = reader.readLine();
    t3 = line;
    line = reader.readLine();
    t4 = line;
    line = reader.readLine();
    t5 = line;
    line = reader.readLine();
    t6 = line;
    line = reader.readLine();
    t7 = line;
    line = reader.readLine();
    t8 = line;
    reader.close();

    b1.setText(t1);
    b2.setText(t2);
    b3.setText(t3);
    b4.setText(t4);
    b5.setText(t5);
    b6.setText(t6);
    b7.setText(t7);
    b8.setText(t8);

    f1.setText(t1);
    f2.setText(t2);
    f3.setText(t3);
    f4.setText(t4);
    f5.setText(t5);
    f6.setText(t6);
    f7.setText(t7);
    f8.setText(t8);

    curPro.setText("Current Profile name: " + name);
  }
예제 #16
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Windows Form
   * Designer. Otherwise, retrieving design might not work properly. Tip: If you must revise this
   * method, please backup this GUI file for JFrameBuilder to retrieve your design properly in
   * future, before revising this method.
   */
  private void initializeComponent() {
    jTextPane1 = new JTextPane();
    jButton1 = new JButton();
    jButton2 = new JButton();
    contentPane = (JPanel) this.getContentPane();

    //
    // jTextPane1
    //
    jTextPane1.setBackground(new Color(140, 152, 236));
    jTextPane1.setForeground(new Color(255, 0, 0));
    jTextPane1.setText(
        "                               \n                                                 NO DONUT FOR YOU\n                           SORRY FOR INCONVINIENCE FACED BY YOU\n                                    SEVER IS DOWN FOR A TIME BEING\n                                         PLEASE TRY AGAIN LATER");
    jTextPane1.setEditable(false);
    //
    // jButton1
    //
    jButton1.setText("Home");
    jButton1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButton1_actionPerformed(e);
          }
        });
    //
    // jButton2
    //
    jButton2.setText("Friends");
    jButton2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButton2_actionPerformed(e);
          }
        });
    //
    // contentPane
    //
    contentPane.setLayout(null);
    contentPane.setBackground(new Color(140, 152, 236));
    addComponent(contentPane, jTextPane1, 76, 165, 451, 150);
    addComponent(contentPane, jButton1, 94, 36, 83, 39);
    addComponent(contentPane, jButton2, 184, 36, 83, 39);
    //
    // serverdown
    //
    this.setTitle("serverdown - extends JFrame");
    this.setLocation(new Point(0, 0));
    this.setSize(new Dimension(1024, 768));
  }
예제 #17
0
  public void actionPerformed(ActionEvent e) {

    if (e.getSource() == b1) {
      writeToClipboard(t1);
    } else if (e.getSource() == b2) {
      writeToClipboard(t2);
    } else if (e.getSource() == b3) {
      writeToClipboard(t3);
    } else if (e.getSource() == b4) {
      writeToClipboard(t4);
    } else if (e.getSource() == b5) {
      writeToClipboard(t5);
    } else if (e.getSource() == b6) {
      writeToClipboard(t6);
    } else if (e.getSource() == b7) {
      writeToClipboard(t7);
    } else if (e.getSource() == b8) {
      writeToClipboard(t8);
    } else if (e.getSource() == s1) {
      t1 = f1.getText();
      System.out.println("t1 = " + t1 + " f1 = " + f1.getText());
      b1.setText(t1);
      t2 = f2.getText();
      b2.setText(t2);
      t3 = f3.getText();
      b3.setText(t3);
      t4 = f4.getText();
      b4.setText(t4);
      t5 = f5.getText();
      b5.setText(t5);
      t6 = f6.getText();
      b6.setText(t6);
      t7 = f7.getText();
      b7.setText(t7);
      t8 = f8.getText();
      b8.setText(t8);
      try {
        System.out.println("Pressed Save");
        saveFile();
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    } else if (e.getSource() == close) {
      System.exit(EXIT_ON_CLOSE);
    } else if (e.getSource() == changepro) {
      try {
        path = profiel.getText();
        changeProfile(path);
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    } else if (e.getSource() == help) {
      // frame.getContentPane().add (new Help());
      // frame.pack();
      frame.setTitle("Help");
      frame.setVisible(true);
    }
  }
예제 #18
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);
   }
 }
 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);
 }
예제 #20
0
 /**
  * Component initialization.
  *
  * @throws java.lang.Exception
  */
 private void jbInit() throws Exception {
   image1 = new ImageIcon(pt.inescporto.siasoft.MenuFrame.class.getResource("about.png"));
   imageLabel.setIcon(image1);
   setTitle("About");
   panel1.setLayout(borderLayout1);
   panel2.setLayout(borderLayout2);
   insetsPanel1.setLayout(flowLayout1);
   insetsPanel2.setLayout(flowLayout1);
   insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
   gridLayout1.setRows(4);
   gridLayout1.setColumns(1);
   label1.setText(product);
   label2.setText(version);
   label3.setText(copyright);
   label4.setText(comments);
   insetsPanel3.setLayout(gridLayout1);
   insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10));
   button1.setText("OK");
   button1.addActionListener(this);
   insetsPanel2.add(imageLabel, null);
   panel2.add(insetsPanel2, BorderLayout.WEST);
   getContentPane().add(panel1, null);
   insetsPanel3.add(label1, null);
   insetsPanel3.add(label2, null);
   insetsPanel3.add(label3, null);
   insetsPanel3.add(label4, null);
   panel2.add(insetsPanel3, BorderLayout.CENTER);
   insetsPanel1.add(button1, null);
   panel1.add(insetsPanel1, BorderLayout.SOUTH);
   panel1.add(panel2, BorderLayout.NORTH);
   setResizable(true);
 }
예제 #21
0
  private void setUpGui() {
    area = JokemonDriver.Area.Stringville;
    mouse = new Point();
    int thingInt = 0;
    this.setTitle("Town Map");
    this.setSize(195, 239);
    this.setResizable(false);
    this.setLayout(null);
    this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    this.setVisible(false);
    visible = false;
    this.setLocationRelativeTo(null);
    Container cp = this.getContentPane();

    JLabel map = new JLabel();
    map.setBounds(1, -5, 188, 176);
    map.setIcon(new ImageIcon(townMap.class.getResource("Logos/townmap.png")));

    closeWindow = new JButton();
    closeWindow.setText("Close Window");
    closeWindow.setBounds(0, 192, 188, 20);

    areaDisplay = new JLabel();
    areaDisplay.setText(area.toString().replace('_', ' '));
    areaDisplay.setHorizontalAlignment(JLabel.CENTER);
    areaDisplay.setBounds(0, 171, 188, 20);

    addMouseMotionListener(this);
    closeWindow.addActionListener(this);
    cp.add(map);
    cp.add(closeWindow);
    cp.add(areaDisplay);
  }
예제 #22
0
  /**
   * 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);
          }
        });
  }
예제 #23
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;
    }
예제 #24
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);
 }
 private void showNextCard() {
   currentCard = cardList.get(currentCardIndex);
   currentCardIndex++;
   display.setText(currentCard.getQuestion());
   nextButton.setText("Show Answer");
   isShowAnswer = true;
 }
예제 #26
0
 public void actionPerformed(ActionEvent ae) {
   if (ae.getActionCommand() == "timer") {
     if (counter >= imagePaths.length) {
       timer.stop();
       counter = 0;
       PlayStopButton.setText("Play");
     } else {
       try {
         // if the array contains URLs
         if (imagePaths[counter].contains("http://")) {
           scrollPane.setToolTipText(imagePaths[counter]);
           imageIcon = new ImageIcon((new URL(imagePaths[counter++])));
           scrollPane.setViewportView(new JLabel(imageIcon));
         }
         // if the array contains local images
         else {
           image.setIcon(new ImageIcon(imagePaths[counter]));
           image.setToolTipText(imagePaths[counter++]);
         }
       } catch (MalformedURLException ex) {
         Logger.getLogger(Slideshow.class.getName()).log(Level.SEVERE, null, ex);
         image = new JLabel("?" + imagePaths);
       }
     }
   }
 }
예제 #27
0
 public void makeSHButtonActionPerformed(ActionEvent evt) {
   String name = "Stakeholder " + (this.stakeholders.size());
   boolean a, b, c, d, e;
   a = b = c = d = e = false;
   int random = (int) (Math.random() * 32);
   System.out.println(random);
   if (random >= 16) {
     a = true;
     random -= 16;
   }
   if (random >= 8) {
     b = true;
     random -= 8;
   }
   if (random >= 4) {
     c = true;
     random -= 4;
   }
   if (random >= 2) {
     d = true;
     random -= 2;
   }
   if (random >= 1) {
     e = true;
     random -= 1;
   }
   System.out.printf("Stakeholder(%s, ,%b,%b,%b,%b,%b)%n", name, a, b, c, d, e);
   Stakeholder s = new Stakeholder(name, "", a, b, c, d, e);
   stakeholders.add(s);
   pushAllSHButton.setText("Push " + stakeholders.size() + " to View");
 }
 private void init() throws Exception {
   this.setTitle("RasterShield Symbols");
   this.getContentPane().setLayout(null);
   treeToc1.setMap(map1);
   treeToc1.setBounds(new Rectangle(0, 52, 119, 309));
   zoomPanToolBar1.setMap(map1);
   zoomPanToolBar1.setBounds(new Rectangle(200, 5, 244, 43));
   map1.setBounds(new Rectangle(122, 51, 454, 309));
   jButton1.setBounds(new Rectangle(4, 2, 155, 48));
   jButton1.setText("Create Symbols");
   jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
   layer1.setDataset(
       "com.esri.mo2.src.file.FileSystemConnection!C:/ESRI/MOJ20/Samples/Data/USA/states.shp!");
   layer1.setBounds(new Rectangle(125, 91, 32, 32));
   layer2.setDataset(
       "com.esri.mo2.src.file.FileSystemConnection!C:/ESRI/MOJ20/Samples/Data/USA/ushigh.shp!");
   layer2.setBounds(new Rectangle(261, 153, 32, 32));
   layer3.setDataset(
       "com.esri.mo2.src.file.FileSystemConnection!C:/ESRI/MOJ20/Samples/Data/USA/capitals.shp!");
   layer3.setBounds(new Rectangle(274, 93, 32, 32));
   this.getContentPane().add(treeToc1, null);
   this.getContentPane().add(map1, null);
   this.getContentPane().add(zoomPanToolBar1, null);
   this.setSize(new Dimension(580, 363));
   map1.add(layer1, null);
   this.getContentPane().add(jButton1, null);
   map1.add(layer2, null);
   map1.add(layer3, null);
   this.setDefaultCloseOperation(EXIT_ON_CLOSE);
 }
예제 #29
0
 private void jbInit() throws Exception {
   box1 = Box.createVerticalBox();
   this.getContentPane().setLayout(borderLayout1);
   close.setText("Close");
   close.addActionListener(new CellHelpWindow_close_actionAdapter(this));
   jLabel1.setText("Recommendation");
   jLabel2.setText("Description");
   jPanel1.setLayout(borderLayout2);
   jPanel2.setLayout(borderLayout3);
   description.setText("jTextPane1");
   description.setContentType("text/html");
   scp1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   scp1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   scp1.setToolTipText("");
   recom.setText("");
   recom.setContentType("text/html");
   this.getContentPane().add(box1, BorderLayout.CENTER);
   box1.add(jPanel1, null);
   box1.add(jPanel2, null);
   this.getContentPane().add(jPanel3, BorderLayout.SOUTH);
   jPanel3.add(close, null);
   jPanel2.add(jLabel1, BorderLayout.NORTH);
   jPanel2.add(scp2, BorderLayout.CENTER);
   scp2.getViewport().add(recom, null);
   jPanel2.add(scp2, BorderLayout.CENTER);
   jPanel1.add(jLabel2, BorderLayout.NORTH);
   jPanel1.add(scp1, BorderLayout.CENTER);
   scp1.getViewport().add(description, null);
 }
    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);
    }