/**
   * 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));
  }
        @NotNull
        @Override
        public Component getTreeCellRendererComponent(
            @NotNull JTree tree,
            Object value,
            boolean selected,
            boolean expanded,
            boolean leaf,
            int row,
            boolean hasFocus) {
          if (value instanceof MyTreeNode) {
            MyTreeNode node = (MyTreeNode) value;
            myLabel.setText(getRenamedTitle(node.getKey().field.getName(), node.getText()));
            myLabel.setFont(
                myLabel
                    .getFont()
                    .deriveFont(node.getKey().groupName == null ? Font.BOLD : Font.PLAIN));
            myLabel.setEnabled(node.isEnabled());
          } else {
            myLabel.setText(getRenamedTitle(value.toString(), value.toString()));
            myLabel.setFont(myLabel.getFont().deriveFont(Font.BOLD));
            myLabel.setEnabled(true);
          }

          Color foreground =
              selected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground();
          myLabel.setForeground(foreground);

          return myLabel;
        }
Exemplo n.º 3
0
  /**
   * Examines the supplied experiment to determine the results destination and attempts to load the
   * results.
   *
   * @param exp a value of type 'Experiment'
   */
  protected void setInstancesFromExp(Experiment exp) {

    if ((exp.getResultListener() instanceof CSVResultListener)) {
      File resultFile = ((CSVResultListener) exp.getResultListener()).getOutputFile();
      if ((resultFile == null)) {
        m_FromLab.setText("No result file");
      } else {
        setInstancesFromFile(resultFile);
      }
    } else if (exp.getResultListener() instanceof DatabaseResultListener) {
      String dbaseURL = ((DatabaseResultListener) exp.getResultListener()).getDatabaseURL();
      try {
        if (m_InstanceQuery == null) {
          m_InstanceQuery = new InstanceQuery();
        }
        m_InstanceQuery.setDatabaseURL(dbaseURL);
        m_InstanceQuery.connectToDatabase();
        String tableName = m_InstanceQuery.getResultsTableName(exp.getResultProducer());
        setInstancesFromDatabaseTable(tableName);
      } catch (Exception ex) {
        m_FromLab.setText("Problem reading database");
      }
    } else {
      m_FromLab.setText("Can't get results from experiment");
    }
  }
  private Component panelCentro() {
    JPanel panel = new JPanel(new GridLayout(2, 2, 20, 10));
    JLabel lValor;
    JLabel lValor1;

    JTextField text = new JTextField();
    JPasswordField pass = new JPasswordField();

    panel.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createEtchedBorder(0, Color.RED, Color.red), "Identificacion"));

    lValor = new JLabel();
    lValor.setFont(new Font("Verdana", Font.CENTER_BASELINE, 12));
    lValor.setForeground(Color.black);
    lValor.setHorizontalAlignment(lValor.LEFT);

    lValor1 = new JLabel();
    lValor1.setFont(new Font("Verdana", Font.CENTER_BASELINE, 12));
    lValor1.setForeground(Color.black);
    lValor1.setHorizontalAlignment(lValor.LEFT);

    lValor.setText("Usuario:");
    panel.add(lValor);

    lValor.setText("Contraseña:");
    panel.add(lValor1);

    text = new JTextField();

    pass = new JPasswordField();

    return panel;
  }
Exemplo n.º 5
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.");
   }
 }
Exemplo n.º 6
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");
  }
Exemplo n.º 7
0
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   label.setText("");
   label.setBorder(PropertyEditorTable.BORDER_RENDER);
   label.setForeground(table.getForeground());
   label.setBackground(table.getBackground());
   label.setFont(table.getFont().deriveFont(Font.PLAIN));
   if (isActivated() && (value instanceof SignalData)) {
     SignalData st = (SignalData) value;
     switch (column) {
       case COLUMN_SIGNAL:
         label.setText(st.name);
         label.setForeground(getTypeColor(st.type));
         break;
       case COLUMN_STATE:
         label.setText(st.value.toString());
         if (st.excited) {
           label.setFont(table.getFont().deriveFont(Font.BOLD));
         }
         break;
       default:
         break;
     }
   }
   return label;
 }
Exemplo n.º 8
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);
  }
Exemplo n.º 9
0
  public void gameChanged() {
    removeAll();

    GridBagLayout gridbag = new GridBagLayout();
    setLayout(gridbag);

    GridBagConstraints turnHolderConstraints = new GridBagConstraints();
    turnHolderConstraints.fill = GridBagConstraints.BOTH;

    GridBagConstraints nameAndCountConstraints = new GridBagConstraints();
    nameAndCountConstraints.fill = GridBagConstraints.BOTH;
    nameAndCountConstraints.weightx = 1.0;
    nameAndCountConstraints.insets.left = 10;
    nameAndCountConstraints.gridwidth = GridBagConstraints.REMAINDER;

    Player turnHolder = getGameModel().getTurnHolder();
    for (Player player : Player.values()) {
      JLabel turnHolderLabel = new JLabel();
      turnHolderLabel.setForeground(Color.BLACK);
      if (getGameModel().isDraw()) turnHolderLabel.setText(msgDraw);
      if (getGameModel().isWinner(player)) turnHolderLabel.setText(msgWin);
      if (player.equals(turnHolder)) turnHolderLabel.setIcon(ICON_TURN);
      add(turnHolderLabel, turnHolderConstraints);

      String name = getGameContext().getName(player);
      int count = getGameModel().countPieces(player);
      Color color = Constants.COL_PIECE.get(player);
      JLabel nameAndCountLabel = new JLabel(name + ": " + count);
      nameAndCountLabel.setIcon(new ShapeIcon(CIRCLE, color, null));
      add(nameAndCountLabel, nameAndCountConstraints);
    }

    revalidate();
    repaint();
  }
 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.º 11
0
 private void updateGUILabels() {
   lMonitor.setText(rb.getString("lbl_folder"));
   lClearFolder.setText(rb.getString("lbl_clear_folder"));
   buttonPanel.setBorder(new TitledBorder(new EtchedBorder(), rb.getString("brd_monitor_button")));
   SwingUtilities.updateComponentTreeUI(this);
   this.pack();
 }
 public void updateColumn(String originalName, DataPropertyTreeNode node) {
   // ystem.out.println("**** "+ dataProperty);
   originalNameLabel.setText(originalName);
   newNameLabel.setText(node.getName());
   columnSelected = true;
   apply.setEnabled(dataPropertySelected);
 }
 public void updateColumn(String originalName, String newName, String type) {
   originalNameLabel.setText(originalName);
   newNameLabel.setText(newName);
   columnType.setText(type);
   columnSelected = true;
   apply.setEnabled(dataPropertySelected);
 }
Exemplo n.º 14
0
  public PE1212_UseLabels() {
    setLayout(new FlowLayout());

    ImageIcon usFlag = new ImageIcon("C://Java//site//image//usIcon.gif");

    JLabel jlbl1 = new JLabel(usFlag);
    jlbl1.setText("US");
    jlbl1.setHorizontalTextPosition(JLabel.CENTER);
    jlbl1.setVerticalTextPosition(JLabel.BOTTOM);

    JLabel jlbl2 = new JLabel(usFlag);
    jlbl2.setText("US");
    jlbl2.setHorizontalTextPosition(JLabel.RIGHT);

    JLabel jlbl3 = new JLabel(usFlag);
    jlbl3.setText("US");
    jlbl3.setHorizontalTextPosition(JLabel.LEFT);

    JLabel jlbl4 = new JLabel(usFlag);
    jlbl4.setText("US");
    jlbl4.setHorizontalTextPosition(JLabel.CENTER);
    jlbl4.setVerticalTextPosition(JLabel.TOP);

    add(jlbl1);
    add(jlbl2);
    add(jlbl3);
    add(jlbl4);
  }
Exemplo n.º 15
0
 @Override
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   cellPanel.removeAll();
   TableCellUtilities.setToRowBackground(cellPanel, table, row);
   cellLabel.setForeground(table.getForeground());
   cellLabel.setFont(table.getFont());
   if (row == levels.getSize() - 1) {
     cellLabel.setText(value.toString());
     cellPanel.add(cellLabel);
     cellPanel.add(Box.createHorizontalGlue());
     cellPanel.add(removeLevelButton);
   } else if (row == levels.getSize()) {
     cellLabel.setText("Add Level");
     cellPanel.add(Box.createHorizontalGlue());
     cellPanel.add(cellLabel);
     cellPanel.add(Box.createHorizontalStrut(3));
     addLevelButton.setEnabled(classComboBox.getSelectedItem() != null);
     cellPanel.add(addLevelButton);
   } else {
     cellLabel.setText(value.toString());
     cellPanel.add(cellLabel);
   }
   return cellPanel;
 }
Exemplo n.º 16
0
 /**
  * This method initializes jContentPane
  *
  * @return javax.swing.JPanel
  */
 private JPanel getJContentPane() {
   if (jContentPane == null) {
     formLabel = new JLabel();
     formLabel.setBounds(new Rectangle(25, 140, 120, 15));
     formLabel.setText("Included in form(s): ");
     questionLabel = new JLabel();
     questionLabel.setBounds(new Rectangle(25, 110, 120, 15));
     questionLabel.setText("Question: ");
     typeLabel = new JLabel();
     typeLabel.setBounds(new Rectangle(25, 80, 120, 15));
     typeLabel.setText("Type: ");
     dateLabel = new JLabel();
     dateLabel.setBounds(new Rectangle(25, 50, 120, 15));
     dateLabel.setText("Creation Date: ");
     codeLabel = new JLabel();
     codeLabel.setBounds(new Rectangle(25, 20, 120, 15));
     codeLabel.setText("Code: ");
     jContentPane = new JPanel();
     jContentPane.setLayout(null);
     jContentPane.add(codeLabel, null);
     jContentPane.add(dateLabel, null);
     jContentPane.add(typeLabel, null);
     jContentPane.add(questionLabel, null);
     jContentPane.add(getCodeTextField(), null);
     jContentPane.add(getDateTextField(), null);
     jContentPane.add(getTypeTextField(), null);
     jContentPane.add(getQuestionTextField(), null);
     jContentPane.add(formLabel, null);
     jContentPane.add(getFormTextField(), null);
     jContentPane.add(getViewButton(), null);
     jContentPane.add(getDeleteButton(), null);
   }
   return jContentPane;
 }
 // update content on panel when a new order is added to the system
 public void newOrderAdded() {
   lblOrdersThisWeek.setText(getNoOrdersThisWeek() + "");
   lblTotalOrders.setText(database.getPurchasingTransactions().size() + "");
   lblWeeksCost.setText(String.format("€%.2f", getThisWeeksOrdersCost()));
   lblTotalCost.setText(String.format("€%.2f", getTotalCostOfOrders()));
   refreshCharts();
 }
Exemplo n.º 18
0
 /**
  * This method initializes this
  *
  * @return void
  */
 private void initialize() {
   GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
   gridBagConstraints2.gridx = 2;
   gridBagConstraints2.gridy = 0;
   duration = new JLabel();
   duration.setText("Duration");
   duration.setForeground(Color.WHITE);
   GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
   gridBagConstraints1.fill = GridBagConstraints.BOTH;
   gridBagConstraints1.gridy = 0;
   gridBagConstraints1.weightx = 1.0;
   gridBagConstraints1.gridx = 1;
   GridBagConstraints gridBagConstraints = new GridBagConstraints();
   gridBagConstraints.gridx = 0;
   gridBagConstraints.gridy = 0;
   timeLabel = new JLabel();
   timeLabel.setText("Time");
   timeLabel.setForeground(Color.WHITE);
   this.setSize(300, 200);
   this.setLayout(new GridBagLayout());
   this.setBackground(Color.BLACK);
   this.add(timeLabel, gridBagConstraints);
   this.add(getSlider(), gridBagConstraints1);
   this.add(duration, gridBagConstraints2);
 }
Exemplo n.º 19
0
 /** Refreshes the user interface in response to display changes such as Language. */
 protected void refreshGUI() {
   super.refreshGUI();
   messageLabel.setText(ControlsRes.getString("OSPControl.Messages"));
   clearLabel.setText(ControlsRes.getString("OSPControl.Clear"));
   inputLabel.setText(ControlsRes.getString("OSPControl.Input_Parameters"));
   table.refresh();
 }
 private void updateBuildingQuantities() {
   moatsLabel.setText(getBuildingQuantities(BuildingType.MOAT));
   ballistaTowersLabel.setText(getBuildingQuantities(BuildingType.BALLISTA_TOWER));
   turretsLabel.setText(getBuildingQuantities(BuildingType.TURRET));
   bombardsLabel.setText(getBuildingQuantities(BuildingType.BOMBARD));
   guardHousesLabel.setText(getBuildingQuantities(BuildingType.GUARD_HOUSE));
 }
 protected void update() {
   title.setText(_cgFile.getFileName());
   subTitle.setText(subTitleForFile());
   for (FlexoActionButton button : actionButtons) {
     button.update();
   }
 }
  @Override
  public void reset(@NotNull HttpConfigurable settings) {
    myNoProxyRb.setSelected(true); // default
    myAutoDetectProxyRb.setSelected(settings.USE_PROXY_PAC);
    myPacUrlCheckBox.setSelected(settings.USE_PAC_URL);
    myPacUrlTextField.setText(settings.PAC_URL);
    myUseHTTPProxyRb.setSelected(settings.USE_HTTP_PROXY);
    myProxyAuthCheckBox.setSelected(settings.PROXY_AUTHENTICATION);

    enableProxy(settings.USE_HTTP_PROXY);

    myProxyLoginTextField.setText(settings.getProxyLogin());
    myProxyPasswordTextField.setText(settings.getPlainProxyPassword());

    myProxyPortTextField.setNumber(settings.PROXY_PORT);
    myProxyHostTextField.setText(settings.PROXY_HOST);
    myProxyExceptions.setText(StringUtil.notNullize(settings.PROXY_EXCEPTIONS));

    myRememberProxyPasswordCheckBox.setSelected(settings.KEEP_PROXY_PASSWORD);
    mySocks.setSelected(settings.PROXY_TYPE_IS_SOCKS);
    myHTTP.setSelected(!settings.PROXY_TYPE_IS_SOCKS);

    boolean showError = !StringUtil.isEmptyOrSpaces(settings.LAST_ERROR);
    myErrorLabel.setVisible(showError);
    myErrorLabel.setText(showError ? errorText(settings.LAST_ERROR) : null);

    final String oldStyleText =
        CommonProxy.getMessageFromProps(CommonProxy.getOldStyleProperties());
    myOtherWarning.setVisible(oldStyleText != null);
    if (oldStyleText != null) {
      myOtherWarning.setText(oldStyleText);
      myOtherWarning.setIcon(Messages.getWarningIcon());
    }
  }
    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");
      }
    }
Exemplo n.º 24
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (window.getObjectsName()[10][window.getSelectedLenguage()] == e.getActionCommand()) {
        /* ACCEPTED */
      System.out.println("accepted");
      if (buzon == null) return;
      acceptButton.setEnabled(false);
      denyButton.setEnabled(false);

      inputLabel.setText(defaultMessage);
      buzon.send("ACCEPTED");

      buzon = null;
    }

    if (window.getObjectsName()[11][window.getSelectedLenguage()] == e.getActionCommand()) {
        /* DENIED */
      System.out.println("denied");
      if (buzon == null) return;

      buzon.send("DENIED");

      acceptButton.setEnabled(false);
      denyButton.setEnabled(false);

      inputLabel.setText(defaultMessage);

      buzon = null;
    }
  }
Exemplo n.º 25
0
  public void refresh() {

    int walk = getBattleArmor().getOriginalWalkMP();
    int jump = getBattleArmor().getOriginalJumpMP();
    float maxKilos = getBattleArmor().getTrooperWeight();
    float currentKilos;
    int bv = getBattleArmor().calculateBattleValue();
    int currentCost = (int) Math.round(getBattleArmor().getCost(false));

    testBA = new TestBattleArmor(getBattleArmor(), entityVerifier.baOption, null);
    currentKilos = testBA.calculateWeight(BattleArmor.LOC_SQUAD);
    currentKilos += UnitUtil.getUnallocatedAmmoTonnage(getBattleArmor());

    tons.setText("Suit Weight: " + String.format("%1$.3f", currentKilos) + "/" + maxKilos);
    tons.setToolTipText(
        "This represents the weight of all squad-level "
            + "equipment, it does not count individual equipment");
    if (currentKilos > maxKilos) {
      tons.setForeground(Color.red);
    } else {
      tons.setForeground(Color.black);
    }

    bvLabel.setText("BV: " + bv);
    bvLabel.setToolTipText("BV 2.0");

    move.setText("Movement: " + walk + "/" + jump);
    move.setToolTipText("Walk/Jump MP");

    cost.setText("Squad Cost: " + formatter.format(currentCost) + " C-bills");
  }
Exemplo n.º 26
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.º 27
0
 /**
  * Sets the status label text.
  *
  * @param text the status label text (or null)
  */
 public void setStatus(String text) {
   if (text != null) {
     statusLabel.setText(text);
   } else {
     statusLabel.setText("Ready");
   }
 }
  public void fiscal(String processo) {
    Connection con = new ConexaoStatement().getConnetion();

    String sql =
        "select B.AndamentoFiscal as GERAL,"
            + "A.AndamenoDistribuirFuncionarioInterno as DISTRIBUIR,"
            + "A.AndamentoValidarPerfilFiscal as PERFIL "
            + "from fiscal as A "
            + "inner join cadastrodeprocesso as B "
            + "on A.Numerodoprocesso=B.codNumerodoprocesso "
            + "where A.Numerodoprocesso='"
            + processo
            + "'";
    try {
      PreparedStatement ps = con.prepareStatement(sql);
      ResultSet rs = ps.executeQuery();
      if (rs != null)
        while (rs.next()) {
          lbGeral.setText(rs.getString("GERAL"));
          lbPerfil.setText(rs.getString("PERFIL"));
          lbDistribuir.setText(rs.getString("DISTRIBUIR"));
        }
      colorir(jPDepartamento);
    } catch (SQLException erro) {
      JOptionPane.showMessageDialog(null, "Erro ao listar na tabela " + erro);
    } finally {
      try {
        con.close();
      } catch (Exception e) {
      }
    }
  }
 public static void updateText() {
   if (DatabaseUtil.countItems("USER_NOTES") == 0) {
     textLabel.setText("Create a Note");
   } else {
     textLabel.setText("Select a Note");
   }
 }
Exemplo n.º 30
0
 public void calcul() {
   if (op.equals("+")) {
     nb1 = nb1 + Double.valueOf(lab.getText()).doubleValue();
   }
   if (op.equals("-")) {
     nb1 = nb1 - Double.valueOf(lab.getText()).doubleValue();
   }
   if (op.equals("*")) {
     nb1 = nb1 * Double.valueOf(lab.getText()).doubleValue();
   }
   if (op.equals("%")) {
     nb1 = nb1 % Double.valueOf(lab.getText()).doubleValue();
   }
   if (op.equals("/")) {
     if (Double.valueOf(lab.getText()).doubleValue() == 0) {
       lab.setText("Error: divide by 0");
       return;
     }
     nb1 = nb1 / Double.valueOf(lab.getText()).doubleValue();
   }
   if (op.equals("x²")) nb1 = Math.pow(Double.valueOf(lab.getText()).doubleValue(), 2.0);
   if (op.equals("√")) nb1 = Math.sqrt(Double.valueOf(lab.getText()).doubleValue());
   if (op.equals("log")) nb1 = Math.log(Double.valueOf(lab.getText()).doubleValue());
   if (op.equals("exp")) nb1 = Math.exp(Double.valueOf(lab.getText()).doubleValue());
   if (op.equals("cos")) nb1 = Math.cos(Double.valueOf(lab.getText()).doubleValue());
   if (op.equals("tan")) nb1 = Math.tan(Double.valueOf(lab.getText()).doubleValue());
   if (op.equals("sin")) nb1 = Math.sin(Double.valueOf(lab.getText()).doubleValue());
   int n = do_precision(String.valueOf(nb1));
   lab.setText(String.format("%." + String.valueOf(n) + "f", nb1));
 }