fxml

How to remove the expand effect on button clicked JavaFX?

我的梦境 提交于 2019-12-06 08:20:35
问题 How can I remove the small expand effect when I click on a JavaFX button? And also how can I make it work like an menu button (when I press it to remain in focused state untill I press another "menu" button). Is there a way to group nodes into the same focus? 回答1: Three questions for the price of one ;-) How can I remove the small expand effect when I click on a JavaFX button? When you click the button it has focus, when it has focus, it is surrounded by the focus ring, which makes it

JavaFX - MVC Application best practices with database

倾然丶 夕夏残阳落幕 提交于 2019-12-06 07:36:34
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 add some tasks. That's what our application looks like : ToDoList GUI I decided to split my code into

JavaFX Button with transparent background

ⅰ亾dé卋堺 提交于 2019-12-06 07:32:23
问题 I have some classical Button in JavaFX with a box containing some text. I need buttons without that box, just the text, and when I hover the button or click on the button with mouse, it shall change its color to different. 回答1: In JavaFX styling is done by using CSS. .button{ -fx-border-color: transparent; -fx-border-width: 0; -fx-background-radius: 0; -fx-background-color: transparent; -fx-font-family:"Segoe UI", Helvetica, Arial, sans-serif; -fx-font-size: 1em; /* 12 */ -fx-text-fill:

JavaFX 2.2 Modal window dialog *with* FXML

怎甘沉沦 提交于 2019-12-06 05:50:22
问题 I am trying to use the example provided by @jewelsea at this gist and I'm stuck because I'm using FXML. I have seen both of these posts: How to create a modal window in JavaFX 2.1 and this answer to JavaFX 2 modal window. Where I'm stuck is in the code by jewelsea, where it says: final WebView webView = new WebView(); webView.getEngine().load("http://docs.oracle.com/javafx/"); primaryStage.setScene(new Scene(webView)); Whereas, since I'm using FXML, I do this: FXMLLoader fxmlLoader = new

How to style a SVG using CSS in javaFX FXML

让人想犯罪 __ 提交于 2019-12-06 03:05:47
问题 I'm using SVG for an image in a button. But I'm not able to fill in color for it through CSS. Below is the code to render a button. <Button onAction="#closeApplication" > <graphic> <SVGPath content="M10,16 10,0 0,8z" styleClass="button‐icon‐shape" /> </graphic> </Button> here is the css .button-icon-shape SVGPath{ -fx-fill: red; } 回答1: here is how it worked. I had to style the button and use the class to style the svg in the button. <Button onAction="#closeApplication" styleClass="closeButton

Using FXML to Create ContextMenu within a Pane

谁说我不能喝 提交于 2019-12-06 00:28:46
问题 I've got a working example for defining a ContextMenu on a Pane in JavaFX FXML, but am not sure it is optimal. Currently, only JavaFX standard controls (e.g. Button, TextField) define a property for specifying a popup ContextMenu. Yet I wanted to have a popup menu appear anywhere in a Pane, in my case a VBox. I took the approach of extending VBox to support a context menu. It is a 'clunky' solution but works. Is there a better approach? Am I missing some fundamental concept? Here is my

Mixing Swing/FX: can't dispose a dialog from fxml controller

时光怂恿深爱的人放手 提交于 2019-12-05 21:56:59
The scenario: the top-level container is a Swing JDialog which has some fx content, including a fx button that triggers a dispose of the button. Disposing works a expected (dialog is hidden) when the button is created and configured with the appropriate eventHandler manually. The dialog is not disposed when the button is created/configure via fxml. The example below contains both a manually configured and a fxml loaded/bound button to see the different behaviour. Questions: anything wrong with the example? is there any difference in swing/fx interaction to be expected (manual vs. fxml)? how to

How to create tabs dynamically in JavaFX using FXML?

一曲冷凌霜 提交于 2019-12-05 21:30:00
How do you create a new tab using JavaFX/FXML? I've created a tabpane in my FXML but I want to click a button that causes a new tab to come up. Here is my FXML: <?import javafx.scene.effect.*?> <?import javafx.scene.text.*?> <?import javafx.scene.layout.*?> <?import java.lang.*?> <?import javafx.scene.control.*?> <BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller"> <top> <MenuBar BorderPane.alignment="CENTER"

set the content of an anchorPane with fxml file

戏子无情 提交于 2019-12-05 18:54:35
I use the accordion control. Depending on the titled pane, I need to load a fxml file into an anchorPane. So I have two parts: one for accordion and another one for anchorPane to display contents depending on click. @FXML private StackPane tmpPane; @FXML private void itemMembres(MouseEvent event) throws IOException { tmpPane.getChildren().add((Node)FXMLLoader.load(getClass().getResource("/view/test.fxml"))); } tmpPane is an anchorPane in the view. thanks samara I found the solution Create a node by loanding a fxml file Use setAll of AnchorPane @FXML private AnchorPane tmpPane @FXML private

get FXML file nodes using java code

被刻印的时光 ゝ 提交于 2019-12-05 18:12:26
How to get elements or nodes from FXML file using Java , I know the way by using initialization or by setting controller class in FxmL . But I need to do it without any controller. I want to access the nodes inside the fxml file using. My FXML COde: HBox fx:id="hbx" id="hbx" alignment="CENTER_RIGHT" prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER" My java Code System.out.println(par.lookupAll("hbx")); See my Code above, could you give me a hint? After loading the FXML file, you can use Node#lookup() : Node node = fxmlParentPane.lookup("#nodeId"); 来源: https://stackoverflow.com