Esempio n. 1
1
  /**
   * Sets the mute status icon to the status panel.
   *
   * @param isMute indicates if the call with this peer is muted
   */
  public void setMute(final boolean isMute) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              setMute(isMute);
            }
          });
      return;
    }

    if (isMute) {
      muteStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.MUTE_STATUS_ICON)));
      muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3));
    } else {
      muteStatusLabel.setIcon(null);
      muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    }

    // Update input volume control button state to reflect the current
    // mute status.
    if (localLevel.isSelected() != isMute) localLevel.setSelected(isMute);

    this.revalidate();
    this.repaint();
  }
Esempio n. 2
0
  public MixingColors() {
    super("Selecting a color");
    contents = getContentPane();
    contents.setLayout(new FlowLayout());

    red = new JCheckBox("red");
    green = new JCheckBox("green");
    blue = new JCheckBox("blue");

    label = new JLabel("Watch my background");
    label.setOpaque(true);
    label.setForeground(Color.GRAY);
    label.setBackground(new Color(0, 0, 0));

    contents.add(red);
    contents.add(green);
    contents.add(blue);
    contents.add(label);

    // create CheckBoxHandler event handler
    // and register it on the checkboxes
    CheckBoxHandler cbh = new CheckBoxHandler();
    red.addItemListener(cbh);
    green.addItemListener(cbh);
    blue.addItemListener(cbh);

    setSize(225, 200);
    setVisible(true);
  }
  public static void main(String[] args) {
    final JPopupMenu menu = new JPopupMenu();
    menu.setLayout(new GridLayout(0, 3, 5, 5));

    final MenuedButton button = new MenuedButton("Icons", menu);

    for (int i = 0; i < 9; i++) {
      // replace "print.gif" with your own image
      final JLabel label = new JLabel("" + i); // new ImageIcon("resources/images/print.gif") );
      label.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
              button.getMainButton().setIcon(label.getIcon());
              menu.setVisible(false);
            }
          });
      menu.add(label);
    }

    JFrame frame = new JFrame("Button Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(new JLabel("Click Arrow Button To Show Popup"), BorderLayout.NORTH);
    frame.getContentPane().add(button, BorderLayout.CENTER);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
  public TestSwingExample1() {
    super("ActionExample");

    setChannel(currentChannel); // enable/disable the Actions as appropriate

    channelLabel.setHorizontalAlignment(JLabel.CENTER);
    channelLabel.setFont(new Font("Serif", Font.PLAIN, 32));

    getContentPane().add(channelLabel, BorderLayout.NORTH);

    JPanel buttonPanel = new JPanel(new GridLayout(2, 2, 16, 6));
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(6, 16, 16, 16));
    getContentPane().add(buttonPanel, BorderLayout.CENTER);

    buttonPanel.add(new JButton(upAction));
    buttonPanel.add(new JButton(gotoFavoriteAction));
    buttonPanel.add(new JButton(downAction));
    buttonPanel.add(new JButton(setFavoriteAction));

    JMenuBar mb = new JMenuBar();
    JMenu menu = new JMenu("Channel");
    menu.add(new JMenuItem(upAction));
    menu.add(new JMenuItem(downAction));
    menu.addSeparator();
    menu.add(new JMenuItem(gotoFavoriteAction));
    menu.add(new JMenuItem(setFavoriteAction));
    mb.add(menu);
    setJMenuBar(mb);
  }
    private void updateLabels(JSONObject tags) {
      // Z position label
      String zPosition = "";
      try {
        zPosition = NumberUtils.doubleStringCoreToDisplay(tags.getString("ZPositionUm"));
      } catch (Exception e) {
        try {
          zPosition = NumberUtils.doubleStringCoreToDisplay(tags.getString("Z-um"));
        } catch (Exception e1) {
          // Do nothing...
        }
      }
      zPosLabel_.setText("Z Position: " + zPosition + " um        ");

      // time label
      try {
        int ms = (int) tags.getDouble("ElapsedTime-ms");
        int s = ms / 1000;
        int min = s / 60;
        int h = min / 60;

        String time =
            twoDigitFormat(h)
                + ":"
                + twoDigitFormat(min % 60)
                + ":"
                + twoDigitFormat(s % 60)
                + "."
                + threeDigitFormat(ms % 1000);
        timeStampLabel_.setText("Elapsed time: " + time + "      ");
      } catch (JSONException ex) {
        ReportingUtils.logError("MetaData did not contain ElapsedTime-ms field");
      }
    }
  /*
   * Gets the user choice for font, style and size and redraws the text
   *     accordingly.
   */
  public void setSampleFont() {
    // Get the font name from the JComboBox
    fontName = (String) facenameCombo.getSelectedItem();

    sampleField.setText(textField.getText());

    // Get the font style from the JCheckBoxes
    fontStyle = 0;
    if (italicCheckBox.isSelected()) fontStyle += Font.ITALIC;
    if (boldCheckBox.isSelected()) fontStyle += Font.BOLD;

    // Get the font size
    fontSize = 0;

    fontSize = Integer.parseInt((String) sizeCombo.getSelectedItem());

    // THE FOLLOWING IS NO LONGER NEEDED
    //            if(smallButton.isSelected())
    //                  fontSize=SMALL;
    //            else if(mediumButton.isSelected())
    //                  fontSize=MEDIUM;
    //            else if(largeButton.isSelected())
    //                  fontSize=LARGE;

    // Set the font of the text field
    sampleField.setFont(new Font(fontName, fontStyle, fontSize));
    sampleField.setForeground(fontColor);
    sampleField.repaint();

    pack();
  } // end setSampleFont method
Esempio n. 7
0
 public static void writeTopString(String s) {
   if (s == null) {
     return;
   }
   statusLabel.setForeground(Color.black);
   statusLabel.setText("  " + s);
 }
Esempio n. 8
0
  /**
   * Creates the <tt>Component</tt> hierarchy of the area of status-related information such as
   * <tt>CallPeer</tt> display name, call duration, security status.
   *
   * @return the root of the <tt>Component</tt> hierarchy of the area of status-related information
   *     such as <tt>CallPeer</tt> display name, call duration, security status
   */
  private Component createStatusBar() {
    // stateLabel
    callStatusLabel.setForeground(Color.WHITE);
    dtmfLabel.setForeground(Color.WHITE);
    callStatusLabel.setText(callPeer.getState().getLocalizedStateString());

    PeerStatusPanel statusPanel = new PeerStatusPanel(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.gridx = 0;
    constraints.gridy = 0;
    statusPanel.add(securityStatusLabel, constraints);
    initSecurityStatusLabel();

    constraints.gridx++;
    statusPanel.add(holdStatusLabel, constraints);

    constraints.gridx++;
    statusPanel.add(muteStatusLabel, constraints);

    constraints.gridx++;
    callStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 12));
    statusPanel.add(callStatusLabel, constraints);

    constraints.gridx++;
    constraints.weightx = 1f;
    statusPanel.add(dtmfLabel, constraints);

    return statusPanel;
  }
Esempio n. 9
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();
  }
Esempio n. 10
0
  public ButtonTabComponent(final JTabbedPane pane) {
    // unset default FlowLayout' gaps
    super(new FlowLayout(FlowLayout.LEFT, 0, 0));
    if (pane == null) {
      throw new NullPointerException("TabbedPane is null");
    }
    this.pane = pane;
    setOpaque(false);

    // make JLabel read titles from JTabbedPane
    JLabel label =
        new JLabel() {
          private static final long serialVersionUID = 1L;

          public String getText() {
            int i = pane.indexOfTabComponent(ButtonTabComponent.this);
            if (i != -1) return pane.getTitleAt(i);
            return null;
          }
        };

    add(label);
    // add more space between the label and the button
    label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    // tab button
    JButton button = new TabButton();
    add(button);
    // add more space to the top of the component
    setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
  }
Esempio n. 11
0
  void makeFrame() {
    JPanel p = new JPanel();
    p.setBackground(Color.blue);
    p.setLayout(new BorderLayout(0, 0));
    p.setBorder(new EmptyBorder(0, GAP, GAP, GAP));
    days.setFont(BIG);
    days.setForeground(COLOR);
    p.add(days, "North");
    left.setFont(NORM);
    left.setForeground(COLOR);
    p.add(left, "South");

    JFrame f = new JFrame("Sayaç"); // a window
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    f.setContentPane(p);
    setDate();
    f.pack(); // minimal size
    f.setVisible(true); // show

    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            stop();
          }
        });
  }
Esempio n. 12
0
  public FileNameRenderer(JTable table) {
    Border b = UIManager.getBorder("Table.noFocusBorder");
    if (Objects.isNull(b)) { // Nimbus???
      Insets i = focusCellHighlightBorder.getBorderInsets(textLabel);
      b = BorderFactory.createEmptyBorder(i.top, i.left, i.bottom, i.right);
    }
    noFocusBorder = b;

    p.setOpaque(false);
    panel.setOpaque(false);

    // http://www.icongalore.com/ XP Style Icons - Windows Application Icon, Software XP Icons
    nicon = new ImageIcon(getClass().getResource("wi0063-16.png"));
    sicon =
        new ImageIcon(
            p.createImage(
                new FilteredImageSource(nicon.getImage().getSource(), new SelectedImageFilter())));

    iconLabel = new JLabel(nicon);
    iconLabel.setBorder(BorderFactory.createEmptyBorder());

    p.add(iconLabel, BorderLayout.WEST);
    p.add(textLabel);
    panel.add(p, BorderLayout.WEST);

    Dimension d = iconLabel.getPreferredSize();
    dim.setSize(d);
    table.setRowHeight(d.height);
  }
Esempio n. 13
0
 /** @inheritDoc */
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   Component c =
       candidate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
   if (c instanceof JLabel && table != null) {
     ViperTableModel m = getCurrentModel();
     int modelIndex = table.convertColumnIndexToModel(column);
     AttrConfig ac = m.getAttributeForColumn(modelIndex);
     JLabel l = (JLabel) c;
     if (ac != null) {
       int visibility = mediator.getHiders().getAttrConfigVisibility(ac);
       l.setIcon(outerTablePanel.visibilityIcons[visibility]);
     } else if (m.getInternalColumn(modelIndex) == ViperTableModel.BY_VALID) {
       Config config = m.getConfig();
       int visibility = mediator.getHiders().getConfigVisibility(m.getConfig());
       if (visibility == NodeVisibilityManager.RANGE_LOCKED) {
         visibility = NodeVisibilityManager.LOCKED;
       }
       l.setIcon(outerTablePanel.visibilityIcons[visibility]);
     } else {
       l.setIcon(null);
     }
   }
   return c;
 }
 public int doLayoutRetHeight() {
   Dimension sz = getSize();
   final int itemHeight = 25;
   final int itemSpacing = 5;
   final int labelWidth = 150;
   final int buttonHeight = 35;
   final int buttonWidth = 100;
   int y = itemSpacing;
   int fieldWidth = sz.width - (itemSpacing + labelWidth + itemSpacing + itemSpacing);
   int fieldX = itemSpacing + labelWidth + itemSpacing;
   int buttonSpacing = (sz.width - (buttonWidth + buttonWidth)) / 4;
   labelFileName.setBounds(itemSpacing, y, labelWidth, itemHeight);
   textFileName.setBounds(fieldX, y, fieldWidth, itemHeight);
   y = y + itemHeight + itemSpacing;
   labelLogContents.setBounds(itemSpacing, y, labelWidth, itemHeight);
   int logContentsHeight = sz.height - (y + buttonHeight + itemSpacing + itemSpacing);
   if (logContentsHeight < 100) {
     logContentsHeight = 100;
   }
   textLogContents.setBounds(fieldX, y, fieldWidth, logContentsHeight);
   y = y + logContentsHeight + itemSpacing + itemSpacing;
   buttonChooseFile.setBounds(buttonSpacing, y, buttonWidth, buttonHeight);
   buttonImportFile.setBounds(
       buttonSpacing + buttonWidth + buttonSpacing, y, buttonWidth, buttonHeight);
   buttonClose.setBounds(
       buttonSpacing + buttonWidth + buttonSpacing + buttonWidth + buttonSpacing,
       y,
       buttonWidth,
       buttonHeight);
   y = y + buttonHeight + itemSpacing + itemSpacing;
   return (y);
 }
 public FileImportJPanel() {
   super();
   labelFileName = new JLabel();
   labelFileName.setText("Server URL");
   labelFileName = new JLabel();
   labelFileName.setText("File Name");
   textFileName = new CFJStringEditor();
   textFileName.setMaxLen(4096);
   labelLogContents = new JLabel();
   labelLogContents.setText("Import Log Contents");
   textLogContents = new CFJTextEditor();
   textLogContents.setMaxLen(1000000);
   actionChooseFile = new ActionChooseFile();
   actionImportFile = new ActionImportFile();
   actionClose = new ActionClose();
   buttonChooseFile = new JButton(actionChooseFile);
   buttonImportFile = new JButton(actionImportFile);
   buttonClose = new JButton(actionClose);
   add(labelFileName);
   add(textFileName);
   add(labelLogContents);
   add(textLogContents);
   add(buttonChooseFile);
   add(buttonImportFile);
   add(buttonClose);
   Dimension sz = new Dimension(800, 480);
   setSize(sz);
   int height = doLayoutRetHeight();
   Dimension newSz = new Dimension(800, height);
   setSize(newSz);
 }
  public static void deSelect(JPanel layer) {

    Component[] components = layer.getComponents();
    int i = 0;
    while (i < components.length) {

      if (components[i].getClass().getName().equals("javax.swing.JLabel")) {
        if (components[i].getBackground().equals(SELECT)) {
          JLabel temp = (JLabel) components[i];
          temp.setOpaque(false);
          components[i].setBackground(DESELECT);
        }
      }

      if (components[i].getClass().getName().equals("Display.TextBox")) {
        if (components[i].getBackground().equals(SELECT)) {
          components[i].setBackground(DESELECT);
        }
      }

      // If panel is selected, de-select all components nested on panel
      if (components[i].getClass().getName().equals("javax.swing.JPanel")) {
        if (components[i].getBackground().equals(SELECT)) {
          components[i].setBackground(DESELECT);
        }
        deSelect((JPanel) components[i]);
      }

      i++;
    }
  }
Esempio n. 17
0
 @Override
 public Component getListCellRendererComponent(
     JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) {
   label.setText(Objects.toString(value, ""));
   this.list = list;
   this.index = index;
   if (isSelected) {
     setBackground(list.getSelectionBackground());
     label.setForeground(list.getSelectionForeground());
   } else {
     setBackground(index % 2 == 0 ? EVEN_COLOR : list.getBackground());
     label.setForeground(list.getForeground());
   }
   MutableComboBoxModel m = (MutableComboBoxModel) list.getModel();
   if (index < 0 || m.getSize() - 1 <= 0) {
     setOpaque(false);
     deleteButton.setVisible(false);
     label.setForeground(list.getForeground());
   } else {
     boolean f = index == rolloverIndex;
     setOpaque(true);
     deleteButton.setVisible(true);
     deleteButton.getModel().setRollover(f);
     deleteButton.setForeground(f ? Color.WHITE : list.getForeground());
   }
   return this;
 }
Esempio n. 18
0
  /**
   * Description of the Method
   *
   * @exception Exception Description of Exception
   */
  private void jbInit() throws Exception {

    this.setLayout(null);
    this.setSize(700, 500);
    this.setLocation(0, 0);

    // limites de componentes
    labelFondo.setBounds(new Rectangle((int) (ancho / 3.5), 2 * (alto / 6), ancho / 2, alto / 4));

    botonAceptar.setBounds(
        new Rectangle(
            (int) (2.4 * (ancho / 5)), (int) (1.9 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonAceptar.setBorder(null);

    // imagenes de componentes
    labelFondo.setIcon(new ImageIcon(Imagen));

    botonAceptar.setIcon(new ImageIcon("../imagenes/botonaceptar.jpg"));
    botonAceptar.addMouseListener(new PanelGenerico_botonAceptar_mouseAdapter(this));

    // agregar componentes al panel

    this.add(botonAceptar, null);
    this.add(labelFondo, null);
    this.setBackground(SystemColor.menuText);

    // acciones de botones
    botonAceptar.addActionListener(new PanelGenerico_botonAceptar_actionAdapter(this));
  }
Esempio n. 19
0
  public PlayerPanel(ActionListener listener) {

    Dimension size;
    Insets in = this.getInsets();

    this.numberOfPlayersButtons = new ArrayList<JButton>(this.possiblePlayersAmount);
    this.colorButtons = new LinkedList<JButton>();

    label = new JLabel("Escolha a quantidade de jogadores:");
    this.add(label);

    size = label.getPreferredSize();
    label.setBounds(90, 5 + in.top, size.width, size.height);

    for (int i = 0; i < this.possiblePlayersAmount; i++) {

      JButton tempButton = new JButton(String.format("%d", i + 3));
      numberOfPlayersButtons.add(tempButton);

      size = tempButton.getPreferredSize();
      tempButton.setBounds(45 + 75 * i + in.left, 80 + in.top, size.width, size.height);
      tempButton.addActionListener(listener);

      this.add(tempButton);
    }

    this.setSize(this.getPreferredSize());
    this.setLayout(null);
    this.listener = listener;
  }
  /**
   * Closes dialog box when the OK button is pressed and calls the algorithm.
   *
   * @param event Event that triggers function.
   */
  public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    Object source = event.getSource();

    if (command.equals("OK")) {

      if (setVariables()) {
        callAlgorithm();
      }
    } else if (command.equals("Script")) {
      callAlgorithm();
    } else if (command.equals("Cancel")) {
      dispose();
    } else if (source == blueSmoothBox) {
      if (blueSmoothBox.isSelected()) {
        interpolationLabel.setEnabled(true);
        interpolationText.setEnabled(true);
      } else {
        interpolationLabel.setEnabled(false);
        interpolationText.setEnabled(false);
      }
    } else {
      super.actionPerformed(event);
    }
  }
Esempio n. 21
0
  public void Update(String event) {
    if (event.equals("time")) {
      MODEL.time =
          "<html>Elapsed Time: <font color =\"GREEN\">"
              + MODEL.watch.getElapsedTimeSecs()
              + "</font> Seconds</html>";
      timeLab.setText(MODEL.time);
    } else if (event.equals("invalid")) {
      MODEL.answerInvalid();
      msg.setText(MODEL.msg);
    } else if (event.equals("correct")) {
      MODEL.answerCorrect();

      score.setText(MODEL.str);
      msg.setText(MODEL.msg);
      problem.setText(MODEL.prb);
      entry.setText("");
      entry.requestFocus();
    } else if (event.equals("wrong")) {
      MODEL.answerWrong();
      msg.setText(MODEL.msg);
    } else if (event.equals("replay")) {
      MODEL.gameReplay();

      problem.setText(MODEL.prb);
      score.setText(MODEL.str);
      msg.setText(MODEL.msg);
      timeLab.setText(MODEL.time);
    } else System.out.println("Invalid Update Command");
  }
Esempio n. 22
0
  public IGEgui() {
    start = new JPanel();
    randomizer = new JPanel();

    randomButton = new JButton("Randomize");
    locationButton = new JButton("Randomize");
    locationField = new JTextField(10);
    welcomeL = new JLabel();
    instructL = new JLabel();
    restaurantL = new JLabel();

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setTitle("Random Restaurant Generator");
    setSize(300, 150);

    locationButton.addActionListener(this);
    randomButton.addActionListener(this);

    welcomeL.setText("Welcome to the Random Restaurant Generator!");
    instructL.setText("Please enter your location (Zip code/City, State)");
    restaurantL.setText("");

    start.add(welcomeL);
    start.add(instructL);
    start.add(locationField);
    start.add(locationButton);
    randomizer.add(restaurantL);
    randomizer.add(randomButton);

    setContentPane(start);
  }
  // -------------------------------------------------------------------------------------- //
  // ---------------------------------- Constructor Helpers ------------------------------- //
  // -------------------------------------------------------------------------------------- //
  private void buildActiveKits(JPanel container) {
    // initialize variable
    final int WIDTH = 150;

    // set containment panel properties
    container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
    setComponentSize(container, 150, PAGE_HEIGHT);

    JLabel header = new JLabel("Active Kits");
    header.setHorizontalAlignment(header.CENTER);
    header.setFont(new Font("Serif", Font.BOLD, 18));
    setComponentSize(header, WIDTH, 25);

    // create list model and list
    listModel = new DefaultListModel();
    kitList = new JList(listModel);
    kitList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    kitList.addListSelectionListener(this);
    kitList.setFixedCellHeight(25);
    JScrollPane listScrollPane = new JScrollPane(kitList);

    // add elements to containment panel
    container.add(header);
    container.add(listScrollPane);
  }
Esempio n. 24
0
  private MainPanel() {
    super(new GridLayout(3, 1, 5, 5));
    final JTree tree = new JTree();
    final JCheckBox c = new JCheckBox("CheckBox", true);
    c.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            tree.setEnabled(c.isSelected());
          }
        });
    c.setFocusPainted(false);
    JScrollPane l1 = new JScrollPane(tree);
    l1.setBorder(new ComponentTitledBorder(c, l1, BorderFactory.createEtchedBorder()));

    JLabel icon = new JLabel(new ImageIcon(getClass().getResource("16x16.png")));
    JLabel l2 = new JLabel("<html>aaaaaaaaaaaaaaaa<br>bbbbbbbbbbbbbbbbb");
    l2.setBorder(new ComponentTitledBorder(icon, l2, BorderFactory.createEtchedBorder()));

    JButton b = new JButton("Button");
    b.setFocusPainted(false);
    JLabel l3 = new JLabel("ccccccccccccccc");
    l3.setBorder(new ComponentTitledBorder(b, l3, BorderFactory.createEtchedBorder()));

    add(l1);
    add(l2);
    add(l3);
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setPreferredSize(new Dimension(320, 240));
  }
Esempio n. 25
0
 public void evaluate() {
   try {
     // clear problems and console messages
     problemsView.setText("");
     consoleView.setText("");
     // update status view
     statusView.setText(" Parsing ...");
     tabbedPane.setSelectedIndex(0);
     LispExpr root = Parser.parse(textView.getText());
     statusView.setText(" Running ...");
     tabbedPane.setSelectedIndex(1);
     // update run button
     runButton.setIcon(stopImage);
     runButton.setActionCommand("Stop");
     // start run thread
     runThread = new RunThread(root);
     runThread.start();
   } catch (SyntaxError e) {
     tabbedPane.setSelectedIndex(0);
     System.err.println(
         "Syntax Error at " + e.getLine() + ", " + e.getColumn() + " : " + e.getMessage());
   } catch (Error e) {
     // parsing error
     System.err.println(e.getMessage());
     statusView.setText(" Errors.");
   }
 }
  /**
   * Method to display pixel information for the passed x and y
   *
   * @param pictureX the x value in the picture
   * @param pictureY the y value in the picture
   */
  private void displayPixelInformation(int pictureX, int pictureY) {
    // check that this x and y are in range
    if (isLocationInPicture(pictureX, pictureY)) {
      // save the current x and y index
      colIndex = pictureX;
      rowIndex = pictureY;

      // get the pixel at the x and y
      Pixel pixel = new Pixel(picture, colIndex, rowIndex);

      // set the values based on the pixel
      colValue.setText(Integer.toString(colIndex + numberBase));
      rowValue.setText(Integer.toString(rowIndex + numberBase));
      rValue.setText("R: " + pixel.getRed());
      gValue.setText("G: " + pixel.getGreen());
      bValue.setText("B: " + pixel.getBlue());
      colorPanel.setBackground(new Color(pixel.getRed(), pixel.getGreen(), pixel.getBlue()));

    } else {
      clearInformation();
    }

    // notify the image display of the current x and y
    imageDisplay.setCurrentX((int) (colIndex * zoomFactor));
    imageDisplay.setCurrentY((int) (rowIndex * zoomFactor));
  }
  /**
   * Closes dialog box when the OK button is pressed, sets variables and calls algorithm.
   *
   * @param event Event that triggers function.
   */
  public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    Object source = event.getSource();

    if (command.equals("OK")) {

      if (setVariables()) {
        callAlgorithm();
      }
    } else if (command.equals("Cancel")) {
      dispose();
    } else if (command.equals("Help")) {
      // MipavUtil.showHelp("");
    } else if (source.equals(doRicianCheckBox)) {
      if (doRicianCheckBox.isSelected()) {
        labelDegree.setEnabled(true);
        textDegree.setEnabled(true);
      } else {
        labelDegree.setEnabled(false);
        textDegree.setEnabled(false);
      }
    } else { // else if (source == thresholdCheckbox)
      super.actionPerformed(event);
    }
  }
Esempio n. 28
0
  ConnectorWindow(Bot client, WindowListener listener) {
    super("Texas Hold'em - connecting to server");
    this.client = client;
    addWindowListener(listener);
    setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 20));
    setLayout(new GridLayout(4, 2));
    imie = new JTextField(20);
    adres = new JTextField("localhost");
    port = new JTextField("65025");
    Limie = new JLabel();
    Ladres = new JLabel();
    Lport = new JLabel();
    wyslij = new JButton("wyslij");
    wyslij.setActionCommand("connect");

    Lport.setText(" port:");
    Ladres.setText(" adres:");
    Limie.setText(" imię:");

    add(Limie);
    add(imie);
    add(Ladres);
    add(adres);
    add(Lport);
    add(port);
    add(wyslij);

    wyslij.addActionListener(client.listener);
    pack();
    setLocationRelativeTo(null);
    setVisible(true);
  }
 private RecentProjectItemRenderer() {
   super(new VerticalFlowLayout());
   setFocusable(true);
   myPath.setFont(myPath.getFont().deriveFont((float) 10));
   add(myName);
   add(myPath);
 }
  // Fees update method
  private void updateFeesData(long id) {
    String columns[] = {"Course", "Fees Payed", "Total fees", "Installments"};
    try {
      Database db = new Database();

      panel_7.removeAll();

      feestablemodel = new MyTableModel(db.getFeeData(id), columns);

      feestable = new JTable(feestablemodel);
      feestable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
      feestable.getSelectionModel().addListSelectionListener(this);

      feesscrollpane = new JScrollPane(feestable);
      panel_7.add(feesscrollpane);

      // change fees payed label
      feespayedlabel.setText("Fees Payed");
      feesduelabel.setText("Fees Due");
      totalfeeslabel.setText("Total Fees");

      panel_7.revalidate();
    } catch (Exception e) {
      JOptionPane.showMessageDialog(this, e.getMessage(), null, JOptionPane.ERROR_MESSAGE);
    }
  }