Example usage for javafx.scene.paint Color LIGHTGREEN

List of usage examples for javafx.scene.paint Color LIGHTGREEN

Introduction

In this page you can find the example usage for javafx.scene.paint Color LIGHTGREEN.

Prototype

Color LIGHTGREEN

To view the source code for javafx.scene.paint Color LIGHTGREEN.

Click Source Link

Document

The color light green with an RGB value of #90EE90

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Toggle Button Sample");
    stage.setWidth(250);//  w  w  w.  j  a v  a  2s. com
    stage.setHeight(180);

    final ToggleGroup group = new ToggleGroup();

    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) {
            System.out.println((Color) group.getSelectedToggle().getUserData());
        }
    });

    ToggleButton tb1 = new ToggleButton("A");
    tb1.setToggleGroup(group);
    tb1.setUserData(Color.LIGHTGREEN);
    tb1.setSelected(true);

    ToggleButton tb2 = new ToggleButton("B");
    tb2.setToggleGroup(group);
    tb2.setUserData(Color.LIGHTBLUE);
    ToggleButton tb3 = new ToggleButton("C");
    tb3.setToggleGroup(group);
    tb3.setUserData(Color.SALMON);

    HBox hbox = new HBox();

    hbox.getChildren().add(tb1);
    hbox.getChildren().add(tb2);
    hbox.getChildren().add(tb3);

    ((Group) scene.getRoot()).getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Toggle Button Sample");
    stage.setWidth(250);/* w ww .j  ava2s. c om*/
    stage.setHeight(180);

    final ToggleGroup group = new ToggleGroup();

    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) {
            System.out.println((Color) group.getSelectedToggle().getUserData());
        }
    });

    ToggleButton tb1 = new ToggleButton();
    tb1.setText("A");
    tb1.setToggleGroup(group);
    tb1.setUserData(Color.LIGHTGREEN);
    tb1.setSelected(true);

    ToggleButton tb2 = new ToggleButton("B");
    tb2.setToggleGroup(group);
    tb2.setUserData(Color.LIGHTBLUE);
    ToggleButton tb3 = new ToggleButton("C");
    tb3.setToggleGroup(group);
    tb3.setUserData(Color.SALMON);

    HBox hbox = new HBox();

    hbox.getChildren().add(tb1);
    hbox.getChildren().add(tb2);
    hbox.getChildren().add(tb3);

    ((Group) scene.getRoot()).getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Toggle Button Sample");
    stage.setWidth(250);//from w  w  w .  ja  v  a 2s  . c o m
    stage.setHeight(180);

    final ToggleGroup group = new ToggleGroup();

    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) {
            System.out.println((Color) group.getSelectedToggle().getUserData());
        }
    });
    Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    ToggleButton tb1 = new ToggleButton("A", rootIcon);

    tb1.setToggleGroup(group);
    tb1.setUserData(Color.LIGHTGREEN);
    tb1.setSelected(true);

    ToggleButton tb2 = new ToggleButton("B");
    tb2.setToggleGroup(group);
    tb2.setUserData(Color.LIGHTBLUE);
    ToggleButton tb3 = new ToggleButton("C");
    tb3.setToggleGroup(group);
    tb3.setUserData(Color.SALMON);

    HBox hbox = new HBox();

    hbox.getChildren().add(tb1);
    hbox.getChildren().add(tb2);
    hbox.getChildren().add(tb3);

    ((Group) scene.getRoot()).getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Toggle Button Sample");
    stage.setWidth(250);//from ww  w  . ja  v  a2 s.  c o  m
    stage.setHeight(180);

    final ToggleGroup group = new ToggleGroup();

    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) {
            System.out.println((Color) group.getSelectedToggle().getUserData());
        }
    });
    Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    ToggleButton tb1 = new ToggleButton("A", rootIcon);
    tb1.setSelected(true);

    tb1.setToggleGroup(group);
    tb1.setUserData(Color.LIGHTGREEN);
    tb1.setSelected(true);

    ToggleButton tb2 = new ToggleButton("B");
    tb2.setToggleGroup(group);
    tb2.setUserData(Color.LIGHTBLUE);
    ToggleButton tb3 = new ToggleButton("C");
    tb3.setToggleGroup(group);
    tb3.setUserData(Color.SALMON);

    HBox hbox = new HBox();

    hbox.getChildren().add(tb1);
    hbox.getChildren().add(tb2);
    hbox.getChildren().add(tb3);

    ((Group) scene.getRoot()).getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Toggle Button Sample");
    stage.setWidth(250);/*from   ww w  .ja  va  2s  . co m*/
    stage.setHeight(180);

    final ToggleGroup group = new ToggleGroup();

    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) {
            System.out.println((Color) group.getSelectedToggle().getUserData());
        }
    });
    Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    ToggleButton tb1 = new ToggleButton("A", rootIcon);
    System.out.println(tb1.isSelected());

    tb1.setToggleGroup(group);
    tb1.setUserData(Color.LIGHTGREEN);
    tb1.setSelected(true);

    ToggleButton tb2 = new ToggleButton("B");
    tb2.setToggleGroup(group);
    tb2.setUserData(Color.LIGHTBLUE);
    ToggleButton tb3 = new ToggleButton("C");
    tb3.setToggleGroup(group);
    tb3.setUserData(Color.SALMON);

    HBox hbox = new HBox();

    hbox.getChildren().add(tb1);
    hbox.getChildren().add(tb2);
    hbox.getChildren().add(tb3);

    ((Group) scene.getRoot()).getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Toggle Button Sample");
    stage.setWidth(250);/*from   w  w w  . j  a  v a 2 s .  c o  m*/
    stage.setHeight(180);

    final ToggleGroup group = new ToggleGroup();

    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) {
            System.out.println((Color) group.getSelectedToggle().getUserData());
        }
    });
    Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    ToggleButton tb1 = new ToggleButton("A", rootIcon);
    System.out.println(tb1.selectedProperty());

    tb1.setToggleGroup(group);
    tb1.setUserData(Color.LIGHTGREEN);
    tb1.setSelected(true);

    ToggleButton tb2 = new ToggleButton("B");
    tb2.setToggleGroup(group);
    tb2.setUserData(Color.LIGHTBLUE);
    ToggleButton tb3 = new ToggleButton("C");
    tb3.setToggleGroup(group);
    tb3.setUserData(Color.SALMON);

    HBox hbox = new HBox();

    hbox.getChildren().add(tb1);
    hbox.getChildren().add(tb2);
    hbox.getChildren().add(tb3);

    ((Group) scene.getRoot()).getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Toggle Button Sample");
    stage.setWidth(250);/*from ww  w. jav a 2s . c  o  m*/
    stage.setHeight(180);

    final ToggleGroup group = new ToggleGroup();

    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) {
            System.out.println((Color) group.getSelectedToggle().getUserData());
        }
    });
    Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    ToggleButton tb1 = new ToggleButton("A", rootIcon);
    System.out.println(tb1.toggleGroupProperty());

    tb1.setToggleGroup(group);
    tb1.setUserData(Color.LIGHTGREEN);
    tb1.setSelected(true);

    ToggleButton tb2 = new ToggleButton("B");
    tb2.setToggleGroup(group);
    tb2.setUserData(Color.LIGHTBLUE);
    ToggleButton tb3 = new ToggleButton("C");
    tb3.setToggleGroup(group);
    tb3.setUserData(Color.SALMON);

    HBox hbox = new HBox();

    hbox.getChildren().add(tb1);
    hbox.getChildren().add(tb2);
    hbox.getChildren().add(tb3);

    ((Group) scene.getRoot()).getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Toggle Button Sample");
    stage.setWidth(250);/*ww w . j  av a 2 s  . c o  m*/
    stage.setHeight(180);

    final ToggleGroup group = new ToggleGroup();

    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) {
            System.out.println((Color) group.getSelectedToggle().getUserData());
        }
    });
    Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    ToggleButton tb1 = new ToggleButton("A", rootIcon);
    System.out.println(tb1.toggleGroupProperty());

    tb1.setToggleGroup(group);
    tb1.setUserData(Color.LIGHTGREEN);
    tb1.setSelected(true);

    ToggleButton tb2 = new ToggleButton("B");
    tb2.setToggleGroup(group);
    tb2.setUserData(Color.LIGHTBLUE);
    ToggleButton tb3 = new ToggleButton("C");
    tb3.setToggleGroup(group);
    tb3.setUserData(Color.SALMON);

    System.out.println(tb3.getToggleGroup());

    HBox hbox = new HBox();

    hbox.getChildren().add(tb1);
    hbox.getChildren().add(tb2);
    hbox.getChildren().add(tb3);

    ((Group) scene.getRoot()).getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Toggle Button Sample");
    stage.setWidth(250);/*  w  w  w.j  ava 2s. c  o  m*/
    stage.setHeight(180);

    final ToggleGroup group = new ToggleGroup();

    group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) {
            System.out.println((Color) group.getSelectedToggle().getUserData());
        }
    });
    Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    ToggleButton tb1 = new ToggleButton("A", rootIcon);
    System.out.println(tb1.toggleGroupProperty());

    tb1.setToggleGroup(group);
    tb1.setUserData(Color.LIGHTGREEN);
    tb1.setSelected(true);

    ToggleButton tb2 = new ToggleButton("B");
    tb2.setToggleGroup(group);
    tb2.setUserData(Color.LIGHTBLUE);
    ToggleButton tb3 = new ToggleButton("C");
    tb3.setToggleGroup(group);
    tb3.setUserData(Color.SALMON);

    tb3.fire();

    HBox hbox = new HBox();

    hbox.getChildren().add(tb1);
    hbox.getChildren().add(tb2);
    hbox.getChildren().add(tb3);

    ((Group) scene.getRoot()).getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("Hello Drag And Drop");

    Group root = new Group();
    Scene scene = new Scene(root, 400, 200);
    scene.setFill(Color.LIGHTGREEN);

    final Text source = new Text(50, 100, "DRAG ME");
    source.setScaleX(2.0);/*from ww w  . ja  v  a2  s .c om*/
    source.setScaleY(2.0);

    final Text target = new Text(250, 100, "DROP HERE");
    target.setScaleX(2.0);
    target.setScaleY(2.0);

    source.setOnDragDetected(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent event) {
            /* drag was detected, start drag-and-drop gesture*/
            System.out.println("onDragDetected");

            /* allow any transfer mode */
            Dragboard db = source.startDragAndDrop(TransferMode.ANY);

            /* put a string on dragboard */
            ClipboardContent content = new ClipboardContent();
            content.putString(source.getText());
            db.setContent(content);

            event.consume();
        }
    });

    target.setOnDragOver(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* data is dragged over the target */
            System.out.println("onDragOver");

            /* accept it only if it is  not dragged from the same node 
             * and if it has a string data */
            if (event.getGestureSource() != target && event.getDragboard().hasString()) {
                /* allow for both copying and moving, whatever user chooses */
                event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
            }

            event.consume();
        }
    });

    target.setOnDragEntered(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* the drag-and-drop gesture entered the target */
            System.out.println("onDragEntered");
            /* show to the user that it is an actual gesture target */
            if (event.getGestureSource() != target && event.getDragboard().hasString()) {
                target.setFill(Color.GREEN);
            }

            event.consume();
        }
    });

    target.setOnDragExited(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* mouse moved away, remove the graphical cues */
            target.setFill(Color.BLACK);

            event.consume();
        }
    });

    target.setOnDragDropped(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* data dropped */
            System.out.println("onDragDropped");
            /* if there is a string data on dragboard, read it and use it */
            Dragboard db = event.getDragboard();
            boolean success = false;
            if (db.hasString()) {
                target.setText(db.getString());
                success = true;
            }
            /* let the source know whether the string was successfully 
             * transferred and used */
            event.setDropCompleted(success);

            event.consume();
        }
    });

    source.setOnDragDone(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* the drag-and-drop gesture ended */
            System.out.println("onDragDone");
            /* if the data was successfully moved, clear it */
            if (event.getTransferMode() == TransferMode.MOVE) {
                source.setText("");
            }

            event.consume();
        }
    });

    root.getChildren().add(source);
    root.getChildren().add(target);
    stage.setScene(scene);
    stage.show();
}