javafx

How can I align items of Toolbar to the right in JavaFX [duplicate]

两盒软妹~` 提交于 2020-01-13 13:45:32
问题 This question already has answers here : How to right align a button in Java FX toolbar (3 answers) Closed 2 years ago . How can I align the items of a toolbar to the right?? All alignment settings seem to not work. I´m using the layout designer. Please help <BorderPane fx:controller="vmanager.ui.Controller" 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

Label not showing on mouse event JavaFx

半腔热情 提交于 2020-01-13 13:05:31
问题 I have a pie chart where i have added a mouse listener using this guide: Oracle guide to pie chart However when i run my program and click on the chart it doesnt do anything. I have tried to System.out.println(caption.getText()); and the text of the label is correct however the label is just not showing up. My code is as following: public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Imported Fruits"); stage.setWidth(500); stage.setHeight(500); ObservableList

JavaFX layout equivalent to GridLayout

不羁的心 提交于 2020-01-13 12:07:06
问题 I'm used to working with Swing to create GUIs but for a recent project I've chosen to switch to JavaFX. I'm having some trouble with recreating a certain layout I used to make using a GridLayout. I desire the following behavior: 2 columns that scale proportionally with the size of their parent that center their contents. Using Swing, I would make JPanel with a GridLayout (1 row, 2 columns) and add 2 JPanels with a BorderLayout, adding the actual content to those panels with the centered

JavaFX layout equivalent to GridLayout

ⅰ亾dé卋堺 提交于 2020-01-13 12:06:48
问题 I'm used to working with Swing to create GUIs but for a recent project I've chosen to switch to JavaFX. I'm having some trouble with recreating a certain layout I used to make using a GridLayout. I desire the following behavior: 2 columns that scale proportionally with the size of their parent that center their contents. Using Swing, I would make JPanel with a GridLayout (1 row, 2 columns) and add 2 JPanels with a BorderLayout, adding the actual content to those panels with the centered

JavaFX Coloring TableCell

老子叫甜甜 提交于 2020-01-13 11:25:49
问题 I need your help! I've got a Table with rows in it (Name, etc..) Now, I want to color a specific tableCells background when the Object, laying on this row has got a specific value. But i only get it to read the value of this cell. But i need to read the Object (in my code called TableListObject ) to know in wich color i need to color the cell. But this "color value" is not visible (has no column) in that row. Here is my code: for(TableColumn tc:tView.getColumns()) { if(tc.getId().equals("text

Remove insets in JavaFX TitledPane with CSS not working

蹲街弑〆低调 提交于 2020-01-13 11:06:13
问题 Based on a solution of James_D (How to set/remove insets in JavaFX TitledPane) that I've tried, it seems that removing insets from a JavaFX TitledPane through CSS does not work? It does update correctly in Scene Builder, but at runtime the insets remain unchanged. Even Scenic View 8.0 reports a padding of 9.6. FXML example: <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene

JavaFx image resizing

末鹿安然 提交于 2020-01-13 11:06:11
问题 I have a borderPane with a menu top,a grid left and an image in the center.I want the image to have the same size as the center of the border because now the image goes over my grid. I tried this: imageView.fitWidthProperty().bind(box.widthProperty()); where imageView is the name for my image and box is the BorderPane object.Thank you. 回答1: See JavaFX Feature Request RT-21337 Add ImageViewPane and MediaViewPane controls which contains a code attachment for a sample ImageViewPane

Remove insets in JavaFX TitledPane with CSS not working

萝らか妹 提交于 2020-01-13 11:05:09
问题 Based on a solution of James_D (How to set/remove insets in JavaFX TitledPane) that I've tried, it seems that removing insets from a JavaFX TitledPane through CSS does not work? It does update correctly in Scene Builder, but at runtime the insets remain unchanged. Even Scenic View 8.0 reports a padding of 9.6. FXML example: <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene

JavaFX OnDragDropped Not Registering

谁说我不能喝 提交于 2020-01-13 10:16:17
问题 I am trying to drag and drop labels on top of each other. I have a list of labels called starsAndBars, and every label has this called on it as it is created: private void giveDragAndDropProperties(Label label) { //Enable drag actions to pick up the label label.setOnDragDetected(new EventHandler<MouseEvent>() { public void handle(MouseEvent event) { System.out.println("Drag and drop started!"); Dragboard db = label.startDragAndDrop(TransferMode.ANY); ClipboardContent content = new

how do I get an element in JavaFx using an id?

醉酒当歌 提交于 2020-01-13 09:17:08
问题 I am new to FXML and I am trying to create a handler for all of the button clicks using a switch . However, in order to do so, I need to get the elements using and id. I have tried the following but for some reason (maybe because I am doing it in the controller class and not on the main) I get a stack overflow exception. public class ViewController { public Button exitBtn; public ViewController() throws IOException { Parent root = FXMLLoader.load(getClass().getResource("mainWindow.fxml"));