@Override public void visitMaxs(int maxStack, int maxLocals) { Label endFinally = new Label(); mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null); mv.visitLabel(endFinally); mv.visitInsn(DUP); int errIdx = newLocal(Type.getType(Throwable.class)); mv.visitVarInsn(Opcodes.ASTORE, errIdx); mv.visitVarInsn(Opcodes.ALOAD, statIdx); mv.visitVarInsn(Opcodes.ALOAD, errIdx); mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_MAIN, END_METHOD, END_SIGNATURE, false); mv.visitInsn(ATHROW); mv.visitMaxs(maxStack + 8, maxLocals + 2); }
@Override public void visitTableSwitchInsn( final int min, final int max, final Label dflt, final Label... labels) { lastBytecodeOffset = code.length; // Add the instruction to the bytecode of the method. code.putByte(Opcodes.TABLESWITCH).putByteArray(null, 0, (4 - code.length % 4) % 4); dflt.put(code, lastBytecodeOffset, true); code.putInt(min).putInt(max); for (Label label : labels) { label.put(code, lastBytecodeOffset, true); } // If needed, update the maximum stack size and number of locals, and stack map frames. visitSwitchInsn(dflt, labels); }
/** * Ends the current basic block. This method must be used in the case where the current basic * block does not have any successor. * * <p>WARNING: this method must be called after the currently visited instruction has been put in * {@link #code} (if frames are computed, this method inserts a new Label to start a new basic * block after the current instruction). */ private void endCurrentBasicBlockWithNoSuccessor() { if (compute == COMPUTE_ALL_FRAMES) { Label nextBasicBlock = new Label(); nextBasicBlock.frame = new Frame(nextBasicBlock); nextBasicBlock.resolve(code.data, code.length); lastBasicBlock.nextBasicBlock = nextBasicBlock; lastBasicBlock = nextBasicBlock; currentBasicBlock = null; } else if (compute == COMPUTE_MAX_STACK_AND_LOCAL) { currentBasicBlock.outputStackMax = (short) maxRelativeStackSize; currentBasicBlock = null; } }
Button incBtn = new Button("Increment"); Label label = new Label("0"); EventStreams.eventsOf(incBtn, ACTION) .accumulate(0, (n, a) -> n + 1) .map(Object::toString) .feedTo(label.textProperty());
stage.setTitle("Table View Sample"); stage.setWidth(450); stage.setHeight(500); final Label label = new Label("Address Book"); label.setFont(new Font("Arial", 20)); table.getColumns().addAll(firstNameCol, lastNameCol, emailCol); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(label, table); stage.setScene(new Scene(new Group(vbox))); stage.show();
primaryStage.setTitle("Extension Filter Example"); final Label fileLabel = new Label(); Button btn = new Button("Open FileChooser"); btn.setOnAction(new EventHandler<ActionEvent>() { fileLabel.setText(file.getPath()); VBox vBox = new VBox(30); vBox.getChildren().addAll(fileLabel, btn); vBox.setAlignment(Pos.BASELINE_CENTER); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show();
public void start(Stage primaryStage) { final AtomicLong counter = new AtomicLong(-1); final Label label = new Label(); final Thread countThread = new Thread(new Runnable() { @Override countThread.start(); VBox root = new VBox(); root.getChildren().add(label); root.setPadding(new Insets(5)); root.setAlignment(Pos.CENTER); primaryStage.setScene(scene); primaryStage.show();
import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class PickingDates extends Application { @Override public void start(final Stage stage) throws Exception { DatePicker picker = new DatePicker(); Label typedData = new Label(); picker.getEditor().textProperty().addListener((observable, oldValue, newValue) -> { typedData.setText(newValue); }); Button button = new Button("Button"); final VBox layout = new VBox(10, typedData, picker, button); layout.setPadding(new Insets(10)); Scene scene = new Scene(layout); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } }
stage.setTitle("Table View Sample"); final Label label = new Label("Address Book"); label.setFont(new Font("Arial", 20)); final Label actionTaken = new Label(); return new TableCell<Person, Person>() { final ImageView buttonGraphic = new ImageView(); final Button button = new Button(); { button.setGraphic(buttonGraphic); button.setMinWidth(130); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { actionTaken.setText("Bought " + person.getLikes().toLowerCase() + " for: " + person.getFirstName() + " " + person.getLastName()); table.getColumns().addAll(firstNameCol, lastNameCol, emailCol, btnCol); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 10, 10, 10)); vbox.getChildren().addAll(label, table, actionTaken); VBox.setVgrow(table, Priority.ALWAYS); stage.setScene(new Scene(vbox)); stage.show();
stage.setTitle("Validation Demo"); BorderPane borderPane = new BorderPane(); scene.getStylesheets().add( ValidationDemo.class.getResource("context.css") .toExternalForm()); stage.setScene(scene); stage.show(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label("User Name:"); grid.add(userName, 0, 1); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2); grid.add(pwBox, 1, 2); btn.setOnAction(new EventHandler<ActionEvent>() {
Keyboard keyboard = new Keyboard(); scene.getStylesheets().add( getClass().getResource( "keyboard.css" ); stage.setScene(scene); stage.show(); fontSize.setMinorTickCount(0); Label typedData = new Label(); keyboard.lastKeyTextProperty().addListener((observable, oldText, newText) -> typedData.setText(typedData.getText() + newText) ); VBox layout = new VBox(10); layout.getChildren().setAll( new Label("Keyboard Size"), fontSize, typedData HBox keyRow = new HBox(); keyRow.getStyleClass().add("key-row");
public void start(Stage primaryStage) { HBox hbox = new HBox(10); TextField field = new TextField(); HBox.setHgrow(field, Priority.ALWAYS); hbox.setAlignment(Pos.BASELINE_LEFT); hbox.getChildren().addAll( new Label("Search:"), field, new Button("Go") ); hbox.setPadding(new Insets(10)); Scene scene = new Scene(hbox, 600, 250, Color.WHITE); primaryStage.setScene(scene); primaryStage.show(); }
Button btn = new Button(); btn.setText("Choose favorite meal"); Label label = new Label("I don't know your favorite meal yet!"); btn.setOnAction((ActionEvent event) -> { FXMLLoader loader = new FXMLLoader(getClass().getResource("input.fxml")); Scene newScene; Stage inputStage = new Stage(); inputStage.initOwner(primaryStage); inputStage.setScene(newScene); inputStage.showAndWait(); label.setText(meal == null ? "C'mon, tell me your favourite meal already!" : "Your favourite meal is "+meal+". Interesting!"); }); root.setSpacing(10); root.setPadding(new Insets(10)); root.setPrefWidth(300);
final Label lblTool = new Label(); HBox hBox = new HBox(); hBox.setSpacing(5.0); hBox.setPadding(new Insets(5, 5, 5, 5)); hBox.getChildren().add(lblTool); lblTool.setText(newValue.getTool()); pane.setTop(hBox); pane.setCenter(table); stage.setScene(new Scene(pane, 640, 480)); stage.show();
@Override public void start(Stage primaryStage) { HBox hbox = new HBox(); Button b = new Button("add"); b.setOnAction(ev -> hbox.getChildren().add(new Label("Test"))); ScrollPane scrollPane = new ScrollPane(hbox); scrollPane.setFitToHeight(true); BorderPane root = new BorderPane(scrollPane); root.setPadding(new Insets(15)); root.setTop(b); Scene scene = new Scene(root, 400, 400); primaryStage.setScene(scene); primaryStage.show(); }
Scene scene = new Scene(root, 400, 400); primaryStage.setScene(scene); primaryStage.setResizable(false); StackPane waitingPane = new StackPane(); final ProgressBar progress = new ProgressBar(); Label load = new Label("loading things..."); progress.setTranslateY(-25); load.setTranslateY(25); waitingPane.getChildren().addAll(new Rectangle(400,400,Color.WHITE),load,progress); root.getChildren().add(waitingPane); primaryStage.show(); loadPane = new TilePane(5,5); loadPane.setPrefColumns(3); loadPane.setPadding(new Insets(5)); for(int i=0;i<9;i++){ StackPane waitingPane = new StackPane(); indicators[i].setTranslateY(-25); indicators[i].setTranslateX(-10); loading[i] = new Label(); loading[i].setTranslateY(25); waitingPane.getChildren().addAll(background,indicators[i],loading[i]);
Label menuLabel = new Label("File"); // menuLabel.setStyle("-fx-background-color: yellow; -fx-padding: 0px;"); menuLabel.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { System.out.println("File menu clicked"); Stage myDialog = new Stage(); myDialog.initModality(Modality.WINDOW_MODAL); Scene myDialogScene = new Scene(VBoxBuilder.create() .children(new Text("Hello! it's My Dialog.")) .alignment(Pos.CENTER) .padding(new Insets(10)) .build()); myDialog.setScene(myDialogScene); myDialog.show(); } }); Menu fileMenuButton = new Menu(); fileMenuButton.setGraphic(menuLabel); menuBar.getMenus().add(fileMenuButton);
public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Label label = new Label("Some\ntext"); label.setGraphic(new ImageView(getClass().getResource("/images/Folder-icon.png").toExternalForm())); label.setMaxWidth(Double.POSITIVE_INFINITY); label.setMaxHeight(Double.POSITIVE_INFINITY); label.setStyle("-fx-border-color: blue;"); root.setCenter(label); contentDisplayBox.getItems().addAll(ContentDisplay.values()); contentDisplayBox.getSelectionModel().select(ContentDisplay.LEFT); label.contentDisplayProperty().bind(contentDisplayBox.valueProperty()); label.alignmentProperty().bind(alignmentBox.valueProperty()); label.textAlignmentProperty().bind(textAlignmentBox.valueProperty()); ctrls.setPadding(new Insets(10)); ctrls.addRow(0, new Label("Content display:"), new Label("Alignment:"), new Label("Text Alignment:")); ctrls.addRow(1, contentDisplayBox, alignmentBox, textAlignmentBox); primaryStage.setScene(scene); primaryStage.show();
new Text("Don't have an account? "), createAccount ); flow.setPadding(new Insets(10)); primaryStage.setScene(new Scene(new Group(flow))); primaryStage.show(); accountCreation.initOwner(primaryStage); accountCreation.setTitle("Create Account"); accountCreation.setScene(new Scene(new Label("<Account Creation Form Goes Here>"), 250, 50));