Ejemplo n.º 1
0
  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);
    }
  }
Ejemplo n.º 2
0
  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();
  }
Ejemplo n.º 3
0
 public void setVisible(boolean value, boolean updateGui) {
   setVisible(value);
   if (updateGui && visibleCbx != null) {
     visibleCbx.setSelected(visible);
   }
 }