Java Code Examples for javafx.scene.layout.HBox#setPrefWidth()
The following examples show how to use
javafx.scene.layout.HBox#setPrefWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomGaugeSkinDemo.java From medusademo with Apache License 2.0 | 7 votes |
@Override public void start(Stage stage) { HBox pane = new HBox(gauge0, gauge1, gauge2, gauge3, gauge4, gauge5, gauge6, gauge7, gauge8, gauge9); pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY))); pane.setPadding(new Insets(10)); pane.setPrefWidth(400); Scene scene = new Scene(pane); stage.setTitle("Medusa Custom Gauge Skin"); stage.setScene(scene); stage.show(); timer.start(); // Calculate number of nodes calcNoOfNodes(pane); System.out.println(noOfNodes + " Nodes in SceneGraph"); }
Example 2
Source File: CodeFoldingContentEditor.java From milkman with MIT License | 6 votes |
@Override protected void setupParagraphGraphics() { IntFunction<Node> numberFactory = LineNumberFactory.get(codeArea); if (foldOperatorFactory == null) foldOperatorFactory = new FoldOperatorFactory(); IntFunction<Node> graphicFactory = line -> { var collapseSign = foldOperatorFactory.apply(line); Label lineNo = (Label) numberFactory.apply(line); HBox hbox = new HBox(lineNo); // monospace font, small hack, we assume 10px character width (not totally accurate, but good enough). +10 insets, +20 for our collapser hbox.setPrefWidth(lineNo.getText().length() * 10 + 10 + 20); if (collapseSign != null) hbox.getChildren().add(collapseSign); hbox.setAlignment(Pos.CENTER_LEFT); return hbox; }; codeArea.setParagraphGraphicFactory(graphicFactory); }
Example 3
Source File: TextTreeItem.java From PDF4Teachers with Apache License 2.0 | 6 votes |
public void updateIcon(){ // Re définis les children de la pane int cellHeight = (Main.settings.isSmallFontInTextsList() ? 14 : 18); pane.getChildren().clear(); HBox spacer = new HBox(); spacer.setPrefWidth(15 + (3 + 4 + 3)); spacer.setAlignment(Pos.TOP_RIGHT); if(core != null) spacer.getChildren().add(linkImage); rect.setWidth(4); rect.setHeight(4); rect.setFill(StyleManager.convertColor(Color.WHITE)); HBox.setMargin(rect, new Insets(((cellHeight - 4) / 2.0), 3, 0, 3)); spacer.getChildren().add(rect); pane.getChildren().addAll(spacer, name); }
Example 4
Source File: PickerMilestone.java From HubTurbo with GNU Lesser General Public License v3.0 | 6 votes |
private HBox createMilestoneDetailsBox() { HBox milestoneDetailsBox = new HBox(); milestoneDetailsBox.setSpacing(3); milestoneDetailsBox.setPrefWidth(250); milestoneDetailsBox.setAlignment(Pos.CENTER_RIGHT); if (getDueDate().isPresent()) { Label dueDate = new Label(getDueDate().get().toString()); dueDate.setPrefWidth(150); milestoneDetailsBox.getChildren().add(dueDate); } MilestoneProgressBar progressBar = new MilestoneProgressBar(getProgress()); Label progressLabel = new Label(String.format("%3.0f%%", getProgress() * 100)); progressLabel.setPrefWidth(50); milestoneDetailsBox.getChildren().addAll(progressBar, progressLabel); return milestoneDetailsBox; }
Example 5
Source File: PickerAssignee.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
private HBox getAssigneeHBox() { HBox assigneeBox = new HBox(); assigneeBox.setSpacing(30); assigneeBox.setPadding(new Insets(0, 0, 0, 30)); assigneeBox.setAlignment(Pos.CENTER_LEFT); assigneeBox.setPrefWidth(398); return assigneeBox; }
Example 6
Source File: AreaShareChart.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
public AreaShareChart(@Nonnull ModularFeatureListRow row, AtomicDouble progress) { Float sum = row.streamFeatures().map(ModularFeature::getArea).filter(p -> p.getValue() != null) .map(Property<Float>::getValue).reduce(0f, Float::sum); List<Rectangle> all = new ArrayList<>(); int i = 0; int size = row.getFeatures().size(); for (Entry<RawDataFile, ModularFeature> entry : row.getFeatures().entrySet()) { Property<Float> areaProperty = entry.getValue().get(AreaType.class); if (areaProperty.getValue() != null) { // color from sample Color color = entry.getValue().get(RawColorType.class).getValue(); if (color == null) color = Color.DARKORANGE; float ratio = areaProperty.getValue() / sum; Rectangle rect = new Rectangle(); rect.setFill(color); // bind width rect.widthProperty().bind(this.widthProperty().multiply(ratio)); rect.setHeight(i % 2 == 0 ? 20 : 25); all.add(rect); i++; if (progress != null) progress.addAndGet(1.0 / size); } } HBox box = new HBox(0, all.toArray(Rectangle[]::new)); box.setPrefWidth(100); box.setAlignment(Pos.CENTER_LEFT); this.getChildren().add(box); }
Example 7
Source File: PickerMilestone.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
private HBox createMilestoneNodeBox() { HBox milestoneNodeBox = new HBox(); milestoneNodeBox.setPrefWidth(129); milestoneNodeBox.setAlignment(Pos.CENTER); milestoneNodeBox.getChildren().add(createMilestoneNode()); return milestoneNodeBox; }
Example 8
Source File: MilestonePickerDialog.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
private HBox createPreviouslyAssignedMilestoneBox() { HBox milestoneBox = new HBox(); milestoneBox.setPrefWidth(120); milestoneBox.setPrefHeight(PREV_ASSIGNED_MILESTONE_HEIGHT); milestoneBox.setMaxHeight(PREV_ASSIGNED_MILESTONE_HEIGHT); milestoneBox.setStyle("-fx-border-radius: 3;-fx-border-style: dotted;-fx-alignment:center"); return milestoneBox; }
Example 9
Source File: MilestonePickerDialog.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
private HBox createNewlyAssignedMilestoneBox() { HBox milestoneBox = new HBox(); milestoneBox.setPrefWidth(140); milestoneBox.setPrefHeight(40); milestoneBox.setStyle("-fx-border-radius: 3;-fx-border-style: dotted;-fx-alignment:center"); return milestoneBox; }
Example 10
Source File: AboutLogFXView.java From LogFX with GNU General Public License v3.0 | 5 votes |
VBox createNode() { VBox contents = new VBox( 25 ); contents.setPrefSize( 500, 300 ); contents.setAlignment( Pos.CENTER ); contents.getStylesheets().add( "css/about.css" ); HBox textBox = new HBox( 0 ); textBox.setPrefWidth( 500 ); textBox.setAlignment( Pos.CENTER ); Text logText = new Text( "Log" ); logText.setId( "logfx-text-log" ); Text fxText = new Text( "FX" ); fxText.setId( "logfx-text-fx" ); textBox.getChildren().addAll( logText, fxText ); VBox smallText = new VBox( 10 ); smallText.setPrefWidth( 500 ); smallText.setAlignment( Pos.CENTER ); Text version = new Text( "Version " + Constants.LOGFX_VERSION ); Text byRenato = new Text( "Copyright Renato Athaydes, 2017. All rights reserved." ); Text license = new Text( "Licensed under the GPLv3 License." ); Hyperlink link = new Hyperlink( "https://github.com/renatoathaydes/LogFX" ); link.setOnAction( ( event ) -> hostServices.showDocument( link.getText() ) ); smallText.getChildren().addAll( version, byRenato, link, license ); contents.getChildren().addAll( textBox, smallText ); return contents; }
Example 11
Source File: DragDrop.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public StackPane createDragDropBox() { StackPane pane = new StackPane(); HBox hBox1 = new HBox(); hBox1.setPrefWidth(100); hBox1.setPrefHeight(100); hBox1.setStyle("-fx-border-color: green;" + "-fx-border-width: 2;" + "-fx-border-style: solid;"); HBox hBox2 = new HBox(); hBox2.setPrefWidth(100); hBox2.setPrefHeight(100); hBox2.setStyle("-fx-border-color: orange;" + "-fx-border-width: 2;" + "-fx-border-style: solid;"); //insertImage(new Image(getClass().getResourceAsStream("/images/MaleIcon.png")), hBox1); //insertImage(new Image(getClass().getResourceAsStream("/images/FemaleIcon.png")), hBox2); //insertImage(new Image(getClass().getResourceAsStream("/images/RobotIcon.png")), hBox1); insertImage("bee32.png", hBox1); insertImage("branch32.png", hBox1); insertImage("carrot32.png", hBox1); insertImage("ladybug32.png", hBox1); insertImage("leaf32.png", hBox1); //setupGestureTarget(hBox1); setupGestureTarget(hBox2); VBox vBox = new VBox(); vBox.getChildren().addAll(hBox1, hBox2); pane.getChildren().addAll(vBox); return pane; }
Example 12
Source File: SpaceFXView.java From SpaceFX with Apache License 2.0 | 5 votes |
private HBox createHallOfFameEntry(final Player player) { Label playerName = new Label(player.name); playerName.setTextFill(SPACEFX_COLOR); Region spacer = new Region(); HBox.setHgrow(spacer, Priority.ALWAYS); Label playerScore = new Label(Long.toString(player.score)); playerScore.setTextFill(SPACEFX_COLOR); playerScore.setAlignment(Pos.CENTER_RIGHT); HBox entry = new HBox(20, playerName, spacer, playerScore); entry.setPrefWidth(WIDTH); return entry; }
Example 13
Source File: SiteListStage.java From dm3270 with Apache License 2.0 | 4 votes |
public SiteListStage (Preferences prefs, String key, int max, boolean show3270e) { super (prefs); setTitle ("Site Manager"); readPrefs (key, max); fields.add (new PreferenceField (key + " name", 150, Type.TEXT)); fields.add (new PreferenceField ("URL", 150, Type.TEXT)); fields.add (new PreferenceField ("Port", 50, Type.NUMBER)); fields.add (new PreferenceField ("Ext", 50, Type.BOOLEAN)); fields.add (new PreferenceField ("Model", 40, Type.NUMBER)); fields.add (new PreferenceField ("Plugins", 50, Type.BOOLEAN)); fields.add (new PreferenceField ("Save folder", 80, Type.TEXT)); VBox vbox = getHeadings (); // input fields for (Site site : sites) { HBox hbox = new HBox (); hbox.setSpacing (5); hbox.setPadding (new Insets (0, 5, 0, 5)); // trbl for (int i = 0; i < fields.size (); i++) { PreferenceField field = fields.get (i); if (field.type == Type.TEXT || field.type == Type.NUMBER) { TextField textField = site.getTextField (i); textField.setMaxWidth (field.width); hbox.getChildren ().add (textField); } else if (field.type == Type.BOOLEAN) { HBox box = new HBox (); CheckBox checkBox = site.getCheckBoxField (i); box.setPrefWidth (field.width); box.setAlignment (Pos.CENTER); box.getChildren ().add (checkBox); hbox.getChildren ().add (box); } } vbox.getChildren ().add (hbox); } BorderPane borderPane = new BorderPane (); borderPane.setCenter (vbox); borderPane.setBottom (buttons ()); Scene scene = new Scene (borderPane); setScene (scene); saveButton.setOnAction (e -> save (key)); cancelButton.setOnAction (e -> this.hide ()); editListButton.setOnAction (e -> this.show ()); }
Example 14
Source File: PluginsStage.java From dm3270 with Apache License 2.0 | 4 votes |
public PluginsStage (Preferences prefs) // ---------------------------------------------------------------------------------// { super (prefs); setTitle ("Plugin Manager"); readPrefs (); editMenuItem.setOnAction (e -> this.show ()); fields.add (new PreferenceField ("Menu entry", 130, Type.TEXT)); fields.add (new PreferenceField ("Class name", 300, Type.TEXT)); fields.add (new PreferenceField ("Active", 60, Type.BOOLEAN)); VBox vbox = getHeadings (); for (PluginEntry pluginEntry : plugins) { HBox hbox = new HBox (); hbox.setSpacing (5); hbox.setPadding (new Insets (0, 5, 0, 5)); // trbl for (int i = 0; i < fields.size (); i++) { PreferenceField field = fields.get (i); if (field.type == Type.TEXT || field.type == Type.NUMBER) { TextField textField = pluginEntry.getTextField (i); textField.setPrefWidth (field.width); hbox.getChildren ().add (textField); } else if (field.type == Type.BOOLEAN) { HBox box = new HBox (); CheckBox checkBox = pluginEntry.getCheckBox (i); box.setPrefWidth (field.width); box.setAlignment (Pos.CENTER); box.getChildren ().add (checkBox); hbox.getChildren ().add (box); } } vbox.getChildren ().add (hbox); } BorderPane borderPane = new BorderPane (); borderPane.setCenter (vbox); borderPane.setBottom (buttons ()); Scene scene = new Scene (borderPane); setScene (scene); saveButton.setOnAction (e -> { savePrefs (); this.hide (); }); cancelButton.setOnAction (e -> this.hide ()); }
Example 15
Source File: PluginsStage.java From xframium-java with GNU General Public License v3.0 | 4 votes |
public PluginsStage (Preferences prefs) { super (prefs); setTitle ("Plugin Manager"); readPrefs (); editMenuItem.setOnAction (e -> this.show ()); fields.add (new PreferenceField ("Menu entry", 130, Type.TEXT)); fields.add (new PreferenceField ("Class name", 300, Type.TEXT)); fields.add (new PreferenceField ("Active", 60, Type.BOOLEAN)); VBox vbox = getHeadings (); for (PluginEntry pluginEntry : plugins) { HBox hbox = new HBox (); hbox.setSpacing (5); hbox.setPadding (new Insets (0, 5, 0, 5)); // trbl for (int i = 0; i < fields.size (); i++) { PreferenceField field = fields.get (i); if (field.type == Type.TEXT || field.type == Type.NUMBER) { TextField textField = pluginEntry.getTextField (i); textField.setPrefWidth (field.width); hbox.getChildren ().add (textField); } else if (field.type == Type.BOOLEAN) { HBox box = new HBox (); CheckBox checkBox = pluginEntry.getCheckBox (i); box.setPrefWidth (field.width); box.setAlignment (Pos.CENTER); box.getChildren ().add (checkBox); hbox.getChildren ().add (box); } } vbox.getChildren ().add (hbox); } BorderPane borderPane = new BorderPane (); borderPane.setCenter (vbox); borderPane.setBottom (buttons ()); Scene scene = new Scene (borderPane); setScene (scene); saveButton.setOnAction (e -> { savePrefs (); this.hide (); }); cancelButton.setOnAction (e -> this.hide ()); }
Example 16
Source File: SiteListStage.java From xframium-java with GNU General Public License v3.0 | 4 votes |
public SiteListStage (Preferences prefs, String key, int max, boolean show3270e) { super (prefs); setTitle ("Site Manager"); readPrefs (key, max); fields.add (new PreferenceField (key + " name", 150, Type.TEXT)); fields.add (new PreferenceField ("URL", 150, Type.TEXT)); fields.add (new PreferenceField ("Port", 50, Type.NUMBER)); fields.add (new PreferenceField ("Ext", 50, Type.BOOLEAN)); fields.add (new PreferenceField ("Model", 40, Type.NUMBER)); fields.add (new PreferenceField ("Plugins", 50, Type.BOOLEAN)); fields.add (new PreferenceField ("Save folder", 80, Type.TEXT)); VBox vbox = getHeadings (); // input fields for (Site site : sites) { HBox hbox = new HBox (); hbox.setSpacing (5); hbox.setPadding (new Insets (0, 5, 0, 5)); // trbl for (int i = 0; i < fields.size (); i++) { PreferenceField field = fields.get (i); if (field.type == Type.TEXT || field.type == Type.NUMBER) { TextField textField = site.getTextField (i); textField.setMaxWidth (field.width); hbox.getChildren ().add (textField); } else if (field.type == Type.BOOLEAN) { HBox box = new HBox (); CheckBox checkBox = site.getCheckBoxField (i); box.setPrefWidth (field.width); box.setAlignment (Pos.CENTER); box.getChildren ().add (checkBox); hbox.getChildren ().add (box); } } vbox.getChildren ().add (hbox); } BorderPane borderPane = new BorderPane (); borderPane.setCenter (vbox); borderPane.setBottom (buttons ()); Scene scene = new Scene (borderPane); setScene (scene); saveButton.setOnAction (e -> save (key)); cancelButton.setOnAction (e -> this.hide ()); editListButton.setOnAction (e -> this.show ()); }
Example 17
Source File: CreateNewAccount.java From ChatRoomFX with MIT License | 4 votes |
private void showConfirmation(){ Stage stage=new Stage(); VBox box=new VBox(); box.setId("root"); box.setSpacing(10); box.setPadding(new Insets(8)); HBox titleBox=new HBox(); titleBox.setPadding(new Insets(8)); titleBox.setPrefWidth(box.getPrefWidth()); titleBox.setAlignment(Pos.CENTER); Label title=new Label("Set Password"); title.setId("title"); titleBox.getChildren().add(title); box.getChildren().add(titleBox); HBox containerBox=new HBox(); containerBox.setPrefWidth(box.getPrefWidth()); VBox lblBox=new VBox(); lblBox.setSpacing(8); lblBox.setAlignment(Pos.CENTER_LEFT); // lblBox.setPrefWidth(box.getPrefWidth()/3); Label lblPass=new Label("Password"); lblPass.getStyleClass().add("label-info"); Label lblConPass=new Label("Confirm Password"); lblConPass.getStyleClass().add("label-info"); lblBox.getChildren().addAll(lblPass,lblConPass); containerBox.getChildren().add(lblBox); VBox txtBox=new VBox(); txtBox.setSpacing(8); PasswordField txtPass=new PasswordField(); txtPass.setPrefWidth(100); PasswordField txtConPass=new PasswordField(); txtPass.setPrefWidth(100); txtBox.setPadding(new Insets(8)); txtBox.getChildren().addAll(txtPass,txtConPass); containerBox.getChildren().add(txtBox); box.getChildren().add(containerBox); Button button=new Button("Confirm"); button.setId("btnCreate"); button.setOnAction(e->{ if(!txtPass.getText().equals(txtConPass.getText())){ System.out.println("Password mismatch!"); }else{ password=txtPass.getText(); System.out.println("Success!"); ((Stage)txtPass.getScene().getWindow()).close(); } }); HBox buttonBox=new HBox(); buttonBox.setPadding(new Insets(10)); buttonBox.setPrefWidth(box.getPrefWidth()); buttonBox.setAlignment(Pos.CENTER_RIGHT); buttonBox.getChildren().add(button); box.getChildren().add(buttonBox); Scene scene=new Scene(box); scene.getStylesheets().add(getClass().getResource("/lk/ijse/gdse41/publicChatClient/ui/util/css/Login.css").toExternalForm()); stage.setScene(scene); stage.showAndWait(); }
Example 18
Source File: MainLayout.java From redtorch with MIT License | 4 votes |
private void createLayout() { vBox.getChildren().add(crearteMainMenuBar()); // 左右切分布局------------------------ SplitPane horizontalSplitPane = new SplitPane(); horizontalSplitPane.setDividerPositions(0.5); vBox.getChildren().add(horizontalSplitPane); VBox.setVgrow(horizontalSplitPane, Priority.ALWAYS); // 左右切分布局----左侧上下切分布局--------- SplitPane leftVerticalSplitPane = new SplitPane(); leftVerticalSplitPane.setDividerPositions(0.4); horizontalSplitPane.getItems().add(leftVerticalSplitPane); leftVerticalSplitPane.setOrientation(Orientation.VERTICAL); // 左右切分布局----左侧上下切分布局----上布局----- SplitPane leftTopHorizontalSplitPane = new SplitPane(); leftVerticalSplitPane.getItems().add(leftTopHorizontalSplitPane); HBox leftTopRithtPane = new HBox(); Node orderPanelLayoutNode = orderPanelLayout.getNode(); HBox.setHgrow(orderPanelLayoutNode, Priority.ALWAYS); ScrollPane marketDetailsScrollPane = new ScrollPane(); Node marketDetailsNode = marketDetailsLayout.getNode(); marketDetailsScrollPane.setContent(marketDetailsNode); marketDetailsScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); marketDetailsScrollPane.setPrefWidth(253); marketDetailsScrollPane.setMinWidth(253); marketDetailsScrollPane.setMaxWidth(253); leftTopRithtPane.getChildren().addAll(marketDetailsScrollPane, orderPanelLayoutNode); leftTopRithtPane.setMaxWidth(680); leftTopRithtPane.setPrefWidth(680); leftTopHorizontalSplitPane.getItems().addAll(tickLayout.getNode(), leftTopRithtPane); SplitPane.setResizableWithParent(leftTopRithtPane, false); // 左右切分布局----左侧上下切分布局----下布局----- TabPane leftBootomTabPane = new TabPane(); leftVerticalSplitPane.getItems().add(leftBootomTabPane); Tab orderTab = new Tab("定单"); leftBootomTabPane.getTabs().add(orderTab); orderTab.setClosable(false); orderTab.setContent(orderLayout.getNode()); Tab tradeTab = new Tab("成交"); leftBootomTabPane.getTabs().add(tradeTab); tradeTab.setClosable(false); tradeTab.setContent(tradeLayout.getNode()); // 左右切分布局----右侧TAB布局------------- TabPane rightTabPane = new TabPane(); horizontalSplitPane.getItems().add(rightTabPane); Tab portfolioInvestmentTab = new Tab("投资组合"); rightTabPane.getTabs().add(portfolioInvestmentTab); portfolioInvestmentTab.setClosable(false); SplitPane portfolioVerticalSplitPane = new SplitPane(); portfolioInvestmentTab.setContent(portfolioVerticalSplitPane); portfolioVerticalSplitPane.setOrientation(Orientation.VERTICAL); VBox.setVgrow(portfolioVerticalSplitPane, Priority.ALWAYS); VBox portfolioVBox = new VBox(); portfolioVBox.getChildren().add(combinationLayout.getNode()); portfolioVBox.getChildren().add(accountLayout.getNode()); VBox.setVgrow(accountLayout.getNode(), Priority.ALWAYS); portfolioVerticalSplitPane.getItems().add(portfolioVBox); portfolioVerticalSplitPane.getItems().add(positionLayout.getNode()); Tab allContractTab = new Tab("全部合约"); allContractTab.setContent(contractLayout.getNode()); rightTabPane.getTabs().add(allContractTab); allContractTab.setClosable(false); // 状态栏------------------------------ vBox.getChildren().add(createStatusBar()); }
Example 19
Source File: GradeTreeItem.java From PDF4Teachers with Apache License 2.0 | 4 votes |
public HBox getEditGraphics(int width, ContextMenu menu){ Region spacer = new Region(); Text name = new Text(); Text value = new Text(); Text slash = new Text("/"); Text total = new Text(); HBox pane = new HBox(); pane.setAlignment(Pos.CENTER); pane.setPrefHeight(18); pane.setStyle("-fx-padding: -6 -6 -6 0;"); // top - right - bottom - left name.textProperty().bind(core.nameProperty()); HBox.setMargin(value, new Insets(0, 0, 0, 5)); value.textProperty().bind(Bindings.createStringBinding(() -> (core.getValue() == -1 ? "?" : Main.format.format(core.getValue())), core.valueProperty())); HBox.setMargin(total, new Insets(0, 5, 0, 0)); total.textProperty().bind(Bindings.createStringBinding(() -> Main.format.format(core.getTotal()), core.totalProperty())); // SETUP HBox.setHgrow(spacer, Priority.ALWAYS); gradeField.setText(core.getValue() == -1 ? "" : Main.format.format(core.getValue())); if(!isRoot() && getParent() != null){ if(((GradeTreeItem) getParent()).isExistTwice(core.getName())) core.setName(core.getName() + "(1)"); } if(hasSubGrade()){ pane.getChildren().addAll(name, spacer, value, slash, total); }else{ pane.getChildren().addAll(name, spacer, gradeField, slash, total); Platform.runLater(() -> { gradeField.requestFocus(); }); } pageContextMenu = menu; pane.setOnMouseEntered(e -> { gradeField.requestFocus(); }); pane.setPrefWidth(width); return pane; }