示例#1
0
 protected void processTextEvent(TextEvent e) {
   int id = e.getID();
   switch (id) {
     case TextEvent.TEXT_VALUE_CHANGED:
       ponerColorSiCambio();
       break;
     default:
   }
   super.processTextEvent(e);
 }
示例#2
0
 public void textValueChanged(TextEvent e) {
   notifyListeners(e);
   if (slider == null) return;
   Object source = e.getSource();
   for (int i = 0; i < slider.size(); i++) {
     int index = sliderIndexes[i];
     if (source == numberField.elementAt(index)) {
       TextField tf = (TextField) numberField.elementAt(index);
       double value = Tools.parseDouble(tf.getText());
       if (!Double.isNaN(value)) {
         Scrollbar sb = (Scrollbar) slider.elementAt(i);
         sb.setValue((int) (value * sliderScales[i]));
       }
       // IJ.log(i+" "+tf.getText());
     }
   }
 }
示例#3
0
 public void textValueChanged(TextEvent e) {
   Object source = e.getSource();
   double newXScale = xscale;
   double newYScale = yscale;
   if (source == xField && fieldWithFocus == xField) {
     String newXText = xField.getText();
     newXScale = Tools.parseDouble(newXText, 0);
     if (newXScale == 0) return;
     if (newXScale != xscale) {
       int newWidth = (int) (newXScale * r.width);
       widthField.setText("" + newWidth);
       if (constainAspectRatio) {
         yField.setText(newXText);
         int newHeight = (int) (newXScale * r.height);
         heightField.setText("" + newHeight);
       }
     }
   } else if (source == yField && fieldWithFocus == yField) {
     String newYText = yField.getText();
     newYScale = Tools.parseDouble(newYText, 0);
     if (newYScale == 0) return;
     if (newYScale != yscale) {
       int newHeight = (int) (newYScale * r.height);
       heightField.setText("" + newHeight);
     }
   } else if (source == widthField && fieldWithFocus == widthField) {
     int newWidth = (int) Tools.parseDouble(widthField.getText(), 0.0);
     if (newWidth != 0) {
       int newHeight = (int) (newWidth * (double) r.height / r.width);
       heightField.setText("" + newHeight);
       xField.setText("-");
       yField.setText("-");
       newXScale = 0.0;
       newYScale = 0.0;
     }
   }
   xscale = newXScale;
   yscale = newYScale;
 }
 @Override
 public void textValueChanged(TextEvent e) {
   TextComponent tc = (TextComponent) e.getSource();
   tc.setBackground(Color.red);
 }
示例#5
0
 public void textValueChanged(TextEvent e) {
   Object source = e.getSource();
   double newXScale = xscale;
   double newYScale = yscale;
   double newZScale = zscale;
   if (source == xField && fieldWithFocus == xField) {
     String newXText = xField.getText();
     newXScale = Tools.parseDouble(newXText, 0);
     if (newXScale == 0) return;
     if (newXScale != xscale) {
       int newWidth = (int) (newXScale * r.width);
       widthField.setText("" + newWidth);
       if (constainAspectRatio) {
         yField.setText(newXText);
         int newHeight = (int) (newXScale * r.height);
         heightField.setText("" + newHeight);
       }
     }
   } else if (source == yField && fieldWithFocus == yField) {
     String newYText = yField.getText();
     newYScale = Tools.parseDouble(newYText, 0);
     if (newYScale == 0) return;
     if (newYScale != yscale) {
       int newHeight = (int) (newYScale * r.height);
       heightField.setText("" + newHeight);
     }
   } else if (source == zField && fieldWithFocus == zField) {
     String newZText = zField.getText();
     newZScale = Tools.parseDouble(newZText, 0);
     if (newZScale == 0) return;
     if (newZScale != zscale) {
       int nSlices = imp.getStackSize();
       if (imp.isHyperStack()) {
         int slices = imp.getNSlices();
         int frames = imp.getNFrames();
         if (slices == 1 && frames > 1) nSlices = frames;
         else nSlices = slices;
       }
       int newDepth = (int) (newZScale * nSlices);
       depthField.setText("" + newDepth);
     }
   } else if (source == widthField && fieldWithFocus == widthField) {
     int newWidth = (int) Tools.parseDouble(widthField.getText(), 0.0);
     if (newWidth != 0) {
       int newHeight = (int) (newWidth * (double) r.height / r.width);
       heightField.setText("" + newHeight);
       xField.setText("-");
       yField.setText("-");
       newXScale = 0.0;
       newYScale = 0.0;
     }
   } else if (source == depthField && fieldWithFocus == depthField) {
     int newDepth = (int) Tools.parseDouble(depthField.getText(), 0.0);
     if (newDepth != 0) {
       zField.setText("-");
       newZScale = 0.0;
     }
   }
   xscale = newXScale;
   yscale = newYScale;
   zscale = newZScale;
 }