コード例 #1
0
ファイル: Manager.java プロジェクト: Gruppe48/lo137ao1o3b
  public void registerVehicleCompany() {
    try {
      int ownerID = Integer.parseInt(textOwnerID.getText());

      String regNumber = textVehicleRegNumber.getText();
      String make = textVehicleMake.getText();
      String model = textVehicleModel.getText();
      int regYear = Integer.parseInt(textVehicleRegistrationYear.getText());

      if (!regNumber.equals("") && !make.equals("") && !model.equals("")) {
        Vehicle v = new Vehicle(regNumber, make, model, regYear);
        if (registry.registerVehicle(ownerID, v)) {
          display.setText("Kjøretøy registert!");
        } else {
          display.setText(
              "Kjøretøyet kunne ikke registeres fordi det finnes et kjøretøy med samme regNr");
        }
      } else {
        display.setText("Noen felter er tomme!");
      }

    } catch (NumberFormatException e) {
      display.setText("Noen felter er tomme!");
    }
  }
コード例 #2
0
 /**
  * Show the description for a given project
  *
  * @param projectName The project name
  */
 private void generateGUIDescription(String projectName) {
   File proj =
       new File(
           Configuration.sourceDirPrefix
               + "/"
               + Configuration.projectDirInSourceFolder
               + "/"
               + projectName
               + "/"
               + Configuration.descriptionFileName);
   try {
     if (!proj.exists()) {
       descriptionText.setText("There is no description-file in the currently selected project.");
     } else {
       LineNumberReader r = new LineNumberReader(new FileReader(proj));
       String description = "";
       String tmp = null;
       while ((tmp = r.readLine()) != null) {
         description += tmp + "\n";
       }
       descriptionText.setText(description);
       descriptionText.setCaretPosition(0);
     }
   } catch (FileNotFoundException e) {
     descriptionText.setText("There is no description-file in the currently selected project.");
   } catch (IOException e) {
     Main.minorError(e);
     descriptionText.setText("There is no description-file in the currently selected project.");
   }
 }
コード例 #3
0
  /* Sjekker om scannet kort finnes og om det er gyldig,
  og skriver ut om scanningen var gyldig/ugyldig */
  private void sjekk() {
    vindu.getSelgerMetoder().setAktivTilKontroll();
    try {
      int nr = Integer.parseInt(kortid.getText());
      Boolean ok = aktivkortreg.sjekkGyldig(nr);
      if (ok) {
        info.setText("\n\n                       Gyldig");
        info.setBackground(Color.GREEN);
        if (scan(ok)) aktivkortreg.fjernKlipp(nr);

        kortid.setText("");
        kortid.selectAll();
        resetFocus();
      } else {
        info.setText("\n\n                    Ikke gyldig");
        info.setBackground(Color.RED);
        scan(ok);
        kortid.setText("");
        kortid.selectAll();
        resetFocus();
      }

      aktivkortreg.oppdater();
      vindu.oppdaterInfoPanel();
    } catch (NumberFormatException e) {
      info.setText("\n\n                    Kun tall...");
      kortid.setText("");
      timer.schedule(new Tick(), timersec * 500);
      return;
    }
  }
コード例 #4
0
  private void addItem() {
    if (!searchName.getText().isEmpty() && !item.getText().isEmpty()) {

      try {
        Main.setItem(
            searchName.getText(),
            "http://www.reddit.com/r/hardwareswap/search?q="
                + item.getText()
                + "&sort=new&restrict_sr=on");

        results.setText("Current Items");

        displayInformation();

      } catch (IOException e1) {
        e1.printStackTrace();
      }

      searchName.setText("");
      item.setText("");

    } else {

      results.setText("Please provide all info for Item Name, Keyword, and Website");
    }
  }
コード例 #5
0
  protected void showErrorPage(final ErrorInfo info) {
    storeState();
    hideProgress();
    myRootComponent = null;

    myErrorMessages.removeAll();

    if (info.myShowStack) {
      info.myMessages.add(
          0, new FixableMessageInfo(true, info.myDisplayMessage, "", "", null, null));

      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      info.myThrowable.printStackTrace(new PrintStream(stream));
      myErrorStack.setText(stream.toString());
      myErrorStackLayout.show(myErrorStackPanel, ERROR_STACK_CARD);
    } else {
      myErrorStack.setText(null);
      myErrorStackLayout.show(myErrorStackPanel, ERROR_NO_STACK_CARD);
    }

    for (FixableMessageInfo message : info.myMessages) {
      addErrorMessage(
          message, message.myErrorIcon ? Messages.getErrorIcon() : Messages.getWarningIcon());
    }

    myErrorPanel.revalidate();
    myLayout.show(this, ERROR_CARD);

    DesignerToolWindowManager.getInstance(getProject()).refresh(true);
    repaint();
  }
コード例 #6
0
 public void actionPerformed(ActionEvent ae) {
   String cname = nameF.getText().trim();
   int state = conditions[stateC.getSelectedIndex()];
   try {
     if (isSpecialCase(cname)) {
       handleSpecialCase(cname, state);
     } else {
       JComponent comp = (JComponent) Class.forName(cname).newInstance();
       ComponentUI cui = UIManager.getUI(comp);
       cui.installUI(comp);
       results.setText("Map entries for " + cname + ":\n\n");
       if (inputB.isSelected()) {
         loadInputMap(comp.getInputMap(state), "");
         results.append("\n");
       }
       if (actionB.isSelected()) {
         loadActionMap(comp.getActionMap(), "");
         results.append("\n");
       }
       if (bindingB.isSelected()) {
         loadBindingMap(comp, state);
       }
     }
   } catch (ClassCastException cce) {
     results.setText(cname + " is not a subclass of JComponent.");
   } catch (ClassNotFoundException cnfe) {
     results.setText(cname + " was not found.");
   } catch (InstantiationException ie) {
     results.setText(cname + " could not be instantiated.");
   } catch (Exception e) {
     results.setText("Exception found:\n" + e);
     e.printStackTrace();
   }
 }
コード例 #7
0
ファイル: PlayerPanel.java プロジェクト: rreinke/NewClue
  public PlayerPanel(HumanPlayer player) {
    myCards = new JLabel("My Cards");
    peopleField = new JTextArea();
    roomField = new JTextArea();
    weaponField = new JTextArea();

    // Displaying the players cards to the screen
    ArrayList<Card> humanPlayerCards = new ArrayList<Card>();
    humanPlayerCards = player.getCards();
    // String variables to keep track of more than one type of card
    String roomTxt = "";
    String personTxt = "";
    String weaponTxt = "";

    for (Card c : humanPlayerCards) {
      // Add name to the text if there is already text
      if (c.getCardType() == CardType.PERSON) {
        if (!(personTxt.equals(""))) {
          personTxt = personTxt + "\n" + (c.getName());
        } else {
          personTxt = c.getName();
        }
      } else if (c.getCardType() == CardType.ROOM) {
        if (!(roomTxt.equals(""))) {
          roomTxt = roomTxt + "\n" + (c.getName());
        } else {
          roomTxt = c.getName();
        }
      } else {
        if (!(weaponTxt.equals(""))) {
          weaponTxt = weaponTxt + "\n" + (c.getName());
        } else {
          weaponTxt = c.getName();
        }
      }
    }
    roomField.setText(roomTxt);
    roomField.setEditable(false);
    peopleField.setText(personTxt);
    peopleField.setEditable(false);
    weaponField.setText(weaponTxt);
    weaponField.setEditable(false);

    pPanel = new JPanel();
    rPanel = new JPanel();
    wPanel = new JPanel();

    pPanel.add(peopleField);
    rPanel.add(roomField);
    wPanel.add(weaponField);
    pPanel.setBorder(new TitledBorder(new EtchedBorder(), "People"));
    rPanel.setBorder(new TitledBorder(new EtchedBorder(), "Room"));
    wPanel.setBorder(new TitledBorder(new EtchedBorder(), "Weapon"));

    setLayout(new GridLayout(4, 1));
    add(myCards);
    add(pPanel);
    add(rPanel);
    add(wPanel);
  }
コード例 #8
0
ファイル: ControlPane.java プロジェクト: mypsycho/JDeployer
  public void refreshOutput() {
    Command command = cmdEditor.getModel();

    if (cmdTable.getSelectedRow() == -1) {
      cmdTabs.setSelectedIndex(0);
      cmdTabs.setEnabledAt(1, false);
      cmdTabs.setEnabledAt(2, false);
    } else {
      cmdTabs.setEnabledAt(1, true);
      cmdTabs.setEnabledAt(2, true);
    }

    if (command != null) {
      JTextArea text = stdOutput.isShowing() ? stdOutput : errOutput.isShowing() ? errOutput : null;
      if (text != null) {
        try {
          text.setText(cmdEditor.getProcess().getTraces(command, text == stdOutput));
          return;
        } catch (ConnectException e) {
          setStatus(e);
        }
      }
    }
    // else
    stdOutput.setText("");
    errOutput.setText("");
  }
コード例 #9
0
ファイル: TP3.java プロジェクト: tonyown1/Programmation2
  public void afficherFilmChoisis(String titre) {
    Video film = this.obtenirVideo(titre);
    String catos =
        this.obtenirCategoriesEnString(
            comboCollection.getItemAt(comboCollection.getSelectedIndex()).toString());
    if (mode[0].isSelected()) {
      String filmOuSerie = "SERIE TV";
      String eval = "";
      if (film.getEval() == 1) {
        eval = String.valueOf(film.getEval()) + " etoile";
      } else if (film.getEval() > 1) {
        eval = String.valueOf(film.getEval()) + " etoiles";
      }
      if (film.isFilm()) {
        filmOuSerie = "FILM";
      }
      infos_film[0].setText(titre);
      infos_film[1].setText(String.valueOf(film.getAnnee()));
      infos_film[2].setText(filmOuSerie);
      infos_film[3].setText(eval);
    } else {

      textTitre.setText(film.getTitre());
      textAnnee.setText(String.valueOf(film.getAnnee()));
      comboEval.setSelectedIndex(film.getEval());
      boolean isFilm = film.isFilm();
      if (isFilm) {
        comboType.setSelectedIndex(1);
      } else {
        comboType.setSelectedIndex(2);
      }
    }
    textCommentaires.setText(film.getCommentaires());
    textCategories.setText(catos);
  }
コード例 #10
0
ファイル: View.java プロジェクト: Morzan3/MoneyCalculator
 private void displayExchangedMoneyInformation(ExchangedMoneyDTO informationToDisplay) {
   ammountOfMoneyAfterConversionTextField.setText("");
   DecimalFormat numberFormat = new DecimalFormat("#.00");
   ammountOfMoneyAfterConversionTextField.setText(
       numberFormat.format(informationToDisplay.getAmount())
           + informationToDisplay.getCurrencyCode());
 }
コード例 #11
0
 private void setLandscapeCommon(final List<Pair<String, Float>> landscape) {
   this.landscape = landscape;
   if (!stkLineChartZoom.empty()) {
     pnlLineChart.setViewport(stkLineChartZoom.get(0));
     stkLineChartZoom.clear();
   }
   if (landscape == null) {
     landscapeMin = landscapeMax = null;
   } else {
     float min = Float.POSITIVE_INFINITY;
     float max = Float.NEGATIVE_INFINITY;
     for (final Pair<String, Float> p : landscape) {
       final float fitness = p.getSecond();
       if (Float.isInfinite(fitness)) {
         continue;
       }
       if (fitness < min) {
         min = fitness;
       }
       if (fitness > max) {
         max = fitness;
       }
     }
     landscapeMin = new Float(min - max * 0.05);
     landscapeMax = new Float(max * 1.05);
   }
   if (!stkHistogramZoom.empty()) {
     pnlHistogram.setViewport(stkHistogramZoom.get(0));
     stkHistogramZoom.clear();
   }
   if (useMinMax && (landscapeMin != null) && (landscapeMax != null)) {
     pnlHistogram.setBins(
         binLandscape(((Number) spnBins.getValue()).intValue()),
         landscapeMin.floatValue(),
         landscapeMax.floatValue());
   } else {
     pnlHistogram.setBins(binLandscape(((Number) spnBins.getValue()).intValue()));
   }
   // cboDisplayType.setSelectedIndex(0);
   if (landscape == null) {
     txaRaw.setText("");
   } else {
     final StringBuffer b = new StringBuffer();
     if (rawTextComparator != null) {
       Collections.sort(landscape, rawTextComparator);
     }
     b.append(getXAxisLabel());
     b.append('\t');
     b.append(getYAxisLabel());
     b.append('\n');
     for (final Pair<String, Float> p : landscape) {
       b.append(p.getFirst());
       b.append('\t');
       b.append(Float.toString(p.getSecond()));
       b.append('\n');
     }
     txaRaw.setText(b.toString());
     txaRaw.select(0, 0);
   }
 }
コード例 #12
0
ファイル: ExerciseFailedDialog.java プロジェクト: emarban/JLM
  public ExerciseFailedDialog(ExecutionProgress ep) {
    super(MainFrame.getInstance(), "Exercise failed /o\\", true);

    setLayout(new MigLayout("fill", ""));
    add(new JLabel((Icon) UIManager.getLookAndFeelDefaults().get("OptionPane.errorIcon")));

    JLabel msg;
    JTextArea ta = new JTextArea();
    ta.setEditable(false);
    if (ep.compilationError == null) {
      msg = new JLabel("You didn't manage to reach your objective.");
      ta.setText(ep.details);
    } else {
      msg = new JLabel("Compilation error");
      ta.setText(ep.compilationError);
    }
    ta.setCaretPosition(0);
    add(msg, "wrap");
    add(new JScrollPane(ta), "spanx, grow, growprio 200, wrap");

    JButton close = new JButton("Close");
    close.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });
    add(close, "span, alignx 50%");

    pack();
    setVisible(true);
  }
コード例 #13
0
  public void actionPerformed(ActionEvent e) {
    note.requestFocus();

    String s = e.getActionCommand();
    if (s.equals(com.floreantpos.POSConstants.OK)) {
      // canceled = false;
      // dispose();
    } else if (s.equals(com.floreantpos.POSConstants.CANCEL)) {
      // canceled = true;
      // dispose();
    } else if (s.equals(com.floreantpos.POSConstants.CLEAR)) {
      String str = note.getText();
      if (str.length() > 0) {
        str = str.substring(0, str.length() - 1);
      }
      note.setText(str);
    } else if (s.equals(com.floreantpos.POSConstants.CLEAR_ALL)) {
      note.setText(""); // $NON-NLS-1$
    } else if (s.equals(Messages.getString("NoteView.43"))) { // $NON-NLS-1$
      String str = note.getText();
      if (str == null) {
        str = ""; // $NON-NLS-1$
      }
      note.setText(str + " "); // $NON-NLS-1$
    } else {
      String str = note.getText();
      if (str == null) {
        str = ""; // $NON-NLS-1$
      }
      note.setText(str + s);
    }
  }
コード例 #14
0
ファイル: Manager.java プロジェクト: Gruppe48/lo137ao1o3b
  public void deleteVehicle() {
    String regNr = textVehicleRegNumber.getText();
    int status;

    if (!regNr.equals("")) {
      status = registry.removeVehicle(regNr);

      switch (status) {
        case OwnerList.SUCCESS:
          display.setText("Bilen: " + regNr + " er nå slettet\n");
          break;
        case OwnerList.EMPTY_LIST:
          display.setText("Listen er tom, og det er derfor ingen kjøretøy å slette\n");
          break;
        case OwnerList.UNKNOWN:
          display.setText("Ukjent registreringsnummer: " + regNr + "\n");
          break;
      }

    } else {
      display.setText(
          "Bilen: "
              + regNr
              + " kan ikke slettes."
              + "Enten finnes den ikke, eller så er det noen som eier den");
    }
  }
コード例 #15
0
  @Override
  public void doOutput(String componentName, Vector<Object> arguments) {
    String compName = componentName.toUpperCase();
    Component component;

    if (compName.compareTo(PDAComponents.CLEAR.toString()) == 0) {

      component = components.get(PDAComponents.PROOPINION.toString());
      if (component != null && component instanceof JTextArea) {
        JTextArea ta = (JTextArea) component;
        ta.setText(null);
      }
      component = components.get(PDAComponents.CONOPINION.toString());
      if (component != null && component instanceof JTextArea) {
        JTextArea ta = (JTextArea) component;
        ta.setText(null);
      }
    } else {
      if (!components.containsKey(compName)) {
        System.err.println(
            "component [" + componentName + "] not found."); // FIXME: get a log from somewhere
        return;
      }

      component = components.get(compName);
      if (component instanceof JTextArea) {
        if (arguments.size() > 0) {
          JTextArea ta = (JTextArea) component;
          ta.append((String) arguments.get(0) + "\n");
          ta.repaint();
        }
      }
    }
  }
コード例 #16
0
ファイル: TP3.java プロジェクト: tonyown1/Programmation2
  // Mode modification
  public void modeModification() {
    resetCollection();
    loadCollection();
    resetCategorie();
    loadCategorie();
    comboCollection.setEnabled(true);

    textTitre.setVisible(true);
    textTitre.setEnabled(true);
    textTitre.setEditable(true);

    textAnnee.setVisible(true);
    textAnnee.setEnabled(true);
    textAnnee.setEditable(true);

    comboType.setVisible(true);
    comboType.setEnabled(true);

    comboEval.setVisible(true);
    comboEval.setEnabled(true);

    scrollCom.setEnabled(true);
    scrollCat.setEnabled(true);

    textCommentaires.setEnabled(true);
    textCommentaires.setEditable(true);
    textCommentaires.setBackground(Color.WHITE);
    textCommentaires.setText("");

    textCategories.setEnabled(true);
    textCategories.setEditable(false);
    textCategories.setBackground(GRIS);
    textCategories.setText("");

    for (int i = 0; i < infos_film.length; i++) {
      infos_film[i].setVisible(false);
    }

    for (int k = 0; k < modeButton.length; k++) {
      modeButton[k].setEnabled(false);
      modeButton[k].setVisible(false);
    }

    modeButton[3].setVisible(true); // Boutton Modifier
    modeButton[4].setVisible(true); // Boutton Supprimer
    boolean enabled = true;
    if (listeEstVide()) {
      enabled = false;
    }
    modeButton[3].setEnabled(enabled);
    modeButton[4].setEnabled(enabled);

    optionCategories[0].setEnabled(true); // Boutton ajouter categorie
    optionCategories[1].setEnabled(true);

    // Place the first element of combobox in the grid
    comboCollection.setSelectedIndex(0);
    Video video = this.obtenirVideo(comboCollection.getSelectedItem().toString());
    afficherFilmChoisis(video.getTitre());
  }
コード例 #17
0
ファイル: ModEDMUpdater.java プロジェクト: RoboRave/EDM
  private void downloadFile(String link) throws MalformedURLException, IOException {
    URL url = new URL(link);
    URLConnection conn = url.openConnection();
    InputStream is = conn.getInputStream();

    // this is just a little information showing the download size of the file
    int max = conn.getContentLength();
    console.setText(console.getText() + "\ndownload file... \nupdatesize: " + max + " bytes");

    // this will output the download to the mods folder
    BufferedOutputStream fout = new BufferedOutputStream(new FileOutputStream(new File(ModsLoc)));
    byte[] buffer = new byte[32 * 1024];
    int bytesRead = 0;
    int in = 0;

    while ((bytesRead = is.read(buffer)) != -1) {
      in += bytesRead;
      fout.write(buffer, 0, bytesRead);
    }

    fout.flush();
    fout.close();
    is.close();

    // after its finished we will print to our console
    console.setText(console.getText() + "\ndownload complete");
  }
コード例 #18
0
 void limpiar() {
   if (btnModificar.isVisible() == true) {
     setCodUsu("");
     setCodEsp(0);
     setCodTipo(0);
     setDescripcion("");
     setObservacion("");
     setTiempoEstimado("");
     setTiempoReal("");
     setFecInicio("  -  -    ");
     setFecFinal("  -  -    ");
     setEstado(0);
     txtIncidencia.setText("");
   } else {
     setCodEsp(0);
     setCodTipo(0);
     setDescripcion("");
     setObservacion("");
     setTiempoEstimado("");
     setTiempoReal("");
     setFecInicio("");
     setFecFinal("");
     setEstado(0);
     txtIncidencia.setText("");
   }
 }
コード例 #19
0
 public void dealData(Sphere shape) {
   String userData = shape.getName();
   String[] str = userData.split(",");
   int state = Integer.parseInt(str[3]);
   float x = Float.parseFloat(str[0]);
   float y = Float.parseFloat(str[1]);
   float z = Float.parseFloat(str[2]);
   if (state == 0) {
     data[getXintValue(x)][getYintValue(y)] =
         data[getXintValue(x)][getYintValue(y)] | getZintValue(z);
     shape.setName(str[0] + "," + str[1] + "," + str[2] + "," + 1);
     Appearance appear = new Appearance();
     Material mater = new Material();
     mater.setDiffuseColor(new Color3f(Color.red));
     appear.setMaterial(mater);
     shape.setAppearance(appear);
     jta.setText(getDataString());
   } else {
     data[getXintValue(x)][getYintValue(y)] =
         data[getXintValue(x)][getYintValue(y)] & (~getZintValue(z));
     shape.setName(str[0] + "," + str[1] + "," + str[2] + "," + 0);
     Appearance appear = new Appearance();
     Material mater = new Material();
     mater.setDiffuseColor(new Color3f(Color.black));
     appear.setMaterial(mater);
     shape.setAppearance(appear);
     jta.setText(getDataString());
   }
 }
コード例 #20
0
  private void jouer() {
    int valSaisie = Integer.parseInt(saisieTxt.getText());

    nbrEssai++;
    saisieTxt.setText("");

    score--;

    if (score == 0) {
      // Perdu
      rejouerBtn.setEnabled(true);
      RandomBtn.setEnabled(false);
      saisieTxt.setEnabled(false);
    }

    ScoreLbl.setText(Integer.toString(score));

    if (valRandom == valSaisie) {
      String message = "Gagné avec un score de " + score + " ! GG";
      rejouerBtn.setEnabled(true);
      AffichTxt.setText(message);
    } else if (valRandom > valSaisie) {
      String message = "C'est plus! ";
      fil += valSaisie + " < ";
      AffichTxt.setText(message + "\n" + fil);

    } else if (valRandom < valSaisie) {
      String message = "C'est moins!";
      fil += valSaisie + " > ";
      AffichTxt.setText(message + "\n" + fil);
    }
  }
コード例 #21
0
ファイル: ServerGUI.java プロジェクト: propra13-orga/gruppe23
 // Refreshing the Username TextArea
 public static void refreshUserNames() {
   if (playercounts == 2) {
     if (cReady == false) {
       show_partiesS.setText(
           "User in Lobby: "
               + "\n"
               + user_name
               + "\n"
               + clientuser_name
               + ": "
               + "\n"
               + "   UnReady"
               + "\n");
     }
     if (cReady == true) {
       show_partiesS.setText(
           "User in Lobby: "
               + "\n"
               + user_name
               + "\n"
               + clientuser_name
               + ": "
               + "\n"
               + "   Ready"
               + "\n");
     }
   } else {
     show_partiesS.setText("User in Lobby: " + "\n" + user_name);
   }
 }
コード例 #22
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed

    OpenFastaFile f = new OpenFastaFile("", "");
    try { // f.showSaveDataDialog();
      FilePath = f.showOpenDataDialog();
    } catch (IOException ex) {
      //            Logger.getLogger(Browser.class.getName()).log(Level.SEVERE, null, ex);
    }

    if (FilePath.isEmpty()) {
      return;
    }
    Box vertical = Box.createVerticalBox();
    vertical.setSize(this.scrollPane1.getWidth(), this.scrollPane1.getHeight());
    siRNA s = new siRNA(new File(FilePath));

    siRnaInputArea.setText(s.getGene());

    if (s.isValid()) {
      List list = s.siRNA();
      t1.setText(list.get(0).toString());
      t2.setText(list.get(1).toString());
      s1.setForeground(Color.black);
      s2.setForeground(Color.black);
    }
  } // GEN-LAST:event_jButton1ActionPerformed
コード例 #23
0
  public void limparTela() {

    codigoCatalogoField.setText("");
    tituloField.setText("");
    tituloOriginalField.setText("");
    escritorField.setText("");
    tradutorField.setText("");
    anoPrimEdicaoField.setText("");
    anoLancamentoField.setText("");
    edicaoField.setText("");
    qtdPageField.setText("");
    linguagemField.setText("");
    generoField.setText("");
    categoriaField.setText("");
    formatoField.setText("");
    editoraField.setText("");
    paisLancamentoField.setText("");
    codigoBarraField.setText("");
    codigoCDDField.setText("");
    codigoCDUField.setText("");
    sinopseArea.setText("");
    seriesArea.setText("");
    obsArea.setText("");
    capaField.setText("");
    capaLabel.setIcon(null);

    // limpa tabela book itens
    model.limpar();

    codigoCatalogoField.setEditable(true);
    codigoCatalogoField.requestFocus();
  }
コード例 #24
0
  public void initSiRNA() {

    siRNA s = new siRNA("p53.fasta");
    List list = s.siRNA();
    vertical.setBackground(new java.awt.Color(255, 215, 0));
    vertical.setSize(this.scrollPane1.getWidth(), this.scrollPane1.getHeight());

    s1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    s2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    //
    // Modify the text color
    s1.setForeground(Color.black);
    s2.setForeground(Color.black);
    s1.setFont(new java.awt.Font("Arial Black", 0, 18));
    s2.setFont(new java.awt.Font("Arial Black", 0, 18));
    // Modify the background color
    // s1.setBackground(new Color(255, 192, 16));
    // s2.setBackground(new Color(255, 192, 16));
    //

    t1 = new JTextArea();
    t2 = new JTextArea();
    //        t1.setLineWrap(true);
    //        t2.setLineWrap(true);
    t1.setText(list.get(0).toString());
    t2.setText(list.get(1).toString());

    vertical.add(s1);
    vertical.add(t1);
    vertical.add(s2);
    vertical.add(t2);

    scrollPane1.add(vertical);
  }
コード例 #25
0
ファイル: InfoPanel.java プロジェクト: nerogit/SunrinNyamNyam
 private void readData() {
   String FileName;
   try {
     FileName =
         "BoBnCalData" + "/" + calYear + "_" + (calMonth + 1) + "_" + calDayOfMon + "" + ".txt";
     System.out.println(FileName);
     File f = new File(FileName);
     if (f.exists()) {
       BufferedReader in = new BufferedReader(new FileReader(FileName));
       String memoAreaText = new String();
       do {
         String tempStr = in.readLine();
         if (tempStr == null) break;
         memoAreaText =
             (new StringBuilder(String.valueOf(memoAreaText)))
                 .append(tempStr)
                 .append(System.getProperty("line.separator"))
                 .toString();
       } while (true);
       memoArea.setText(memoAreaText);
       in.close();
     } else {
       memoArea.setText("");
     }
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
コード例 #26
0
  private void jButton2MouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jButton2MouseClicked

    siRnaInputArea.setText("");
    t1.setText("");
    t2.setText("");
  } // GEN-LAST:event_jButton2MouseClicked
コード例 #27
0
ファイル: GUI.java プロジェクト: stopping/335_final_project
  public void update() {
    welcomeLabel.setText("Welcome! You have " + credits + " credits.");

    if (game != null) {
      GameSquare gs = game.getGameSquareAt(leftClickRow, leftClickCol);
      if (game.getWinner() != -1) {
        gamePanel.add(returnToMenuButton);
        if (hasWon) gameInfo.setText("You won!");
        else gameInfo.setText("You lost.");
      } else if (gs.hasOccupant()) {
        Occupant o = gs.getOccupant();
        if (o instanceof Unit) {
          Unit u = (Unit) o;
          gameInfo.setText(u.getInfo());
        } else gameInfo.setText(o.toString());
        itemListModel.removeAllElements();
        if (o instanceof Unit) {
          List<Item> list = ((Unit) o).getItemList();
          for (Item i : list) {
            itemListModel.addElement(i);
          }
        }
      } else {
        gameInfo.setText("Empty");
      }

      boardPanel.repaint();
    }
  }
コード例 #28
0
ファイル: DBHelper.java プロジェクト: dgiac85/EsercizidiJava
  public static void doConnection(
      String url, String port, String dbname, String u_name, String pwd) {
    String complete_url = "";
    switch (dbtype) {
      case "MySQL":
        complete_url = url_format[0] + url + ":" + port + "/" + dbname;
        break;
      case "Oracle":
        complete_url = url_format[1] + url + ":" + port + ":" + dbname;
      case "DB2":
        complete_url = url_format[2] + url + ":" + port + "/" + dbname;
      case "SQL Server":
        complete_url = url_format[3] + url + ":" + port + ";" + "databaseName=" + dbname;
      default:
        break;
    }

    try {
      conn = DriverManager.getConnection(complete_url, u_name, pwd);

      output.setText("Connessione effettuata con successo!!!");
    } catch (SQLException ex) {
      output.setText(ex.getMessage());
    }
  }
コード例 #29
0
  /*
   * Update radio button names in the same order as the table
   */
  private void updateControlPanel() {
    schedule.removeAll();
    noneButton.setName(""); // Name holds schedule id for the selected radio button
    noneButton.setSelected(true);
    commentTextArea.setText(""); // no text for the noneButton
    enableButtons(false);
    schedule.add(noneButton);
    schGroup.add(noneButton);

    for (int i = trainsScheduleModel.getFixedColumn();
        i < trainsScheduleModel.getColumnCount();
        i++) {
      log.debug("Column name: {}", trainsScheduleTable.getColumnName(i));
      TrainSchedule ts =
          trainScheduleManager.getScheduleByName(trainsScheduleTable.getColumnName(i));
      if (ts != null) {
        JRadioButton b = new JRadioButton();
        b.setText(ts.getName());
        b.setName(ts.getId());
        schedule.add(b);
        schGroup.add(b);
        addRadioButtonAction(b);
        if (b.getName().equals(trainManager.getTrainScheduleActiveId())) {
          b.setSelected(true);
          enableButtons(true);
          // update comment field
          commentTextArea.setText(ts.getComment());
        }
      }
    }
    schedule.revalidate();
  }
コード例 #30
0
  @Override
  public void setDialogConfiguration(Properties configuration) {
    if (mDefaultColumn == -1) {
      int column = mTableModel.findColumn(configuration.getProperty(PROPERTY_COLUMN));
      if (column == -1) mComboBoxColumn.setSelectedItem(configuration.getProperty(PROPERTY_COLUMN));
      else mComboBoxColumn.setSelectedItem(mTableModel.getColumnTitle(column));

      mRadioButtonIsStructure.setSelected(
          "true".equals(configuration.getProperty(PROPERTY_IS_STRUCTURE)));

      int sortMode =
          findListIndex(configuration.getProperty(PROPERTY_SORT_MODE), SORT_MODE_CODE, -1);
      if (sortMode == -1) {
        String itemString = configuration.getProperty(PROPERTY_LIST, "");
        mRadioButton.setSelected(itemString.length() != 0);
        mTextArea.setText(itemString.replace('\t', '\n'));
        if ("true".equals(configuration.getProperty(PROPERTY_IS_STRUCTURE)))
          updateMacroListEditor(true);
      } else {
        mTextArea.setText("");
        mRadioButton.setSelected(true);
        mRadioButtonSort.setSelected(true);
        mComboBoxSortMode.setSelectedIndex(sortMode);
        mComboBoxSortColumn.setSelectedItem(configuration.getProperty(PROPERTY_SORT_COLUMN, ""));
      }
    } else {
      boolean isCustomOrder = (mTableModel.getCategoryCustomOrder(mDefaultColumn) != null);
      mRadioButton.setSelected(isCustomOrder);
      updateList(null, false);
    }

    enableItems();
  }