Exemplo n.º 1
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);
   }
 }
Exemplo n.º 2
0
  public void refresh() {
    confirmationPanel.setBorder(
        BorderFactory.createTitledBorder(window.getObjectsName()[8][window.getSelectedLenguage()]));
    historicalPanel.setBorder(
        BorderFactory.createTitledBorder(
            window.getObjectsName()[12][window.getSelectedLenguage()]));

    inputLabel.setBorder(
        BorderFactory.createTitledBorder(window.getObjectsName()[9][window.getSelectedLenguage()]));
    acceptButton.setText(window.getObjectsName()[10][window.getSelectedLenguage()]);
    denyButton.setText(window.getObjectsName()[11][window.getSelectedLenguage()]);

    infoPanel.setBorder(
        BorderFactory.createTitledBorder(
            window.getObjectsName()[13][window.getSelectedLenguage()]));
    userLabel.setBorder(
        BorderFactory.createTitledBorder(
            window.getObjectsName()[14][window.getSelectedLenguage()]));
    dateLabel.setBorder(
        BorderFactory.createTitledBorder(
            window.getObjectsName()[14][window.getSelectedLenguage()]));

    if (inputLabel.getText().equals(defaultMessage)) {
      defaultMessage = window.getObjectsName()[15][window.getSelectedLenguage()];
      inputLabel.setText(defaultMessage);
    } else {
      defaultMessage = window.getObjectsName()[15][window.getSelectedLenguage()];
    }
  }
Exemplo n.º 3
0
    private void init() {

      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      contentPane.setPreferredSize(new Dimension(screenSize.width / 2, screenSize.height / 3));

      setContentPane(contentPane);
      contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
      buttonBar.setLayout(new FlowLayout());
      buttonBarGrid.setLayout(new FlowLayout());

      JButton cancelButton = new JButton();
      JButton okButton = new JButton();
      okButton.setText("OK");
      okButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              onOk();
            }
          });
      cancelButton.setText("CANCEL");
      cancelButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              onCancel();
            }
          });
      buttonBarGrid.add(okButton);
      buttonBarGrid.add(cancelButton);
      buttonBar.add(buttonBarGrid);

      controlsPanel.setLayout(new BoxLayout(controlsPanel, BoxLayout.X_AXIS));
      controlsPanel.add(createTab());
      contentPane.add(controlsPanel, BorderLayout.NORTH);
      contentPane.add(buttonBar, BorderLayout.SOUTH);
    }
Exemplo n.º 4
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();
  }
Exemplo n.º 5
0
    @Override
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      if (isSelected) {
        renderButton.setForeground(table.getSelectionForeground());
        renderButton.setBackground(table.getSelectionBackground());
      } else {
        renderButton.setForeground(table.getForeground());
        renderButton.setBackground(UIManager.getColor("Button.background"));
      }

      renderButton.setFocusPainted(hasFocus);

      if (value == null) {
        renderButton.setText("");
        renderButton.setIcon(null);
      } else if (value instanceof Icon) {
        renderButton.setText("");
        renderButton.setIcon((Icon) value);
      } else {
        renderButton.setText(value.toString());
        renderButton.setIcon(null);
      }
      return renderButton;
    }
Exemplo n.º 6
0
 /**
  * This method initializes remove
  *
  * @return javax.swing.JButton
  */
 private JButton getRemove() {
   if (remove == null) {
     remove = new JButton();
     if (update) {
       remove.setText("Update Privilege(s)");
     } else {
       remove.setText("Add Privilege(s)");
     }
     remove.addActionListener(
         new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             Runner runner =
                 new Runner() {
                   public void execute() {
                     addUpdatePrivileges();
                   }
                 };
             try {
               GridApplication.getContext().executeInBackground(runner);
             } catch (Exception t) {
               t.getMessage();
             }
           }
         });
   }
   return remove;
 }
  public MultipleObjectsActionPanel(GeometryEditPane editPane) {
    this.editPane = editPane;

    setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();
    GridBagConstraintsEditor editor = new GridBagConstraintsEditor(c);

    JButton filters = new JButton();
    ShowFilterMenuAction filtersAction = new ShowFilterMenuAction(editPane, filters);
    filters.setAction(filtersAction);
    filters.setMargin(new Insets(0, 0, 0, 0));

    MergeChainsAction mergeChainsAction = new MergeChainsAction(editPane);
    mergeChains = new JButton(mergeChainsAction);
    mergeChains.setMargin(new Insets(0, 0, 0, 0));
    mergeChains.setText(null);

    ToPolygonAction toPolygonAction = new ToPolygonAction(editPane);
    toPolygon = new JButton(toPolygonAction);
    toPolygon.setMargin(new Insets(0, 0, 0, 0));
    toPolygon.setText(null);

    ConvexHullAction chAction = new ConvexHullAction(editPane);
    JButton convexHull = new JButton(chAction);
    convexHull.setMargin(new Insets(0, 0, 0, 0));
    convexHull.setText(null);

    editor.gridPos(GridBagConstraints.RELATIVE, 0);
    editor.fill(GridBagConstraints.BOTH);
    add(filters, c);
    add(mergeChains, c);
    add(toPolygon, c);
    add(convexHull, c);
  }
 public void loadRemoteCombo() {
   int i = annotationPaneLabel.getSelectedIndex();
   if (i == 0) {
     //	fab.loadRemote.setSelected(true);
     setBorder(new LineBorder(AnnotationSidePanel.publicColor, 2));
     // bPubAnno.setText("Publish");
     // bPubAnno.setIcon(FabIcons.getIcons().ICOPUB);
     fab.mpublish.setText("Save public");
     bCopy.setText("Copy to private");
     local = false;
     if (!PersonalAnnos.useRemoteServer) {
       bro.eventq(PersonalAnnos.MSG_GO_REMOTE, null);
       bro.eventq(PersonalAnnos.MSG_REFRESH_LIST, null);
     }
   } else if (i == 1) {
     //	fab.loadRemote.setSelected(false);
     setBorder(new LineBorder(AnnotationSidePanel.privateColor, 2));
     // bPubAnno.setText("Save");
     bCopy.setText("Copy to public");
     fab.mpublish.setText("Save private");
     local = true;
     // bPubAnno.setIcon(FabIcons.getIcons().ICOSAVE);
     if (PersonalAnnos.useRemoteServer) {
       bro.eventq(PersonalAnnos.MSG_GO_LOCAL, null);
       bro.eventq(PersonalAnnos.MSG_REFRESH_LIST, null);
     }
   }
 }
  // -------------------------------------------------------------------
  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);
  }
Exemplo n.º 10
0
 public void setTrumpButtons(String unplayable) {
   Image c1 = setImage("H");
   card1.setIcon(new ImageIcon(c1));
   card1.setText(null);
   Image c2 = setImage("S");
   card2.setIcon(new ImageIcon(c2));
   card2.setText(null);
   Image c3 = setImage("D");
   card3.setIcon(new ImageIcon(c3));
   card3.setText(null);
   Image c4 = setImage("C");
   card4.setIcon(new ImageIcon(c4));
   card4.setText(null);
   card5.setText("Pass");
   card5.setIcon(null);
   switch (unplayable) {
     case "H":
       card1.setEnabled(false);
       break;
     case "S":
       card2.setEnabled(false);
       break;
     case "D":
       card3.setEnabled(false);
       break;
     case "C":
       card4.setEnabled(false);
       break;
   }
 }
Exemplo n.º 11
0
  public void applyI18n() {
    // Start autogenerated code ----------------------
    // End autogenerated code ----------------------
    jButtonOK.setText(it.businesslogic.ireport.util.I18n.getString("ok", "Ok"));
    jButtonCancel.setText(it.businesslogic.ireport.util.I18n.getString("cancel", "Cancel"));

    jLabelCategoryExpression.setText(
        it.businesslogic.ireport.util.I18n.getString(
            "charts.categoryExpression", "Category expression"));
    jLabelSeriesExpression.setText(
        it.businesslogic.ireport.util.I18n.getString(
            "charts.seriesExpression", "Series expression"));
    jLabelValueExpression.setText(
        it.businesslogic.ireport.util.I18n.getString("charts.valueExpression", "Value expression"));
    jLabelLabelExpression.setText(
        it.businesslogic.ireport.util.I18n.getString("charts.labelExpression", "Label expression"));

    jTabbedPane1.setTitleAt(0, I18n.getString("chartSeries.tab.Data", "Data"));
    jTabbedPane1.setTitleAt(1, I18n.getString("chartSeries.tab.ItemHyperlink", "Item hyperlink"));

    this.setTitle(
        it.businesslogic.ireport.util.I18n.getString(
            "gui.ChartPropertiesDialog.title", "Chart properties"));
    this.getRootPane().updateUI();
  }
Exemplo n.º 12
0
 public void applyI18n() {
   // Start autogenerated code ----------------------
   jButton2.setText(I18n.getString("beanInspectorPanel.button2", "Add selected field(s)"));
   jButton3.setText(I18n.getString("beanInspectorPanel.button3", "Clear fields list"));
   jLabel1.setText(I18n.getString("beanInspectorPanel.label1", "Bean"));
   // End autogenerated code ----------------------
 }
Exemplo n.º 13
0
 @Override
 public void languageChanged(Language sender) {
   btnBuyProperty.setText(sender.get("buy property"));
   btnDontBuyProperty.setText(sender.get("don't buy property"));
   beforeBuy = sender.get("prop_announce");
   refresh();
 }
Exemplo n.º 14
0
 protected void setButtonText() {
   if (isSetMode) {
     setButton.setText(Bundle.getMessage("Done"));
   } else {
     setButton.setText(Bundle.getMessage("Set"));
   }
 }
Exemplo n.º 15
0
  /** Updates the button. */
  private void updateButton() {
    if (!initialized) return;

    Icon icon = IconManager.instance().getIconForButton(iconName);

    if (icon == null) {
      super.setText(message);

      setVerticalTextPosition(SwingConstants.CENTER);
      setHorizontalTextPosition(SwingConstants.CENTER);

      setContentAreaFilled(true);
      setBorderPainted(true);
      setOpaque(true);

    } else {
      setIcon(icon);

      Icon rollover = IconManager.instance().getIconForButton(rollOverIconName);
      if (rollover == null) {
        rollover = IconManager.instance().getRolloverIconForButton(iconName);
      }
      setRolloverIcon(rollover);

      if (!horizontalText) {
        setVerticalTextPosition(SwingConstants.BOTTOM);
        setHorizontalTextPosition(SwingConstants.CENTER);
      } else {
        setVerticalTextPosition(SwingConstants.CENTER);
        setHorizontalTextPosition(SwingConstants.TRAILING);
      }

      if (useTransparentBackground) {
        setBorderPainted(false);
        setOpaque(false);
        setContentAreaFilled(false);
      } else {
        setBorderPainted(true);
        setOpaque(false);
        setContentAreaFilled(true);
      }

      if (!iconOnly
          && UISettings.TEXT_WITH_ICONS.getValue()
          && message != null
          && message.length() > 0) {
        super.setText(message);
        setPreferredSize(null);
      } else {
        super.setText(null);
        int height = icon.getIconHeight();
        int width = icon.getIconWidth();
        if (message == null || message.length() > 0) {
          height += 15;
          width += 15;
        }
        setPreferredSize(new Dimension(height, width));
      }
    }
  }
Exemplo n.º 16
0
  private void createEditorDialog() {

    int w = top.getSize().width;
    //      int h = top.getSize().height;

    editorDialog = new JDialog(top, true);
    editorDialog.setTitle(rb.getString("dialog.editor.title"));

    JPanel base = new JPanel(new GridLayout(2, 1));
    editorDialog.getContentPane().add(base);

    JPanel p = new JPanel(new BorderLayout());
    p.setPreferredSize(new Dimension(w * 6 / 10, 0));
    editorChooser = new JFileChooserHistoryComboBox();
    editorChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    p.add(BorderLayout.SOUTH, editorChooser);
    base.add(p);

    p = new JPanel();

    okEditorDialogButton = new JButton();
    okEditorDialogButton.setText(rb.getString("dialog.common.button.ok.text"));
    editorDialog.getRootPane().setDefaultButton(okEditorDialogButton);
    p.add(okEditorDialogButton);

    cancelEditorDialogButton = new JButton();
    cancelEditorDialogButton.setText(rb.getString("dialog.common.button.cancel.text"));
    p.add(cancelEditorDialogButton);
    base.add(p);

    editorDialog.pack();
  }
Exemplo n.º 17
0
  private void validateUserForm() {

    if (!txtFirstName.getText().equals("")
        && !txtLastName.getText().equals("")
        && !txtEmail.getText().equals("")
        && StringUtils.isValidEmailAddress(txtEmail.getText())) {

      btnAdd.setEnabled(true);
      btnClear.setEnabled(true);

      if (lblUserId.getText().equals("")) btnAdd.setText("Add");
      else btnAdd.setText("Update");
    } else btnAdd.setEnabled(false);

    // check if form is blank
    if (txtFirstName.getText().equals("")
        && txtLastName.getText().equals("")
        && txtEmail.getText().equals("")) {

      btnAdd.setText("Add");
      btnAdd.setEnabled(false);
    }

    // update mode
    if (!lstUsers.getSelectedValuesList().isEmpty()) btnClear.setEnabled(false);
  }
Exemplo n.º 18
0
  private void createPatternDialog() {

    int w = top.getSize().width;
    // int h = top.getSize().height;

    patternDialog = new JDialog(top, true);
    patternDialog.setTitle(rb.getString("dialog.pattern.title"));

    JPanel base = new JPanel(new GridLayout(2, 1));
    patternDialog.getContentPane().add(base);

    JPanel p = new JPanel(new BorderLayout());
    p.setPreferredSize(new Dimension(w * 4 / 10, 0));
    patternField = new JHistoryComboBox();
    p.add(BorderLayout.SOUTH, patternField);
    base.add(p);

    p = new JPanel();

    okPatternDialogButton = new JButton();
    okPatternDialogButton.setText(rb.getString("dialog.common.button.ok.text"));
    patternDialog.getRootPane().setDefaultButton(okPatternDialogButton);
    p.add(okPatternDialogButton);

    cancelPatternDialogButton = new JButton();
    cancelPatternDialogButton.setText(rb.getString("dialog.common.button.cancel.text"));
    p.add(cancelPatternDialogButton);
    base.add(p);

    patternDialog.pack();
  }
Exemplo n.º 19
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == m_bGameStart) {
      isGameStart = true;
      isGameHalt = false;
      isGameOver = false;
      m_bGameStart.setEnabled(false);
      m_bGameHalt.setEnabled(true);
      setNextReady(true);
    } else if (e.getSource() == m_bGameHalt) {
      m_bGameHalt.setEnabled(false);
      m_bGameStart.setEnabled(true);
      isGameHalt = true;
      m_bGameStart.setText("continue");
    } else if (e.getSource() == m_bGameOver) {
      isGameStart = false;
      isGameOver = true;
      //// System.out.println("ok \n");
      System.exit(0);
    }

    // if is voice control
    else if (e.getSource() == m_bVoiceControl) {
      if (m_bVoiceControl.getText().equalsIgnoreCase("Voice control")) {
        m_bVoiceControl.setText("Cancel VC");
        // start voice control
        TetrisControl tc = new TetrisControl(this);
        tc.start();
      } else {
        m_bVoiceControl.setText("Voice control");
      }
    }
  }
Exemplo n.º 20
0
  private void JButtonInit() {
    // Reserva de memoria para los JButton.
    OkButton = new JButton();
    CancelButton = new JButton();

    // Establecimiento del tama�o, textos y tipo de letra para OkButton.
    OkButton.setBounds(new Rectangle(195, 115, 100, 30));
    OkButton.setText("Ok");
    OkButton.setFont(new java.awt.Font("Button", 1, 12));

    // Establecimiento de la funcionalidad de OkButton.
    OkButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            OkButtonActionPerformed(e);
          }
        });

    // Establecimiento del tama�o, texto y tipo de letra para CancelButton.
    CancelButton.setBounds(new Rectangle(310, 115, 100, 30));
    CancelButton.setText("Cancel");
    CancelButton.setFont(new java.awt.Font("Button", 1, 12));

    // Establecimiento de la funcionalidad de CancelButton.
    CancelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            CancelButtonActionPerformed(e);
          }
        });
  }
Exemplo n.º 21
0
 public void actionPerformed(ActionEvent ev) {
   if (button.getText().equals("Hello")) {
     button.setText("World");
   } else {
     button.setText("Hello");
   }
 }
Exemplo n.º 22
0
 /**
  * Display the name of the coordinate reference system
  *
  * @param crs the CRS to display
  */
 public void displayCRS(CoordinateReferenceSystem crs) {
   if (crs == null) {
     crsBtn.setText(stringRes.getString("crs_undefined"));
   } else {
     crsBtn.setText(crs.getName().toString());
   }
 }
Exemplo n.º 23
0
  private JPanel getJPanel1() {
    if (jPanel1 == null) {
      jPanel1 = new JPanel();
      jContentPane.add(jPanel1, BorderLayout.SOUTH);
      jPanel1.setPreferredSize(new Dimension(0, 20));
      jPanel1.setLayout(new BorderLayout());

      okButton = new JButton();
      okButton.setText("确定");
      okButton.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
              pressButton(BUTTON_OK);
            }
          });
      cancelButton = new JButton();
      cancelButton.setText("取消");
      cancelButton.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
              pressButton(BUTTON_CANCEL);
            }
          });

      jPanel1.add(okButton, BorderLayout.WEST);
      jPanel1.add(cancelButton, BorderLayout.EAST);
    }

    return jPanel1;
  }
Exemplo n.º 24
0
  public void getResponse() {
    responseGridManager.setResponseFieldset(responseFieldsetPanel);
    responseGridManager.setResponseFieldsetGrid(responseFieldsetGridPanel);
    responseGridManager.setActionButtonGroup(actionButtonGroup);
    responseGridManager.setCtypeButtonGroup(ctypeButtonGroup);
    responseGridManager.setFrame(frame);

    saveSessionInfo();
    String response_mpm = actionCommandSubscriber.executeBsoSubscriberCommand(createBean());

    responseGridManager.setResponseGridAssurance(response_mpm);
    textArea.setText(response_mpm.trim());

    btnExecute.setEnabled(true);

    if (response_mpm.equals(components.getErrorMessages().get_NOT_LOGGED_WARN())
        || response_mpm.equals(components.getErrorMessages().get_MPM_CONNECTION_WARN())) {
      if (response_mpm.equals(components.getErrorMessages().get_NOT_LOGGED_WARN())) {
        btnExecute.setText(SUBSCRIBERActions.SUBSCRIBER_ACTION_RECONNECT);
        btnExecute.setActionCommand(SUBSCRIBERActions.SUBSCRIBER_ACTION_RECONNECT);
      } else if (response_mpm.equals(components.getErrorMessages().get_MPM_CONNECTION_WARN())) {
        btnExecute.setText(SUBSCRIBERActions.SUBSCRIBER_ACTION_HOME);
        btnExecute.setActionCommand(SUBSCRIBERActions.SUBSCRIBER_ACTION_HOME);
      }
    }
  }
 public void updateDataProperty(DataPropertyTreeNode node) {
   dataPropertyNameLabel.setText(node.getName());
   ConvertorType type = new ConvertorType(node.getRanges());
   rangeLabel.setText(type.toString());
   DataPropertyType dataPropertyType = node.getDataPropertyType();
   switch (dataPropertyType) {
     case LEAF:
       apply.setText(APPLY_LEAF);
       apply.setEnabled(columnSelected);
       apply.setActionCommand(APPLY_LEAF);
       dataPropertySelected = true;
       break;
     case LOW_DETAIL:
       apply.setText(APPLY_LOW_DETAIL);
       apply.setEnabled(columnSelected);
       apply.setActionCommand(APPLY_LOW_DETAIL);
       dataPropertySelected = true;
       break;
     case PROPERTIES:
       apply.setText(PICK_DATA);
       apply.setEnabled(columnSelected);
       dataPropertySelected = false;
       break;
     default:
       System.err.println("Unexpected enum in updateDataProperty");
   }
 }
Exemplo n.º 26
0
  @Override
  public void actionPerformed(ActionEvent ae) {
    pakkaNappi.setEnabled(true);
    avoPakkaNappi.setEnabled(true);

    for (JButton nappi : vuoro.getPelaaja().getKorttiNapit()) {
      if (nappi.getName() == null) {
        avoPakkaNappi.setText(pokeri.pakanPaallimmainen.toString());

        Kortti kortti = pokeri.koneKaantaaKortin(vuoro.getKasi());

        nappi.setText(kortti.toString());

        KorttienMaalaaja.maalaaNappi(pokeri, kortti, nappi);

        nappi.setName("painettu");
        nappi.doClick();

        break;
      }
    }
    vuoro.seuraava();

    NappiHallinto.piilotaMuidenPelaajienNapit(pokeri, vuoro);

    lopetaPeliLopussa(pokeri, frame, avoPakkaNappi, pakkaNappi);

    KoneToiminta.luoJaPainaaKoneNappia(pokeri, frame, vuoro, avoPakkaNappi, pakkaNappi);

    if (!frame.getTitle().equals("Piilopokeri")) {
      frame.dispose();
    }
  }
Exemplo n.º 27
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();
 }
Exemplo n.º 28
0
  private void initComponents() {
    setTitle("Print Preview");
    sheetBox.setRenderer(
        new DefaultListCellRenderer() {

          @Override
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            if (value != null) {
              setToolTipText(value.toString());
            }
            return this;
          }
        });
    sheetBox.setActionCommand(SHEET_COMMAND);
    sheetBox.addActionListener(this);
    pageBox.addItem("0 of 0");
    pageBox.setActionCommand(PAGE_COMMAND);
    pageBox.addActionListener(this);
    zoomBox.addItem(0.25);
    zoomBox.addItem(0.50);

    zoomBox.addItem(0.75);
    zoomBox.addItem(1.00);
    zoomBox.setSelectedItem(0.75);
    zoomBox.setRenderer(
        new DefaultListCellRenderer() {

          @Override
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            NumberFormat format = NumberFormat.getPercentInstance();
            value = format.format(value);
            return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
          }
        });
    zoomBox.setEditable(true);
    zoomBox.setEditor(new PercentEditor(zoomBox));
    zoomBox.setActionCommand(ZOOM_COMMAND);
    zoomBox.addActionListener(this);
    zoomInButton.setIcon(Icons.ZoomIn16.getImageIcon());
    zoomInButton.setActionCommand(ZOOM_IN_COMMAND);
    zoomInButton.addActionListener(this);
    zoomOutButton.setIcon(Icons.ZoomOut16.getImageIcon());
    zoomOutButton.setActionCommand(ZOOM_OUT_COMMAND);
    zoomOutButton.addActionListener(this);

    printButton.setText("Print");
    printButton.setActionCommand(PRINT_COMMAND);
    printButton.addActionListener(this);

    cancelButton.setText("Cancel");
    cancelButton.setActionCommand(CANCEL_COMMAND);
    cancelButton.addActionListener(this);

    enableEditGroup(false);

    Utility.installEscapeCloseOperation(this);
  }
  public MainInterface() {
    super();
    setBackground(new Color(245, 255, 250));
    setLayout(null);
    setSize(400, 400);
    setBounds(70, 80, 400, 290);
    // setBounds(100, 150, 400, 300);
    setVisible(true);
    setBorder(new LineBorder(Color.GREEN, 3, true));

    registerstudent = new JButton();
    registerstudent.setText("REGISTER    STUDENTS");
    registerstudent.setBounds(80, 30, 230, 25);

    registerstudent.addActionListener(this);
    add(registerstudent);

    viewStudentPlofile = new JButton();
    viewStudentPlofile.setText("VIEW   STUDENTS  PROFILE");
    viewStudentPlofile.setBounds(80, 120, 230, 25);

    viewStudentPlofile.addActionListener(this);
    add(viewStudentPlofile);

    adminstration = new JButton();
    adminstration.setText("FEE  ADMINISTRATION ");
    adminstration.setBounds(80, 200, 230, 25);
    adminstration.addActionListener(this);

    add(adminstration);
  }
Exemplo n.º 30
0
  public void connectToRoom() {
    int chatroom = roomList.getSelectedIndex();
    String roomName = roomList.getSelectedValue();
    try {
      Server.sendLine(outServer, "j");
      Server.sendLine(outServer, chatroom + "");

      String ans = Server.readLine(inServer, "Server/roomconnection");
      roomPort = Integer.parseInt(ans); // error if not the port but "f" for failed, noob

      roomSocket = new Socket(serverC, roomPort);
      inRoom = new BufferedReader(new InputStreamReader(roomSocket.getInputStream()));
      outRoom = new PrintWriter(roomSocket.getOutputStream());

      Server.sendLine(outRoom, tfUsername.getText());

      connectedToRoom = true;
      btnConnect.setText("Leave room");
      lRoomname.setText("Room: " + roomName);
    } catch (Exception e) {
      msgChat(e.getMessage());
      try { // same as the standard disconnect from server
        inServer.close();
        outServer.close();
        serverSocket.close();
        connectedToServer = false;
        btnConnectServer.setText("Connect to server");
        enableButtons(false);
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    }
  }