Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8119416

[ColorPicker] setColor setValue don't affect obviously

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7u6
    • Fix Version/s: 7u6
    • Component/s: javafx
    • Environment:

      2.2.0b05

      Description

      Run attached code:


      import com.sun.javafx.scene.control.ColorPicker;
      import javafx.application.Application;
      import javafx.event.Event;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.*;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.VBox;
      import javafx.scene.paint.Color;
      import javafx.stage.Stage;

      public class JavaFXColorPicker extends Application {

          public static void main(String[] args) {
              launch(args);
          }
          ColorPicker testedColorPicker = new ColorPicker();

          @Override
          public void start(Stage stage) throws Exception {
              VBox vb = new VBox();
              vb.getChildren().addAll(testedColorPicker, setValueHbox(), setColorHbox());
              Scene scene = new Scene(vb, 200, 200);
              stage.setScene(scene);
              stage.show();

          }

          private HBox setValueHbox() {
              HBox hb = new HBox();
              Label lb = new Label("Set value");
              final TextField colorTf = TextFieldBuilder.create().prefWidth(100).build();
              Button bt = ButtonBuilder.create().text("Set!").build();
              bt.setOnAction(new EventHandler() {

                  @Override
                  public void handle(Event t) {
                      System.out.println("Color : " + Color.web(colorTf.getText()));
                      testedColorPicker.setValue(Color.web(colorTf.getText()));
                      System.out.println(testedColorPicker.getValue());
                      
                  }
              });
              hb.getChildren().addAll(lb, colorTf, bt);
              return hb;
          }

          private HBox setColorHbox() {
              HBox hb = new HBox();
              Label lb = new Label("Set color");
              final TextField colorTf = TextFieldBuilder.create().prefWidth(100).build();
              Button bt = ButtonBuilder.create().text("Set!").build();
              bt.setOnAction(new EventHandler() {

                  @Override
                  public void handle(Event t) {
                      System.out.println("Color : " + Color.web(colorTf.getText()));
                      testedColorPicker.setColor(Color.web(colorTf.getText()));
                      System.out.println(testedColorPicker.getColor());
                  }
              });
              hb.getChildren().addAll(lb, colorTf, bt);
              return hb;
          }
      }

      If I type "aaaaaa" in any of textFields, I don't see affecting of the setters. (getters work, but control doesn't change image)

        Attachments

          Activity

            People

            • Assignee:
              psomashe Parvathi Somashekar (Inactive)
              Reporter:
              akirov Alexander Kirov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: