コード例 #1
0
ファイル: LightInfo.java プロジェクト: RickKohrs/IDV
  public void getPropertyComponents(List comps, final ObjectListener listener) {
    visibleCbx = new JCheckBox(getName(), visible);
    float[] rgb = color.get().getRGBComponents(null);
    slider = new JSlider(0, 100, (int) (rgb[0] * 100));

    float[] xyz = new float[3];
    direction.get(xyz);
    directionXFld = makeField("" + xyz[0], listener, "X Direction");
    directionYFld = makeField("" + xyz[1], listener, "Y Direction");
    directionZFld = makeField("" + xyz[2], listener, "Z Direction");

    double[] pxyz = new double[3];
    location.get(pxyz);
    locationXFld = makeField("" + pxyz[0], listener, "");
    locationYFld = makeField("" + pxyz[1], listener, "");
    locationZFld = makeField("" + pxyz[2], listener, "");

    List fldComps =
        Misc.newList(GuiUtils.rLabel("Direction:"), directionXFld, directionYFld, directionZFld);
    //
    // fldComps.addAll(Misc.newList(GuiUtils.rLabel("Location:"),locationXFld,locationYFld,locationZFld));

    comps.add(visibleCbx);
    GuiUtils.tmpInsets = new Insets(0, 2, 0, 0);
    comps.add(
        GuiUtils.vbox(
            slider, GuiUtils.left(GuiUtils.doLayout(fldComps, 4, GuiUtils.WT_N, GuiUtils.WT_N))));

    if (listener != null) {
      visibleCbx.addActionListener(listener);
      slider.addChangeListener(listener);
    }
  }
コード例 #2
0
ファイル: LightInfo.java プロジェクト: RickKohrs/IDV
 public void setColor(Color3f value, boolean updateGui) {
   setColor(value);
   if (updateGui && slider != null) {
     float[] rgb = getColor().get().getRGBComponents(null);
     int sliderValue = (int) (100 * rgb[0]);
     slider.setValue(sliderValue);
   }
 }
コード例 #3
0
ファイル: LightInfo.java プロジェクト: RickKohrs/IDV
  public void applyProperties() {
    visible = visibleCbx.isSelected();
    float f = (float) (slider.getValue() / 100.0f);
    color = new Color3f(f, f, f);
    location =
        new Point3d(
            new Double(locationXFld.getText()).doubleValue(),
            new Double(locationYFld.getText()).doubleValue(),
            new Double(locationZFld.getText()).doubleValue());

    direction =
        new Vector3f(
            new Float(directionXFld.getText()).floatValue(),
            new Float(directionYFld.getText()).floatValue(),
            new Float(directionZFld.getText()).floatValue());

    updateLight();
  }