javafx-8

JavaFX, ObservableList: How to fire an InvalidationListener whenever an object of the list gets modified?

*爱你&永不变心* 提交于 2019-12-04 19:59:10
Say I have a JavaFX app with an observable class SomeObservableClass with some Properties: public class SomeObservableClass{ private StringProperty prop1 = new SimpleStringProperty(); private DoubleProperty prop2 = new SimpleDoubleProperty(); ... constructors, getters and setters } and another class which has a property: public class ParentClass{ private ObservableList<SomeObservableClass> sOC = FXCollections.observableArrayList();` } In this parent class I add a listener for the observable list: ` public class ParentClass{ private ObservableList<SomeObservableClass> observableList =

JavaFX title bar RTL not supported?

别说谁变了你拦得住时间么 提交于 2019-12-04 19:27:01
I cant seem to find a way of making the title bar of my window be RTL. I can make the inner nodes RTL by changing the node orientation property, but not the title bar. So I get a really weird looking app where everything is RTL except the title bar. How can I fix this? You need to invoke setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT) on the scene before showing the stage primaryStage.show() : public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); primaryStage.setTitle(

How to work with canvas and text in javafx

流过昼夜 提交于 2019-12-04 18:40:42
I am new to JavaFX and I am trying to display a rational number. For example for the number 5/7 I want the program to show the following: Here is the code I've tried to use in order to get the result (but it shows nothing but a blank white pane): import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.stage.Stage; public class Main extends Application { Font

javafx adding button to grid pane

巧了我就是萌 提交于 2019-12-04 18:40:00
I am adding button to grid pane dynamically but after giving them function they all show same function and i don't knows why? import java.awt.Panel; import java.net.URL; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.layout.GridPane; public class TestController implements Initializable { @FXML Panel mpanel; @FXML GridPane gpnael; int x=0,y=0,i=0,y1=0; /** * Initializes the controller class. */ @Override public void initialize

JavaFX transparent window only receives mouse events over drawn pixels

无人久伴 提交于 2019-12-04 16:51:26
I'd like a Stage that is the same size as the screen which is fully transparent and receives mouse events anywhere. In the example below I get mouse events only when the mouse is over the circle. I see this issue on both Windows XP and Windows 7 using Java 8u11 import javafx.application.Application; import javafx.geometry.Rectangle2D; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Rectangle; import javafx.stage.Screen; import javafx.stage.Stage; import javafx.stage.StageStyle; public

Drag Nodes of TreeView

谁说我不能喝 提交于 2019-12-04 16:40:58
Using this example I want to create TreeView with Nodes that I can drag in order to change their position. import java.util.ArrayList; import java.util.List; import java.util.Random; import javafx.application.Application; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.TreeCell; import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem.TreeModificationEvent; import javafx.scene.control.TreeView; import javafx.scene.input.ClipboardContent; import javafx.scene.input.DataFormat; import javafx.scene.input.DragEvent; import javafx.scene

“unknown protocol: data” when using data URIs in IMG tags displayed by JavaFX WebView

亡梦爱人 提交于 2019-12-04 16:40:10
Apologies for the title, I tried to be concise, but it's hard to be in this case. I'm building an application that uses JavaFX's WebView class to display a list of SVG images. Because they need to fit into their parents' width (which can change), I was forced to use <img> tags with data URIs rather than inline <svg> (I won't go into detail on this problem here, but it's a flaw of the WebKit engine used by WebView which prevents <svg> elements from adjusting their height according to their width which works fine in current Firefox versions). Therefore, the innerHTML of the containing element

JavaFX printing non node objects

假如想象 提交于 2019-12-04 15:38:22
I want to print a PDFFile object from the Pdf-Renderer library using javafx printing. Is it possible to print non Node objects? Currently i'm using AWT printing ( check this example ) but it doesn't go well with javafx because my javafx window freezes when the AWT print dialog comes up. Printer printer = Printer.getDefaultPrinter(); PageLayout pageLayout = printer.createPageLayout(Paper.A4, PageOrientation.PORTRAIT, Printer.MarginType.DEFAULT); PrinterJob job = PrinterJob.createPrinterJob(); if (job != null) { boolean success = job.printPage(node); // use something otherthan a node(PDFFile in

Create a framework type column header for select all in JavaFX 8

心不动则不痛 提交于 2019-12-04 15:07:42
I am looking to create a custom TableColumn which is a CheckBox control which represents if the row is selected or not. We don't want to use the standard SHIFT or CONTROL + CLICK to handle this as users tend to click inadvertantly and lose their selection. What I would like to do is the following: In this case the column should not be part of the underlying data model, and simply represent what is selected or not. It shouldn't be dependent on the data model in any way. If the user selects the check box in the column header, it should select all the records in the table (not just the visible

Java FX 8 - Tableview Display Objects Within Objects

最后都变了- 提交于 2019-12-04 14:56:12
I'm trying to load a Tableview component from a list of Objects, in my case client objects. A client object contains an Address Object and Vice Versa. The Client and Address object are defined as follows; public class Client{ private String firstName; private String lastName; private String emailAddress; private String phoneNumber; private Address clientsAddress; public Client(){ //blah blah } //getters ... //setters ... } public class Address{ //address lines + county private String a1; private String a2; private String a3; private String county; private Client client; public Address(){ /