fxml

Return the choice of a combobox javafx

心已入冬 提交于 2019-12-13 02:01:14
问题 I have an app with 2 ComboBox and I would like to return the choice of the user into a variable. How should I do it ? Here is my controller class : package ch.makery.adress; import java.awt.FileDialog; import javafx.fxml.Initializable; import java.net.URL; import java.util.ResourceBundle; import javax.swing.JFrame; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.ComboBox;

javafx 8 fxml negation

荒凉一梦 提交于 2019-12-13 01:58:19
问题 Using FXML with JavaFx 8. I have few ToggleButtons in toggleGroup, defined as: <ToggleGroup fx:id="operater" /> I want to disable OK button, when no operater is selected. Actually, I want to negate the disable expression in ok button: <Button disable="${operater.selectedToggle.selected}" fx:id="ok" text="OK" mnemonicParsing="false" onAction="#okClick" > I have tried with ! and with not(), but no success. Thanks. 回答1: You can use an expression binding: disable="${!operater.selectedToggle

Resize SwingNode in Pane

人盡茶涼 提交于 2019-12-13 01:34:45
问题 I'm fairly new to using JavaFX and I am looking to add a JPanel into a JavaFX Pane. The code I currently have works, however the panel is very small. I want to be able to resize it so it fits the JavaFX pane. Code: // Add swing component to JFX final SwingNode swingNode = new SwingNode(); createAndSetSwingContent(swingNode); detailPane.getChildren().add(swingNode); Create Swing content method: private void createAndSetSwingContent(final SwingNode swingNode) { SwingUtilities.invokeLater(new

No content in TableView

走远了吗. 提交于 2019-12-13 00:44:46
问题 I want to load some data from a database into my tableview.I've got a code and it works fine but no my tableview is empty .... Here is my fxml file: <TableView fx:id="libraryNode" editable="true" onKeyPressed="#onLibraryRequest" xmlns:fx="http://javafx.com/fxml" fx:controller="mediabox.app.controller.MusicscreenController"> <columns> <TableColumn text="Index" prefWidth="40" > <cellValueFactory> <PropertyValueFactory property="id" /> </cellValueFactory> </TableColumn> <TableColumn text="Titel"

javafx html editor

好久不见. 提交于 2019-12-12 21:26:46
问题 actually i'm looking for something very similar to this thread: How to hide the controls of HTMLEditor? so basically i try to add a custom button to the javafx html editor but with the difference that it's implemented through FXML. So my question is: Is there a "work-around" to add custom buttons to the html-editor when it's implemented through FXML? 回答1: Here is some sample code which customizes the HTMLEditor and adds a custom button to it. The sample code does not use fxml but really it's

javafx fxml is null outside initialize()

拈花ヽ惹草 提交于 2019-12-12 10:16:42
问题 In this code: public class ESM extends Application { private Stage primaryStage; @FXML private ToolBar mainToolBar; @Override public void start(final Stage stage) throws Exception { try{ this.primaryStage = stage; Parent root = FXMLLoader.load(getClass().getResource("/nz/co/great_ape/esm3/main_window.fxml")); Scene scene = new Scene(root, 800, 700); // Setup main stage to be full screen, no min or max buttons. // TODO: How will this handle multiple screens? Apparently not well :-( Screen

JavaFX - MVC Application best practices with database

▼魔方 西西 提交于 2019-12-12 10:01:19
问题 I'm new to JavaFX and I was wondering what are the best practices in this language to develop a MVC database application, I think my question will be pretty simple if you are an senior developer. Let us consider a simple example of a basic application developed in JavaFX : a ToDoList linked with a SQL Database. The database is just one table Task with an id and a taskDescr VARCHAR field. The purpose is pretty easy : we just want to display the task in a TableView or ListView and be able to

How to hide the TabBar in TabPane?

北城以北 提交于 2019-12-12 09:37:50
问题 I am trying to build a Next/Previous windows using TabPane . I decided to use TabPane as it is easy to use and design in SceneBuilder . At the start fo the app, I used this to hide the TabBar for now- tabPane.setTabMinHeight(-10); tabPane.setTabMaxHeight(-10); The appearance of the TabPane after this- As you can see, there still remains a small part of TabBar (below the titlebar). How can I hide it completely so that my TabPane will look like just a normal Pane but with all its functionality

JavaFX CSS Button with Image - How to define the size of the image?

时光怂恿深爱的人放手 提交于 2019-12-12 08:29:34
问题 I am trying to insert an image in a button using JavaFX CSS. Although, I can do it easily using the "-fx-graphic" tag, I cannot find a way to resize the image in whatever size I want. I can do this through the following FXML code, where I give 30 to my preferred width of image, but I would like to do this with pure CSS. Is there any way to do that? FXML <Button text="Press Me"> <graphic> <ImageView fitWidth="30"> <image> <Image url="myImage.png"/> </image> </ImageView> </graphic> </Button>

JavaFX Switching BorderPane's Center: Buttons only work once

偶尔善良 提交于 2019-12-12 06:11:46
问题 I'm a tad confused with JavaFX at the minute. Basically, when I run my code, I can only click on a button on the side bar of the application once, then it will swap the center pane for the one that I want displayed. After that though, it appears that the ActionEvent does not trigger... I've tried reattaching them after handling but it doesn't work, and I have no idea whats wrong. I've spent 2 days trying to crack this, and I'm sure it's something so annoyingly simple. Controller: @FXML