List of usage examples for javafx.scene.control Button Button
public Button(String text)
From source file:Main.java
License:asdf
@Override public void start(Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);/*from w w w .j a va2 s . co m*/ stage.setHeight(500); Scene scene = new Scene(new Group()); FlowPane flow = new FlowPane(); flow.setVgap(8); flow.setHgap(4); flow.setPrefWrapLength(300); // preferred width = 300 for (int i = 0; i < 10; i++) { flow.getChildren().add(new Button("asdf")); } scene.setRoot(flow); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(300);/* ww w.j a va 2 s .co m*/ stage.setHeight(190); VBox vbox = new VBox(); vbox.setLayoutX(20); vbox.setLayoutY(20); final Button button1 = new Button("OK"); button1.addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { System.out.println("mouse entered"); } }); button1.addEventHandler(MouseEvent.MOUSE_EXITED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { System.out.println("mouse out"); } }); vbox.getChildren().add(button1); ((Group) scene.getRoot()).getChildren().add(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Label nameLbl = new Label("Enter your name:"); TextField nameFld = new TextField(); Label msg = new Label(); msg.setStyle("-fx-text-fill: blue;"); Button sayHelloBtn = new Button("Say Hello"); Button exitBtn = new Button("Exit"); sayHelloBtn.setOnAction(e -> {//from ww w . ja v a 2 s. com String name = nameFld.getText(); if (name.trim().length() > 0) { msg.setText("Hello " + name); } else { msg.setText("Hello there"); } }); exitBtn.setOnAction(e -> Platform.exit()); VBox root = new VBox(); root.setSpacing(5); root.getChildren().addAll(nameLbl, nameFld, msg, sayHelloBtn, exitBtn); Scene scene = new Scene(root, 350, 150); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group g = new Group(); Scene scene = new Scene(g, 550, 250, Color.web("0x0000FF", 1.0)); TitledPane t1 = new TitledPane("T1", new Button("B1")); TitledPane t2 = new TitledPane("T2", new Button("B2")); TitledPane t3 = new TitledPane("T3", new Button("B3")); Accordion accordion = new Accordion(); accordion.getPanes().addAll(t1, t2, t3); accordion.setExpandedPane(t1);/*from w ww .ja v a 2 s . c o m*/ g.getChildren().add(accordion); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group g = new Group(); Scene scene = new Scene(g, 550, 250, Color.web("0x0000FF", 1.0)); TitledPane t1 = new TitledPane("T1", new Button("B1")); TitledPane t2 = new TitledPane("T2", new Button("B2")); TitledPane t3 = new TitledPane("T3", new Button("B3")); Accordion accordion = new Accordion(); accordion.getPanes().addAll(t1, t2, t3); ObservableList<TitledPane> paneList = accordion.getPanes(); g.getChildren().add(accordion);/*from www .j a v a2 s . com*/ primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group g = new Group(); Scene scene = new Scene(g, 550, 250, Color.web("0x0000FF", 1.0)); TitledPane t1 = new TitledPane("T1", new Button("B1")); TitledPane t2 = new TitledPane("T2", new Button("B2")); TitledPane t3 = new TitledPane("T3", new Button("B3")); Accordion accordion = new Accordion(); accordion.getPanes().addAll(t1, t2, t3); TitledPane titledPane = accordion.getExpandedPane(); g.getChildren().add(accordion);//from w ww . j a v a 2 s.c o m primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group g = new Group(); Scene scene = new Scene(g, 550, 250, Color.web("0x0000FF", 1.0)); TitledPane t1 = new TitledPane("T1", new Button("B1")); TitledPane t2 = new TitledPane("T2", new Button("B2")); TitledPane t3 = new TitledPane("T3", new Button("B3")); Accordion accordion = new Accordion(); accordion.getPanes().addAll(t1, t2, t3); ObjectProperty<TitledPane> p = accordion.expandedPaneProperty(); g.getChildren().add(accordion);//from ww w .j ava 2s. c o m primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
License:asdf
@Override public void start(Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);/* w w w.java2 s . c om*/ stage.setHeight(500); Scene scene = new Scene(new Group()); FlowPane flow = new FlowPane(Orientation.VERTICAL); flow.setVgap(8); flow.setHgap(4); flow.setPrefWrapLength(300); // preferred width = 300 for (int i = 0; i < 10; i++) { flow.getChildren().add(new Button("asdf")); } scene.setRoot(flow); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(final Stage primaryStage) { Group root = new Group(); Button buttonLoad = new Button("Load"); buttonLoad.setOnAction(new EventHandler<ActionEvent>() { @Override//from w w w .ja v a 2 s. c o m public void handle(ActionEvent arg0) { FileChooser fileChooser = new FileChooser(); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("TXT files (*.txt)", "*.txt"); fileChooser.getExtensionFilters().add(extFilter); File file = fileChooser.showOpenDialog(primaryStage); System.out.println(file); } }); VBox vBox = VBoxBuilder.create().children(buttonLoad).build(); root.getChildren().add(vBox); primaryStage.setScene(new Scene(root, 500, 400)); primaryStage.show(); }
From source file:Main.java
public void start(Stage stage) { Node top = null;/*from w ww. j a v a 2s . c om*/ Node left = null; VBox center = getCenter(); Button okBtn = new Button("Ok"); Button cancelBtn = new Button("Cancel"); okBtn.setMaxWidth(Double.MAX_VALUE); VBox right = new VBox(okBtn, cancelBtn); right.setStyle("-fx-padding: 10;"); Label statusLbl = new Label("Status: Ready"); HBox bottom = new HBox(statusLbl); BorderPane.setMargin(bottom, new Insets(10, 0, 0, 0)); BorderPane root = new BorderPane(center, top, right, bottom, left); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); }