Beispiel #1
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);
 }
  /**
   * This function takes the given customer or waiter object and changes the information panel to
   * hold that person's info.
   *
   * @param person customer or waiter object
   */
  public void updateInfoPanel(Object person) {
    stateCB.setVisible(true);
    changeOrder.setVisible(false);
    currentPerson = person;

    if (person instanceof CustomerAgent) {
      CustomerAgent customer = (CustomerAgent) person;
      stateCB.setText("Hungry?");
      changeOrder.setVisible(true);
      // changeOrder.setText("Change Order?");
      // changeOrder.setSelected(customer.waiter.requestingChange(customer));
      // changeOrder.setEnabled(!customer.waiter.requestingChange(customer));
      stateCB.setSelected(customer.isHungry());
      stateCB.setEnabled(!customer.isHungry());
      infoLabel.setText("<html><pre>     Name: " + customer.getName() + " </pre></html>");

    } else if (person instanceof WaiterAgent) {
      WaiterAgent waiter = (WaiterAgent) person;
      // stateCB.setText("On Break?");
      // stateCB.setSelected(waiter.isOnBreak());
      // stateCB.setEnabled(true);
      requestBreak.setVisible(true);
      stateCB.setVisible(false);
      changeOrder.setVisible(false);
      infoLabel.setText("<html><pre>     Name: " + waiter.getName() + " </html>");
    }

    infoPanel.validate();
  }
 private void sendRequest(BlockPdu pdu) {
   setButton.setEnabled(false);
   getButton.setEnabled(false);
   getNextButton.setEnabled(false);
   lmessage.setText("Sending request ..");
   lmessage.setBackground(Color.white);
   try {
     varbind var = pdu.getResponseVariableBinding();
     AsnObjectId oid = var.getOid();
     AsnObject res = var.getValue();
     if (res != null) {
       toid.setText(oid.toString());
       tvalue.setText(res.toString());
       lmessage.setText("Received aswer ");
       lmessage.setBackground(Color.white);
     } else {
       lmessage.setText("Received no aswer ");
       lmessage.setBackground(Color.red);
     }
   } catch (PduException exc) {
     lmessage.setText("PduException: " + exc.getMessage());
     lmessage.setBackground(Color.red);
     exc.printStackTrace();
   } catch (java.io.IOException exc) {
     lmessage.setText("IOException: " + exc.getMessage());
     lmessage.setBackground(Color.red);
     exc.printStackTrace();
   }
   setButton.setEnabled(true);
   getButton.setEnabled(true);
   getNextButton.setEnabled(true);
 }
Beispiel #4
0
  /**
   * Show the current status of the field.
   *
   * @param step Which iteration step it is.
   * @param field Which field to display
   */
  public void showStatus(int step, Field field) {
    if (!isVisible()) setVisible(true);

    stepLabel.setText(STEP_PREFIX + step);

    stats.reset();
    fieldView.preparePaint();

    for (int row = 0; row < field.getDepth(); row++) {
      for (int col = 0; col < field.getWidth(); col++) {
        Object creature;
        creature = field.getObjectAt(row, col);
        if (creature != null) {
          stats.incrementCount(creature.getClass());
          fieldView.drawMark(col, row, getColor(creature.getClass()));
        } else {
          fieldView.drawMark(col, row, EMPTY_COLOR);
        }
      }
    }
    stats.countFinished();

    population.setText(POPULATION_PREFIX + stats.getPopulationDetails(field));
    fieldView.repaint();
  }
 public void updateHealth() {
   if (GamePanel.healthPlayer > 0)
     lblPlayerHealth.setText(
         "<html><font color='green'>" + GamePanel.healthPlayer + "</font></html>");
   else
     lblPlayerHealth.setText(
         "<html><font color='red'>" + GamePanel.healthPlayer + "</font></html>");
   if (GamePanel.healthMrSawyer > 0)
     lblMrSawyerHealth.setText(
         "<html><font color='green'>" + GamePanel.healthMrSawyer + "</font></html>");
   else
     lblMrSawyerHealth.setText(
         "<html><font color='red'>" + GamePanel.healthMrSawyer + "</font></html>");
   if (GamePanel.healthVikrant > 0)
     lblVikrantHealth.setText(
         "<html><font color='green'>" + GamePanel.healthVikrant + "</font></html>");
   else
     lblVikrantHealth.setText(
         "<html><font color='red'>" + GamePanel.healthVikrant + "</font></html>");
   if (GamePanel.healthVarun > 0)
     lblVarunHealth.setText(
         "<html><font color='green'>" + GamePanel.healthVarun + "</font></html>");
   else
     lblVarunHealth.setText("<html><font color='red'>" + GamePanel.healthVarun + "</font></html>");
   if (GamePanel.healthBrian > 0)
     lblBrianHealth.setText(
         "<html><font color='green'>" + GamePanel.healthBrian + "</font></html>");
   else
     lblBrianHealth.setText("<html><font color='red'>" + GamePanel.healthBrian + "</font></html>");
 }
  void setData(boolean equal, Trace newTrace, Trace oldTrace) {
    boolean equalComments = newTrace.getComment().equals(oldTrace.getComment());
    if (equal) {
      if (equalComments) {
        messageLabel.setText("Passed");
        saveButton.setEnabled(false);
        replaceButton.setEnabled(false);
      } else {
        messageLabel.setText("Passed, but comments differ");
      }
    } else {
      messageLabel.setText("Discrepency found");
    }

    if (equalComments) {
      addText(newTrace.getComment(), "regular", commentPane);
    } else {
      System.out.println("Old Comment: " + oldTrace.getComment());
      System.out.println("New Comment: " + newTrace.getComment());
      Object[] v = stringToArray(oldTrace.getComment());
      Object[] h = stringToArray(newTrace.getComment());
      displayDifferencesToPane(v, h, commentPane);
    }

    if (equal) {
      copyTraceToPane(newTrace);
    } else {
      Object[] v = traceToArray(oldTrace);
      Object[] h = traceToArray(newTrace);
      displayDifferencesToPane(v, h, jTextPane);
    }
  }
Beispiel #7
0
 @Override
 public void update(Observable o, Object arg) {
   if (arg instanceof Player) {
     Player player = (Player) arg;
     int points = player.getPoints();
     System.out.println("Spieler" + player.getNum() + "an der Reihe");
     if (player.getNum() == 1) {
       System.out.println("Spieler1 punkte++");
       points1Num.setText("" + points);
     } else if (player.getNum() == 2) {
       System.out.println("Spieler2 punkte++");
       points2Num.setText("" + points);
     }
   } else {
     GameController controller = (GameController) arg;
     if (controller.getPlayer().getNum() == 1) {
       ImageIcon image = new ImageIcon("../gfx/spieler1_play.png");
       l1.setIcon(image);
       ImageIcon imageOld = new ImageIcon("../gfx/spieler2.png");
       l2.setIcon(imageOld);
       System.out.println("spieler gewechselt");
     } else {
       ImageIcon imageI = new ImageIcon("../gfx/spieler2_play.png");
       l2.setIcon(imageI);
       ImageIcon imageOldI = new ImageIcon("../gfx/spieler1.png");
       l1.setIcon(imageOldI);
     }
   }
 }
Beispiel #8
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.");
   }
 }
 public OpenKeystoreJPanel() {
   super();
   labelKeystoreName = new JLabel();
   labelKeystoreName.setText("Keystore File");
   textKeystoreName = new CFJStringEditor();
   textKeystoreName.setEditable(false);
   textKeystoreName.setEnabled(false);
   textKeystoreName.setMaxLen(4096);
   CFBamClientConfigurationFile configFile = swingSchema.getClientConfigurationFile();
   String keystoreFileName = configFile.getKeyStore();
   textKeystoreName.setText(keystoreFileName);
   labelKeystorePassword = new JLabel();
   labelKeystorePassword.setText("Keystore Password");
   textKeystorePassword = new JPasswordField();
   actionOk = new ActionOk();
   actionCancel = new ActionCancel();
   buttonOk = new JButton(actionOk);
   buttonCancel = new JButton(actionCancel);
   add(labelKeystoreName);
   add(textKeystoreName);
   add(labelKeystorePassword);
   add(textKeystorePassword);
   add(buttonOk);
   add(buttonCancel);
   Dimension sz = new Dimension(800, 480);
   setSize(sz);
   int height = doLayoutRetHeight();
   Dimension newSz = new Dimension(800, height);
   setSize(newSz);
 }
Beispiel #10
0
 public void updateHelper() {
   if (model.GuessORHint == 0) {
     label1.setText("Entered:");
   }
   if (model.GuessORHint == 1) {
     label1.setText("Hints:");
   }
   DefaultListModel<String> listTemp = new DefaultListModel<String>();
   if (model.GuessORHint == 0) {
     for (String str : model.haveEntered) {
       listTemp.addElement(str);
     }
   } else {
     if (model.hintWords != null) {
       for (String MM : model.hintWords) {
         if (MM == null) {
           listTemp.addElement("APPLE");
         } else {
           listTemp.addElement(MM);
         }
       }
     }
   }
   list.setModel(listTemp);
   scroll.setViewportView(list);
 }
  private void createHealthPanel() {

    remove(healthPanel);
    remove(statsPanel);

    lblPlayerHealth.setText(
        "<html><font color='green'>" + GamePanel.healthPlayer + "</font></html>");
    lblMrSawyerHealth.setText(
        "<html><font color='green'>" + GamePanel.healthMrSawyer + "</font></html>");
    lblVikrantHealth.setText(
        "<html><font color='green'>" + GamePanel.healthVikrant + "</font></html>");
    lblVarunHealth.setText("<html><font color='green'>" + GamePanel.healthVarun + "</font></html>");
    lblBrianHealth.setText("<html><font color='green'>" + GamePanel.healthBrian + "</font></html>");

    healthPanel.setLayout(new GridLayout(5, 2));
    healthPanel.setBackground(new Color(0xd2b48c));
    healthPanel.add(lblPlayerName);
    healthPanel.add(lblPlayerHealth);
    healthPanel.add(lblMrSawyerName);
    healthPanel.add(lblMrSawyerHealth);
    healthPanel.add(lblVikrantName);
    healthPanel.add(lblVikrantHealth);
    healthPanel.add(lblVarunName);
    healthPanel.add(lblVarunHealth);
    healthPanel.add(lblBrianName);
    healthPanel.add(lblBrianHealth);

    add(healthPanel, BorderLayout.WEST);

    revalidate();
    repaint();
  }
Beispiel #12
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");
  }
  // Implementation of valueChanged
  public void valueChanged(ListSelectionEvent e) {
    if (e.getSource() == table.getSelectionModel()) {
      ListSelectionModel ls = table.getSelectionModel();

      int index = ls.getMinSelectionIndex();
      long id = (long) table.getValueAt(index, 0);

      updateFeesData(id);
    } else {
      ListSelectionModel ls = feestable.getSelectionModel();

      int index = ls.getMinSelectionIndex();

      float feespayed = (float) feestable.getValueAt(index, 1);
      float totalfees = (float) feestable.getValueAt(index, 2);

      feespayedlabel.setText("Fees Payed: " + feespayed);
      totalfeeslabel.setText("Total Fees: " + totalfees);

      if (totalfees - feespayed > 0) {
        feesduelabel.setText("Fees Due: " + (totalfees - feespayed));
      }

      panel_6.revalidate();
    }
  }
  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);
  }
Beispiel #15
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);
  }
  /**
   * 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));
  }
  // 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);
    }
  }
  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();
  }
 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);
 }
Beispiel #20
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);
 }
    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");
      }
    }
  /**
   * Validates that inputted info is correct, resets password info in database resets textfields to
   * empty string ""
   *
   * @throws SQLException throws exception if connection could not be made
   */
  public void Validator() throws SQLException {
    update.setText("");
    setUser(UsersConnection.getInfo(username.getText(), emailf.getText(), 5));
    boolean validInfo = true;
    String emailinfo = new String(emailf.getText());
    if (emailinfo.equals("")) {
      emailWrong.setText("<html>*You must enter email to<br>update your password<html/>");
      validInfo = false;
    } else if (!emailinfo.equals(u.getEmail())) {
      System.out.println("here!");
      emailWrong.setText("*Wrong email");
      validInfo = false;
    } else emailWrong.setText("");

    String passinfo1 = new String(password1.getPassword());
    if (!passinfo1.equals("") && passinfo1.length() < 4) {
      pass1Wrong.setText("Password must at least 4 charactor");
      validInfo = false;
    } else pass1Wrong.setText("");
    String passinfo2 = new String(password2.getPassword());

    if (passinfo2.equals(passinfo1)) pass2Wrong.setText("");
    else {
      pass2Wrong.setText("*Password does not match");
      validInfo = false;
    }

    if (validInfo) {
      if (!passinfo1.equals("")) u.setPassword(passinfo1);
      init();
      update.setText("Your information is up-dated");
      emailWrong.setText("");
    }
  }
 /** Update the information. */
 private void updateInfo() {
   if (_info == null) return;
   if (_matchList.getModel().getSize() > 0) {
     T item = _matchList.getSelectedValue();
     _infoLabel.setText("Path:   " + _info.value(item));
     _infoLabel.setToolTipText(_info.value(item));
   } else _infoLabel.setText("No file selected");
 }
Beispiel #24
0
 public void ShowChessNumber() // 显示黑子白子数目
     {
   white = 0;
   black = 0;
   Count();
   blackNumberLabel.setText("黑子数:" + black + "		");
   whiteNumberLabel.setText("白子数:" + white + "		");
 }
Beispiel #25
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"));
 }
Beispiel #26
0
 /**
  * Ovedrride the method so we can set the highlight label
  *
  * @param g Highlighted glyph
  */
 public void setHighlight(Glyph g) {
   super.setHighlight(g);
   if ((g == null) || !(g instanceof MetSymbol)) {
     highlightLabel.setText("   ");
     return;
   }
   highlightLabel.setText(" " + ((MetSymbol) g).getLabel());
 }
Beispiel #27
0
  /** PaintComponent to draw everything. */
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    setBackground(Color.WHITE);
    // If using images, use cool dragon background
    if (useImages) g.drawImage(background, 0, 0, 310, 300, null);

    // Use light gray to not overpower the background image
    g.setColor(Color.LIGHT_GRAY);
    for (int y = 1; y < ROWS; ++y)
      g.fillRoundRect(0, cellSize * y - 4, (cellSize * COLS) - 1, 8, 8, 8);
    for (int x = 1; x < COLS; ++x)
      g.fillRoundRect(cellSize * x - 4, 0, 8, (cellSize * ROWS) - 1, 8, 8);

    // Use graphics2d for when not using the images
    Graphics2D g2d = (Graphics2D) g;
    g2d.setStroke(new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    for (int y = 0; y < ROWS; ++y) {
      for (int x = 0; x < COLS; ++x) {
        int x1 = x * cellSize + 16;
        int y1 = y * cellSize + 16;
        if (board[y][x] == Symbol.X) {
          // use image if set to true, otherwise use g2d
          // for thicker, better looking X's and O's
          if (useImages) g.drawImage(imageX, x1, y1, 75, 75, null);
          else {
            g2d.setColor(PURPLE);
            int x2 = (x + 1) * cellSize - 16;
            int y2 = (y + 1) * cellSize - 16;
            g2d.drawLine(x1, y1, x2, y2);
            g2d.drawLine(x2, y1, x1, y2);
          }
        } else if (board[y][x] == Symbol.O) {
          if (useImages) g.drawImage(imageO, x1, y1, 75, 75, null);
          else {
            g2d.setColor(Color.BLUE);
            g2d.drawOval(x1, y1, 70, 70);
          }
        }
      } // end for
    }

    // Set status bar based on gamestate.  If CONTINUE, show whose turn it is
    if (gameStatus == GameStatus.CONTINUE) {
      statusBar.setForeground(Color.BLACK);
      if (currentPlayer == Symbol.X) statusBar.setText("X's Turn");
      else statusBar.setText("O's Turn");
    } else if (gameStatus == GameStatus.DRAW) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("Draw! Click to play again!");
    } else if (gameStatus == GameStatus.X_WIN) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("X has won! Click to play again!");
    } else if (gameStatus == GameStatus.O_WIN) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("O has won! Click to play again!");
    }
  }
 public void modelChanged(Event event, Object value) {
   switch (event) {
     case StrategyUpdate:
       MarketDepth marketDepth = strategy.getMarketBook().getMarketDepth();
       cumBidAskSizesLabel.setText(marketDepth.getSizes());
       bidAskLabel.setText(marketDepth.getTop());
       break;
   }
 }
Beispiel #29
0
 // Game Logic
 public void phase1() {
   System.out.println("Phase 1");
   lblStatus1.setText("S+ Phase");
   lblStatus2.setText("Advancing slow actions...");
   lblStatus3.setText("");
   ListIterator iList = listAT.listIterator();
   while (iList.hasNext()) ((GameAction) iList.next()).tick();
   phase2();
 }
Beispiel #30
0
 // Renders the selected image
 protected void updateLabel(String name) {
   ImageIcon icon = createImageIcon("images/" + name + ".gif");
   picture.setIcon(icon);
   if (icon != null) {
     picture.setText(null);
   } else {
     picture.setText("Image not found");
   }
 }