javafx

How to seperate logic from controller JavaFx

吃可爱长大的小学妹 提交于 2020-01-17 07:07:08
问题 I've got an issue with seperating business logic from controller (apart from that how i'm validating data in my program). Here is logic class: public class LogInMechanism { LogInController logInController = new LogInController(); private static int howManyAttempts=0; public void logIn() { howManyAttempts++; if(howManyAttempts <3) { if(logInController.getLogInField().getText().equals("nick") && logInController.getPasswordField().getText().equals("password")) { System.out.println("Button

Javafx - how to modify components in fxml file after loading it

醉酒当歌 提交于 2020-01-17 05:54:26
问题 I am a novice to javafx. I created a simple javafx fxml application. I defined a treeView in my fxml file. It is as follows, FXMLDocument.fxml <AnchorPane id="AnchorPane" prefHeight="200.0" prefWidth="320.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="scenebuilderfirst.FXMLDocumentController"> <children> <TreeView id="" fx:id="tree" layoutX="60.0" layoutY="14.0" prefHeight="172.0" prefWidth="200.0" /> </children> </AnchorPane> and created the

Add/Remove by mouse click

牧云@^-^@ 提交于 2020-01-17 05:37:07
问题 I wrote this program which enables the user to add and remove circles in a rectangle, It adds when the user left clicked and removed when he/she right clicked, although its adding works correctly but its removing doesn't work good, for example: when I add four circles and try to remove all of them, some of them doesn't remove and I don't know why,and I'm confused. help please. public class BoundingRectangle extends Application { @Override public void start(Stage primaryStage) { Pane pane =

Accessing the column and row index of GridPane in JavaFX keeps returning null

爷,独闯天下 提交于 2020-01-17 05:33:13
问题 Hi so I have tried many solutions online on how to get the Node(cell) that was clicked on in the Gridpane. The method I went with for getting the node is shown below. I have also tried iterating through all the nodes prior to this method. I have built the gridpane with scenebuilder and as you can see in the picture below the columns and row are clearly there. I am trying this solution How to get GridPane Row and Column IDs on Mouse Entered in each cell of Grid in JavaFX? however as I've

Can't get Image from ImageView in JavaFX

无人久伴 提交于 2020-01-17 05:18:08
问题 I am writing an application in JavaFX which makes amendments to a picture at the click of a button. So I have an ImageView and I have to extract the image from it, apply some changes and set it back. However, when I show an image which I get from the ImageView, it appears to be blank, just black screen. I wrote some test code, which represents that strange behavior. public class Corrector extends Application { @Override public void start(Stage stage) { try { javafx.scene.image.ImageView

TextField/Component Validation with Controls FX

微笑、不失礼 提交于 2020-01-17 04:51:30
问题 I'm trying to implement a textfield like this one : TextField Validation http://imageshack.com/a/img537/8329/FSht8P.png My goal is to identify if the text of the TextField is a Double or something else (then it appears in red). I want to use ControlsFX to learn the library and to not edit the css, but it doesn't work very well, and I'm lost in the javadoc. Does anyone have an example or can help me improve my code ? Here what I tried to do : Validator<Double> checkTextField = new Validator

setOnEditCommit with Iteration JavaFX

痴心易碎 提交于 2020-01-17 04:45:05
问题 Im a pure newbie. I made my table by adding the columns from database with iteration: public void captureDataSuper() { Connection c; ObservableList<ObservableList> data; data = FXCollections.observableArrayList(); try { c = KonekDB.createConnection(); //SQL FOR SELECTING ALL OF CUSTOMER String SQL = "SELECT * from adminsupervisor"; //ResultSet ResultSet rs = c.createStatement().executeQuery(SQL); /** * ******************************** * TABLE COLUMN ADDED DYNAMICALLY * ***********************

Placing text in a circle in javafx

我们两清 提交于 2020-01-17 04:44:12
问题 I am currently attempting to create a series of characters in a circle within an application of Java. Essentially, the phrase "Welcome to Java" will be placed in a circle, starting at the far right with W. As characters move down the circle, they are rotated in a fashion such that the bottoms of the letters are facing inwards, in order to form a circle. My code seems to rotate the characters appropriately, but they will not appear anywhere other than the center of the pane. So my question is:

JavaFX font face dialog in Clojure

被刻印的时光 ゝ 提交于 2020-01-17 04:12:47
问题 I'm building a Clojure program that includes an option dialog where the user can select the font used in an editor. Just like many other programs, I would like to present the user with a ComboBox where the dropdown list displays the font names in the font itself (e.g. 'Calibri' is displayed in the Calibri font, 'Arial' is displayed in Arial, and so on.) In the past in Java, I have used a cell factory to customize the appearance of each cell in the list. My translation into Clojure is not

JavaFX Printable to Image very pix-elated, but perfect to printer

梦想与她 提交于 2020-01-17 03:56:05
问题 I have a printable object that prints perfectly fine to a printer, but when i print it to an Image, then it is very pixelated? Here is my code to setup a printer for printing and to an image private PageFormat setupPrinter() { // sizing (standard is 72dpi, so multiple inches by this) Double height = 4d * 72d; Double width = 3d * 72d; Double margin = 0.1d * 72d; // now lets print it AttributeSet attributes = new HashAttributeSet(); attributes.add(new Copies(1)); PrinterJob printJob =