Ejemplo n.º 1
0
  /**
   * Creates a new connection to the specified host of specified type. <br>
   * <br>
   * type: Type of connection to create <br>
   * destination: Host to connect to (in "host:port" or "host" syntax)
   */
  public Connection(java.net.InetAddress host, int port, PluginContext ctx)
      throws MessagingNetworkException, java.io.IOException {
    if (TRAKTOR_USED) {
      if (traktorConnectionDown) throw new IOException("network is down");

      traktor = new Frame("" + host + ":" + port + " - Traktor");
      final Checkbox c = new Checkbox("break this & ALL future connections");
      c.setState(traktorConnectionDown);
      c.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              traktorConnectionDown = c.getState();
              try {
                if (traktorConnectionDown) closeSocket();
              } catch (Exception ex) {
              }
            }
          });
      traktor.add(c);
      traktor.setSize(100, 50);
      traktor.setLocation(230, 450);
      traktor.setVisible(true);
    } else {
      traktor = null;
    }
  }
Ejemplo n.º 2
0
 /**
  * Adds a radio button group.
  *
  * @param label group label (or null)
  * @param items radio button labels
  * @param rows number of rows
  * @param columns number of columns
  * @param defaultItem button initially selected
  */
 public void addRadioButtonGroup(
     String label, String[] items, int rows, int columns, String defaultItem) {
   Panel panel = new Panel();
   int n = items.length;
   panel.setLayout(new GridLayout(rows, columns, 0, 0));
   CheckboxGroup cg = new CheckboxGroup();
   for (int i = 0; i < n; i++) {
     Checkbox cb = new Checkbox(items[i], cg, items[i].equals(defaultItem));
     cb.addItemListener(this);
     panel.add(cb);
   }
   if (radioButtonGroups == null) radioButtonGroups = new Vector();
   radioButtonGroups.addElement(cg);
   Insets insets = getInsets(5, 10, 0, 0);
   if (label == null || label.equals("")) {
     label = "rbg" + radioButtonGroups.size();
     insets.top += 5;
   } else {
     setInsets(10, insets.left, 0);
     addMessage(label);
     insets.top = 2;
     insets.left += 10;
   }
   c.gridx = 0;
   c.gridy = y;
   c.gridwidth = 2;
   c.anchor = GridBagConstraints.WEST;
   c.insets = new Insets(insets.top, insets.left, 0, 0);
   grid.setConstraints(panel, c);
   add(panel);
   if (Recorder.record || macro) saveLabel(cg, label);
   y++;
 }
Ejemplo n.º 3
0
  /*.................................................................................................................*/
  public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equalsIgnoreCase("setToDefaults")) {
      setDefaultTNTCommandsSearchOptions();
      searchField.setText(searchArguments);
      bootstrapSearchField.setText(bootstrapSearchArguments);
      harvestOnlyStrictConsensusBox.setState(harvestOnlyStrictConsensus);
      resamplingAllConsensusTreesBox.setState(!resamplingAllConsensusTrees);
      bootStrapRepsField.setValue(bootstrapreps);

    } else if (e.getActionCommand().equalsIgnoreCase("setToDefaultsOtherOptions")) {
      setDefaultTNTCommandsOtherOptions();
      otherOptionsField.setText(otherOptions);
      convertGapsBox.setState(convertGapsToMissing);
    } else if (e.getActionCommand().equalsIgnoreCase("browseSearchScript")
        && searchScriptPathField != null) {
      MesquiteString directoryName = new MesquiteString();
      MesquiteString fileName = new MesquiteString();
      String path =
          MesquiteFile.openFileDialog("Choose Search Script File", directoryName, fileName);
      if (StringUtil.notEmpty(path)) searchScriptPathField.setText(path);
    } else if (e.getActionCommand().equalsIgnoreCase("browseBootSearchScript")
        && bootSearchScriptPathField != null) {

      MesquiteString directoryName = new MesquiteString();
      MesquiteString fileName = new MesquiteString();
      String path =
          MesquiteFile.openFileDialog(
              "Choose Resampling Search Script File", directoryName, fileName);
      if (StringUtil.notEmpty(path)) bootSearchScriptPathField.setText(path);
    }
  }
Ejemplo n.º 4
0
  public void launch() {
    setLocation(350, 200);
    setLayout(new GridLayout(5, 1));

    ItemMonitor im = new ItemMonitor();
    // checkbox
    checkbox.setLabel("test");
    checkbox.addItemListener(im);
    add(checkbox);

    for (int i = 0; i < 3; i++) {
      cb[i] = new Checkbox("item " + i);
      cb[i].addItemListener(im);
      add(cb[i]);

      if (checkbox.getState() == true) {
        cb[i].setEnabled(true);
      } else {
        cb[i].setEnabled(false);
      }

      if (i == 2) {
        cb[i].setState(true);
      }
    }

    // label
    lb = new Label();
    add(lb);

    pack();
    setVisible(true);
  }
Ejemplo n.º 5
0
  public void mouseReleased(MouseEvent evt) {
    Graphics g = canvas.getGraphics();
    g.setColor(color);
    g.setPaintMode();
    end = evt.getPoint();

    if (type == 0) {
      g.drawRect(start.x, start.y, end.x - start.x, end.y - start.y);

      if (filled.getState() == true) g.fillRect(start.x, start.y, end.x - start.x, end.y - start.y);

      status.setText("2. Ecke des Rechtecks festgelegt");
    } else if (type == 1) {
      int radius;

      radius = (int) Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2));

      g.drawOval(start.x - radius, start.y - radius, 2 * radius, 2 * radius);

      if (filled.getState() == true)
        g.fillOval(start.x - radius, start.y - radius, 2 * radius, 2 * radius);

      status.setText("Radius des Kreises festgelegt");
    } else if (type == 2) {
      g.drawOval(start.x, start.y, end.x - start.x, end.y - start.y);

      if (filled.getState() == true) g.fillOval(start.x, start.y, end.x - start.x, end.y - start.y);

      status.setText("Radius der Ellipse festgelegt");
    }
  }
Ejemplo n.º 6
0
 /**
  * Adds a group of checkboxs using a grid layout.
  *
  * @param rows the number of rows
  * @param columns the number of columns
  * @param labels the labels
  * @param defaultValues the initial states
  * @param headings the column headings Example:
  *     http://imagej.nih.gov/ij/plugins/multi-column-dialog/index.html
  */
 public void addCheckboxGroup(
     int rows, int columns, String[] labels, boolean[] defaultValues, String[] headings) {
   Panel panel = new Panel();
   int nRows = headings != null ? rows + 1 : rows;
   panel.setLayout(new GridLayout(nRows, columns, 6, 0));
   int startCBIndex = cbIndex;
   if (checkbox == null) checkbox = new Vector(12);
   if (headings != null) {
     Font font = new Font("SansSerif", Font.BOLD, 12);
     for (int i = 0; i < columns; i++) {
       if (i > headings.length - 1 || headings[i] == null) panel.add(new Label(""));
       else {
         Label label = new Label(headings[i]);
         label.setFont(font);
         panel.add(label);
       }
     }
   }
   int i1 = 0;
   int[] index = new int[labels.length];
   for (int row = 0; row < rows; row++) {
     for (int col = 0; col < columns; col++) {
       int i2 = col * rows + row;
       if (i2 >= labels.length) break;
       index[i1] = i2;
       String label = labels[i1];
       if (label == null || label.length() == 0) {
         Label lbl = new Label("");
         panel.add(lbl);
         i1++;
         continue;
       }
       if (label.indexOf('_') != -1) label = label.replace('_', ' ');
       Checkbox cb = new Checkbox(label);
       checkbox.addElement(cb);
       cb.setState(defaultValues[i1]);
       cb.addItemListener(this);
       if (Recorder.record || macro) saveLabel(cb, labels[i1]);
       if (IJ.isLinux()) {
         Panel panel2 = new Panel();
         panel2.setLayout(new BorderLayout());
         panel2.add("West", cb);
         panel.add(panel2);
       } else panel.add(cb);
       i1++;
     }
   }
   c.gridx = 0;
   c.gridy = y;
   c.gridwidth = 2;
   c.anchor = GridBagConstraints.WEST;
   c.insets = getInsets(10, 0, 0, 0);
   grid.setConstraints(panel, c);
   add(panel);
   y++;
 }
Ejemplo n.º 7
0
  public void itemStateChanged(ItemEvent ie) {

    if (ie.getSource() == c1) {
      String s = c1.getLabel();
      g = s;
    } else {
      String s = c2.getLabel();
      g = s;
    }
  }
Ejemplo n.º 8
0
  public void itemStateChanged(ItemEvent e) {
    Checkbox currentCheckbox = shapeActions.getSelectedCheckbox();
    boolean CheckboxState = currentCheckbox.getState();
    String currentAction = currentCheckbox.getLabel();
    if (CheckboxState) {
      myAction = currentAction;
    } else {
      myAction = "DRAW";
    }

    applet.repaint();
  }
Ejemplo n.º 9
0
 /** Returns the state of the next checkbox. */
 public boolean getNextBoolean() {
   if (checkbox == null) return false;
   Checkbox cb = (Checkbox) (checkbox.elementAt(cbIndex));
   if (recorderOn) recordCheckboxOption(cb);
   boolean state = cb.getState();
   if (macro) {
     String label = (String) labels.get((Object) cb);
     String key = Macro.trimKey(label);
     state = isMatch(macroOptions, key + " ");
   }
   cbIndex++;
   return state;
 }
Ejemplo n.º 10
0
 /** Returns the selected item in the next radio button group. */
 public String getNextRadioButton() {
   if (radioButtonGroups == null) return null;
   CheckboxGroup cg = (CheckboxGroup) (radioButtonGroups.elementAt(radioButtonIndex));
   radioButtonIndex++;
   Checkbox checkbox = cg.getSelectedCheckbox();
   String item = "null";
   if (checkbox != null) item = checkbox.getLabel();
   if (macro) {
     String label = (String) labels.get((Object) cg);
     item = Macro.getValue(macroOptions, label, item);
   }
   if (recorderOn) recordOption(cg, item);
   return item;
 }
Ejemplo n.º 11
0
  private void clickOpciones() {

    JPanel myPanel = new JPanel();
    //		myPanel.setFont(new Font("Serif",Font.PLAIN,20));
    Checkbox cbMovimientosPosibles = new Checkbox("Mostrar movimientos posibles", false);
    cbMovimientosPosibles.setFont(new Font("Serif", Font.PLAIN, 20));
    myPanel.add(cbMovimientosPosibles);

    UIManager.put("OptionPane.buttonFont", new FontUIResource(new Font("Serif", Font.PLAIN, 20)));
    int result =
        JOptionPane.showConfirmDialog(null, myPanel, "Opciones", JOptionPane.OK_CANCEL_OPTION);
    if (result == JOptionPane.OK_OPTION) {
      mostrarPosibles = cbMovimientosPosibles.getState();
    }
  }
  /** When scale is selected, auto refresh objects. */
  private Checkbox getScaleCheckbox() {
    if (scaleCheckbox == null) {
      scaleCheckbox = new Checkbox("Scale Points");
      scaleCheckbox.setSize(40, 20);

      scaleCheckbox.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              updateDisplay(nativeItems);
            }
          });
    }

    return scaleCheckbox;
  }
Ejemplo n.º 13
0
  public void goTo(int where) {
    try {
      if (where < 1) {
        return;
      }
      if (where > db.getRecordCount()) {
        return;
      }
      db.gotoRecord(where);
      crl.setText("Record " + db.getCurrentRecordNumber());
      delCB.setState(db.deleted());

      Field f;
      LogicalField lf;
      Checkbox c;
      TextField t;

      int i;

      for (i = 1; i <= db.getFieldCount(); i++) {
        f = db.getField(i);
        if (f.isMemoField()) {
        } else if (f.getType() == 'L') {
          lf = (LogicalField) f;
          c = (Checkbox) fldObjects.elementAt(i - 1);
          c.setState(lf.getBoolean());
        } else {
          t = (TextField) fldObjects.elementAt(i - 1);
          t.setText(f.get().trim());
        }
      }

      Next.setEnabled(!(db.getCurrentRecordNumber() == db.getRecordCount()));
      nextRecord.setEnabled(!(db.getCurrentRecordNumber() == db.getRecordCount()));

      Prev.setEnabled(!(db.getCurrentRecordNumber() == 1));
      prevRecord.setEnabled(!(db.getCurrentRecordNumber() == 1));

      firstRecord.setEnabled(db.getRecordCount() > 0);
      lastRecord.setEnabled(db.getRecordCount() > 0);

      SBrecpos.setValues(db.getCurrentRecordNumber(), 1, 0, db.getRecordCount());
    } // try
    catch (Exception e1) {
      System.out.println(e1);
      System.exit(2);
    }
  }
Ejemplo n.º 14
0
  public void itemStateChanged(ItemEvent E) {
    // The 'log chat' checkbox
    if (E.getSource() == logChat) {
      server.logChats = logChat.getState();

      // Loop through all of the chat rooms, and set the logging
      // state to be the same as the value of the checkbox
      for (int count = 0; count < server.chatRooms.size(); count++) {
        babylonChatRoom tmp = (babylonChatRoom) server.chatRooms.elementAt(count);
        try {
          tmp.setLogging(server.logChats);
        } catch (IOException e) {
          server.serverOutput(
              server.strings.get(thisClass, "togglelogerror") + " " + tmp.name + "\n");
        }
      }
    }

    // The user list
    if (E.getSource() == userList) {
      // If anything is selected, enable the 'disconnect user'
      // button, otherwise disable it
      synchronized (userList) {
        disconnect.setEnabled(userList.getSelectedItem() != null);
      }
    }
  }
Ejemplo n.º 15
0
 /**
  * Notify any DialogListeners of changes having occurred If a listener returns false, do not call
  * further listeners and disable the OK button and preview Checkbox (if it exists). For
  * PlugInFilters, this ensures that the PlugInFilterRunner, which listens as the last one, is not
  * called if the PlugInFilter has detected invalid parameters. Thus, unnecessary calling the
  * run(ip) method of the PlugInFilter for preview is avoided in that case.
  */
 private void notifyListeners(AWTEvent e) {
   if (dialogListeners == null) return;
   boolean everythingOk = true;
   for (int i = 0; everythingOk && i < dialogListeners.size(); i++)
     try {
       resetCounters();
       if (!((DialogListener) dialogListeners.elementAt(i)).dialogItemChanged(this, e))
         everythingOk = false;
     } // disable further listeners if false (invalid parameters) returned
     catch (Exception err) { // for exceptions, don't cover the input by a window but
       IJ.beep(); // show them at in the "Log"
       IJ.log(
           "ERROR: "
               + err
               + "\nin DialogListener of "
               + dialogListeners.elementAt(i)
               + "\nat "
               + (err.getStackTrace()[0])
               + "\nfrom "
               + (err.getStackTrace()[1])); // requires Java 1.4
     }
   boolean workaroundOSXbug = IJ.isMacOSX() && okay != null && !okay.isEnabled() && everythingOk;
   if (previewCheckbox != null) previewCheckbox.setEnabled(everythingOk);
   if (okay != null) okay.setEnabled(everythingOk);
   if (workaroundOSXbug) repaint(); // OSX 10.4 bug delays update of enabled until the next input
 }
Ejemplo n.º 16
0
  public void itemStateChanged(ItemEvent evt) {
    if (evt.getSource() == farbe) {
      status.setText("Farbe " + farben[farbe.getSelectedIndex()] + " ausgewaehlt");

      switch (farbe.getSelectedIndex()) {
        case 0:
          color = Color.blue;
          break;
        case 1:
          color = Color.yellow;
          break;
        case 2:
          color = Color.green;
          break;
        case 3:
          color = Color.red;
          break;
        case 4:
          color = Color.black;
          break;
        case 5:
          color = Color.white;
      }
    } else if (evt.getSource() == filled) {
      if (filled.getState() == true) status.setText("Ausgefuellt zeichnen");
      else status.setText("Rahmen zeichnen");
    }
  }
Ejemplo n.º 17
0
 private void recordCheckboxOption(Checkbox cb) {
   String label = (String) labels.get((Object) cb);
   if (label != null) {
     if (cb.getState()) // checked
     Recorder.recordOption(label);
     else if (Recorder.getCommandOptions() == null) Recorder.recordOption(" ");
   }
 }
Ejemplo n.º 18
0
 public static void maybeDrawGraph(GrandFinale.Graph nodeGraph, IRobot r) {
   if (!enable.getState()) {
     return;
   }
   if (c++ % 20 == 0) { // Because it's expensive to do this every tick
     drawGraph(nodeGraph, r);
   }
 }
Ejemplo n.º 19
0
  public void init() {
    setBackground(Color.white);
    addKeyListener(this);
    img = createImage(dimX, dimY);
    buf = img.getGraphics();
    all = getGraphics();

    mode = new CheckboxGroup();
    end = new Checkbox("ENDURANCE", mode, false);
    reg = new Checkbox("CLASSIC", mode, true);
    add(end);
    add(reg);
    end.addKeyListener(this);
    reg.addKeyListener(this);

    who = new TextField();
    add(who);
    who.addActionListener(this);
    who.addKeyListener(this);
    who.hide();

    hard = new TextField();
    add(hard);
    hard.addActionListener(this);
    hard.addKeyListener(this);
    hard.hide();

    key[0] = KeyEvent.VK_LEFT;
    key[1] = KeyEvent.VK_UP;
    key[2] = KeyEvent.VK_RIGHT;
    key[3] = KeyEvent.VK_DOWN;

    lev[0] = new Color(0, 0, 75); // dark blue
    lev[1] = Color.red;
    lev[2] = Color.blue;
    lev[3] = Color.magenta;
    lev[4] = Color.yellow;
    lev[5] = new Color(0, 75, 0); // dark green
    lev[6] = Color.orange;
    lev[7] = Color.cyan;
    lev[8] = Color.pink;
    lev[9] = new Color(100, 0, 0); // dark red

    setup();
    highScores();
  }
Ejemplo n.º 20
0
  public QP4_PriceDistance(GasSAXManager _gasSAXReader) {
    que = new Q4_PriceDistance(_gasSAXReader);
    try {
      Label label1 = new Label(new String("4/4 The last, which one is"));
      Label label2 = new Label(new String(" more important?"));
      CheckboxGroup choiceGroup = new CheckboxGroup();
      cBox_Price = new Checkbox(Q4_PriceDistance.PRICE_STR, choiceGroup, true);
      cBox_Price.setForeground(Color.WHITE);
      cBox_Distance = new Checkbox(Q4_PriceDistance.DISTANCE_STR, false);
      cBox_Distance.setForeground(Color.WHITE);
      cBox_Price.addItemListener(this);
      cBox_Distance.addItemListener(this);
      cBox_Distance.setCheckboxGroup(choiceGroup);

      label1.setForeground(Color.WHITE);
      label2.setForeground(Color.WHITE);
      label1.setBounds(new Rectangle(17, 58, 165, 21));
      label2.setBounds(new Rectangle(38, 78, 127, 16));

      this.setLayout(null);

      cBox_Price.setBounds(new Rectangle(38, 101, 118, 22));
      cBox_Distance.setBounds(new Rectangle(38, 126, 119, 22));

      this.add(cBox_Price, null);
      this.add(cBox_Distance, null);
      this.add(label1, null);
      this.add(label2, null);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 21
0
  public void init() {
    Button rectsButton = new Button("rectangles");
    Button roundButton = new Button("round rectangles");
    Button threeDButton = new Button("3D rectangles");
    Checkbox fillCheckbox = new Checkbox("fill");

    add(rectsButton);
    add(roundButton);
    add(threeDButton);
    add(fillCheckbox);

    rectsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            round = false;
            threeD = false;
            repaint();
          }
        });
    roundButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            round = true;
            threeD = false;
            repaint();
          }
        });
    threeDButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            threeD = true;
            round = false;
            repaint();
          }
        });
    fillCheckbox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent event) {
            fill = ((Checkbox) (event.getSource())).getState();
          }
        });
  }
Ejemplo n.º 22
0
 private void loop() {
   while (true) {
     try {
       Thread.sleep(delay);
     } catch (InterruptedException e) {
     }
     if (mode.getState()) {
       lookup();
     }
   }
 }
Ejemplo n.º 23
0
  OSSelect() {
    f = new JFrame("Graphics");
    l = new TextArea();
    cbg = new CheckboxGroup();
    win = new Checkbox("win", cbg, true);
    mac = new Checkbox("mac", cbg, false);
    unix = new Checkbox("unix", cbg, false);

    f.add(win);
    f.add(mac);
    f.add(unix);
    f.add(l);
    win.addItemListener(this);
    mac.addItemListener(this);
    unix.addItemListener(this);

    f.setSize(400, 400);
    f.setVisible(true);
    f.setLayout(new FlowLayout());
  }
Ejemplo n.º 24
0
    // GL
    public synchronized void itemStateChanged(ItemEvent e) {
      if (e.getSource() == hsb) isRGB = false;
      if (e.getSource() == rgb) isRGB = true;

      if (e.getSource() == hsb || e.getSource() == rgb) {
        flag = true;
        originalB.setEnabled(false);
        filteredB.setEnabled(false);

        minHue = minSat = minBri = 0;
        maxHue = maxSat = maxBri = 255;

        bandPassH.setState(true);
        bandPassS.setState(true);
        bandPassB.setState(true);
      }
      reset(imp, ip);
      ip = setup(imp);
      apply(imp, ip);
      updateNames();
      notify();
    }
Ejemplo n.º 25
0
    public void itemStateChanged(ItemEvent e) {
      Checkbox ch = (Checkbox) e.getSource();
      String label = ch.getLabel();

      if (checkbox.getState() == true) {
        for (int i = 0; i < 3; i++) {
          cb[i].setEnabled(true);
        }
      } else if (checkbox.getState() == false) {
        for (int i = 0; i < 3; i++) {
          cb[i].setEnabled(false);
        }
      }

      if (e.getStateChange() == ItemEvent.SELECTED) {
        System.out.println(label + " selected.");
        lb.setText(label + " selected.");
      } else {
        System.out.println(label + " deselected.");
        lb.setText(label + " deselected.");
      }
    }
Ejemplo n.º 26
0
  /** Récupère les preférences manquants et ferme la fenêtre */
  public void fermer() {
    // noms des joueurs
    String nom = txt_joueur0.getText();
    if (nom.compareTo("") == 0) noms[0] = "J1";
    else noms[0] = nom;
    nom = txt_joueur1.getText();
    if (nom.compareTo("") == 0) noms[1] = "J2";
    else noms[1] = nom;

    // nombre de vies
    nb_vies = new Integer(cbg_vies.getSelectedCheckbox().getLabel()).intValue();
    aleatoire = cb_aleatoire.getState();
    setVisible(false);
  } // fermer()
Ejemplo n.º 27
0
  public Canvas(Applet applet) {
    this.applet = applet;

    draw = new Checkbox("DRAW", shapeActions, true);
    add(draw);
    draw.addItemListener(this);

    move = new Checkbox("MOVE", shapeActions, false);
    add(move);
    move.addItemListener(this);

    resize = new Checkbox("RESIZE", shapeActions, false);
    add(resize);
    resize.addItemListener(this);

    remove = new Checkbox("REMOVE", shapeActions, false);
    add(remove);
    remove.addItemListener(this);

    change = new Checkbox("CHANGE COLOR/FILL", shapeActions, false);
    add(change);
    change.addItemListener(this);
  }
Ejemplo n.º 28
0
 public void addRec() {
   try {
     setFields();
     db.write();
     goTo(db.getRecordCount());
     delCB.setState(false);
     trl.setText(" of " + db.getRecordCount());
   } // try
   catch (Exception e1) {
     System.out.println(e1);
     System.exit(1);
   }
   Update.setEnabled(true);
   updateRecord.setEnabled(true);
 }
Ejemplo n.º 29
0
  public void setFields() {
    Field f;
    LogicalField lf;
    Checkbox c;
    TextField t;

    int i;
    try {
      for (i = 1; i <= db.getFieldCount(); i++) {
        f = db.getField(i);
        if (f.isMemoField() || f.isPictureField()) {
        } else if (f.isLogicalField()) {
          lf = (LogicalField) f;
          c = (Checkbox) fldObjects.elementAt(i - 1);
          lf.put(c.getState());
        } else {
          t = (TextField) fldObjects.elementAt(i - 1);
          f.put(t.getText());
        }
      }
    } catch (Exception e1) {
      System.out.println(e1);
    }
  }
Ejemplo n.º 30
-1
  public void clearFields() {
    Field f;

    Checkbox c;
    TextField t;

    int i;

    for (i = 1; i <= db.getFieldCount(); i++) {
      try {
        f = db.getField(i);
        if (f.isMemoField()) {
          f.put("");
        } else if (f.getType() == 'L') {
          c = (Checkbox) fldObjects.elementAt(i - 1);
          c.setState(false);
        } else {
          t = (TextField) fldObjects.elementAt(i - 1);
          t.setText("");
        }
      } catch (Exception e1) {
        System.out.println(e1);
        System.exit(3);
      }
    }
  }