// -------------------------------------------------------------------
  public static void main(String[] args) {
    // Create the window
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(new Dimension(300, 100));
    frame.setTitle("A frame");
    frame.setLayout(new FlowLayout()); // This will be discuss in the next lesson

    // Create and add the first button
    JButton button1 = new JButton();
    button1.setText("I'm a button.");
    button1.setBackground(Color.BLUE);
    frame.add(button1);

    // Create and add the second button
    JButton button2 = new JButton();
    button2.setText("Click me!");
    button2.setBackground(Color.RED);
    frame.add(button2);

    // Reset the sizes of the buttons and window
    frame.pack();

    // Actually put the window on the screen and draw all its components
    frame.setVisible(true);
  }
Ejemplo n.º 2
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();
  }
Ejemplo n.º 3
0
 public void actionPerformed(ActionEvent ev) {
   if (button.getText().equals("Hello")) {
     button.setText("World");
   } else {
     button.setText("Hello");
   }
 }
Ejemplo n.º 4
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);
   }
 }
Ejemplo n.º 5
0
 private void moveCacheToState(ComponentStatus state) {
   switch (state) {
     case INITIALIZING:
       cacheStatus.setText(statusStarting);
       processAction(actionButton, true);
       break;
     case RUNNING:
       setCacheTabsStatus(true);
       actionButton.setText(stopCacheButtonLabel);
       processAction(actionButton, false);
       cacheStatus.setText(statusStarted);
       updateTitleBar();
       break;
     case STOPPING:
       cacheStatus.setText(statusStopping);
       processAction(actionButton, true);
       break;
     case TERMINATED:
       setCacheTabsStatus(false);
       actionButton.setText(startCacheButtonLabel);
       processAction(actionButton, false);
       cacheStatus.setText(statusStopped);
       updateTitleBar();
   }
   controlPanelTab.repaint();
 }
Ejemplo n.º 6
0
 /** Pause/resume the module. */
 public void setIsPaused(boolean isPaused) {
   this.isPaused = isPaused;
   if (isPaused) {
     btnPauseResume.setText("Resume");
   } else {
     btnPauseResume.setText("Pause");
   }
 }
Ejemplo n.º 7
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"));
 }
Ejemplo n.º 8
0
 /** Creates and displays the main GUI This GUI has the list and the main * buttons */
 public void showGUI() {
   final JScrollPane scrollPane = new JScrollPane();
   table =
       new JTable(
           new DefaultTableModel(
               new Object[][] {}, new String[] {"Username", "Password", "Pin", "Reward"}));
   AccountManager.loadAccounts();
   if (AccountManager.hasAccounts()) {
     for (Account account : AccountManager.getAccounts()) {
       ((DefaultTableModel) table.getModel())
           .addRow(
               new Object[] {
                 account.getUsername(), account.getReward(), account.getPin(), account.getReward()
               });
     }
   }
   final JToolBar bar = new JToolBar();
   bar.setMargin(new Insets(1, 1, 1, 1));
   bar.setFloatable(false);
   removeButton = new JButton("Remove");
   final JButton newButton = new JButton("Add");
   final JButton doneButton = new JButton("Save");
   table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   table.getSelectionModel().addListSelectionListener(new TableSelectionListener());
   table.setShowGrid(true);
   final TableColumnModel cm = table.getColumnModel();
   cm.getColumn(cm.getColumnIndex("Password")).setCellRenderer(new PasswordCellRenderer());
   cm.getColumn(cm.getColumnIndex("Password")).setCellEditor(new PasswordCellEditor());
   cm.getColumn(cm.getColumnIndex("Pin")).setCellRenderer(new PasswordCellRenderer());
   cm.getColumn(cm.getColumnIndex("Pin")).setCellEditor(new PasswordCellEditor());
   cm.getColumn(cm.getColumnIndex("Reward")).setCellEditor(new RandomRewardEditor());
   scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
   scrollPane.setViewportView(table);
   add(scrollPane, BorderLayout.CENTER);
   newButton.setFocusable(false);
   newButton.setToolTipText(newButton.getText());
   newButton.setText("+");
   bar.add(newButton);
   removeButton.setFocusable(false);
   removeButton.setToolTipText(removeButton.getText());
   removeButton.setText("-");
   bar.add(removeButton);
   bar.add(Box.createHorizontalGlue());
   doneButton.setToolTipText(doneButton.getText());
   bar.add(doneButton);
   newButton.addActionListener(this);
   removeButton.addActionListener(this);
   doneButton.addActionListener(this);
   add(bar, BorderLayout.SOUTH);
   final int row = table.getSelectedRow();
   removeButton.setEnabled(row >= 0 && row < table.getRowCount());
   table.clearSelection();
   doneButton.requestFocus();
   setPreferredSize(new Dimension(600, 300));
   pack();
   setLocationRelativeTo(getOwner());
   setResizable(false);
 }
Ejemplo n.º 9
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);
 }
Ejemplo n.º 10
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);
 }
Ejemplo n.º 11
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));
   }
 }
Ejemplo n.º 12
0
 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();
     }
   }
 }
Ejemplo n.º 13
0
 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);
 }
 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;
     }
   }
 }
Ejemplo n.º 15
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);
  }
Ejemplo n.º 16
0
 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("_");
   }
 }
Ejemplo n.º 17
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);
  }
Ejemplo n.º 18
0
 private void initButtonPanel() {
   final Parser p = InterfaceConfig.SELECTION_FRAME_PROPERTIES;
   back.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent actionEvent) {
           state.back();
         }
       });
   back.setText(p.getString("back-button"));
   next.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent actionEvent) {
           state.next();
         }
       });
   next.setText(p.getString("next-button-next"));
   config.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent actionEvent) {
           JDialog d =
               loaders.get(plugins.getSelectedIndex()).getConfigDialog(SelectionFrame.this);
           d.setLocationByPlatform(true);
           d.setModal(true);
           d.setVisible(true);
         }
       });
   JButton manual = new JButton(p.getString("manual-button"));
   manual.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent actionEvent) {
           MainFrame.showHelp(
               state.getManualTile(),
               p.getInt("manual-width"),
               p.getInt("manual-height"),
               p.getInt("manual-deltaX"),
               p.getInt("manual-deltaY"),
               state.getManualURL(),
               SelectionFrame.this);
         }
       });
   config.setText(p.getString("config-button"));
   buttonPanel.add(back);
   buttonPanel.add(manual);
   buttonPanel.add(config);
   buttonPanel.add(next);
   buttonPanel.revalidate();
 }
Ejemplo n.º 19
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);
  }
Ejemplo n.º 20
0
  private void init() throws Exception {
    this.propertyChangeListeners = new PropertyChangeSupport(this);

    backButton = new JButton();
    nextButton = new JButton();
    finishButton = new JButton();
    cancelButton = new JButton();

    panelList = new ArrayList();
    currentIndex = 0;
    wizardPanelsContainer = new JPanel();

    backButton.setText("< Back");
    backButton.setMnemonic("B".charAt(0));
    backButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            backButton_actionPerformed(e);
          }
        });

    nextButton.setText("Next >");
    nextButton.setMnemonic("N".charAt(0));
    nextButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            nextButton_actionPerformed(e);
          }
        });

    cancelButton.setText("Cancel");
    cancelButton.setMnemonic("C".charAt(0));
    cancelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cancelButton_actionPerformed(e);
          }
        });

    finishButton.setText("Finish");
    finishButton.setMnemonic("F".charAt(0));
    finishButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            finishButton_actionPerformed(e);
          }
        });

    wizardPanelsContainer.setLayout(new CardLayout());
  }
Ejemplo n.º 21
0
 private void jbInit() throws Exception {
   setTitle("DIARIO CONTADO");
   frmDatosVenta = new FrmDatosVenta(engine);
   frmDatosVenta.setLocationRelativeTo(this);
   getContentPane().setLayout(borderLayout1);
   jLabel1.setFont(new java.awt.Font("Arial", Font.PLAIN, 18));
   jLabel1.setToolTipText("");
   jLabel1.setText("DIARIO DE ENTRADAS");
   pnlCentro.setLayout(borderLayout2);
   cmdCerrar.setText("CERRAR");
   cmdCerrar.addActionListener(new FrmDiarioDeEntradas_cmdCerrar_actionAdapter(this));
   cmdImprimir.setText("IMPRIMIR");
   tblDiario.setBackground(new Color(255, 240, 255));
   tblDiario.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
   tblDiario.setModel(modelDiarioVentasDeContado1);
   tblDiario.addMouseListener(new FrmDiarioDeEntradas_tblDiario_mouseAdapter(this));
   this.addWindowListener(new FrmDiarioDeEntradas_this_windowAdapter(this));
   jLabel2.setFont(new java.awt.Font("Arial", Font.BOLD, 20));
   jLabel2.setText("Total:");
   lblTotal.setFont(new java.awt.Font("Arial", Font.BOLD, 20));
   lblTotal.setText("");
   this.getContentPane().setBackground(Color.white);
   this.addKeyListener(new FrmDiarioDeEntradas_this_keyAdapter(this));
   pnlCentro.setBackground(Color.white);
   pnlNorte.setBackground(Color.white);
   pnlNorte.setLayout(borderLayout4);
   scrollDiario.getViewport().setBackground(Color.white);
   scrollDiario.setPreferredSize(new Dimension(800, 600));
   lblFecha.setFont(new java.awt.Font("Arial", Font.BOLD, 16));
   lblFecha.setText("");
   jPanel1.setLayout(borderLayout3);
   pnlSur.setMaximumSize(new Dimension(4000, 200));
   jPanel1.setBackground(Color.white);
   jPanel2.setBackground(Color.white);
   this.getContentPane().add(pnlCentro, java.awt.BorderLayout.CENTER);
   pnlCentro.add(pnlNorte, java.awt.BorderLayout.CENTER);
   pnlCentro.add(scrollDiario, java.awt.BorderLayout.NORTH);
   scrollDiario.getViewport().add(tblDiario);
   this.getContentPane().add(pnlSur, java.awt.BorderLayout.SOUTH);
   pnlSur.add(cmdImprimir);
   pnlSur.add(cmdCerrar);
   this.getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
   jPanel1.add(lblFecha, java.awt.BorderLayout.EAST);
   jPanel1.add(jLabel1, java.awt.BorderLayout.WEST);
   pnlNorte.add(jPanel2, java.awt.BorderLayout.EAST);
   jPanel2.add(jLabel2);
   jPanel2.add(lblTotal);
   this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
 }
Ejemplo n.º 22
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));
  }
Ejemplo n.º 23
0
 public void updateLocale() {
   origin = I18N.getLocaleString("MAIN_ALL");
   mcVersion = I18N.getLocaleString("MAIN_ALL");
   avaliability = I18N.getLocaleString("MAIN_ALL");
   filter.setText(I18N.getLocaleString("FILTER_SETTINGS"));
   updateFilterText();
   editModPack.setText(I18N.getLocaleString("MODS_EDIT_PACK"));
   if (I18N.currentLocale == I18N.Locale.deDE) {
     editModPack.setBounds(290, 5, 120, 25);
     typeLbl.setBounds(115, 5, 165, 25);
   } else {
     editModPack.setBounds(300, 5, 110, 25);
     typeLbl.setBounds(115, 5, 175, 25);
   }
 }
Ejemplo n.º 24
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);
    }
  }
Ejemplo n.º 25
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);
 }
Ejemplo n.º 27
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);
          }
        });
  }
 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);
 }
 private void showNextCard() {
   currentCard = cardList.get(currentCardIndex);
   currentCardIndex++;
   display.setText(currentCard.getQuestion());
   nextButton.setText("Show Answer");
   isShowAnswer = true;
 }
Ejemplo n.º 30
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);
 }