javafx-8

JavaFX 3D PerspectiveCamera affects drag position of a node

こ雲淡風輕ζ 提交于 2019-12-24 20:17:12
问题 I have been having issues trying to move nodes in JavaFX within a 3D Scene. The issue is that I want the mouse to stay at the position within the node I've clicked, i.e., center. With a PerspectiveCamera it will alter the position. I've tried a couple of different methods and haven't had any luck. 2D Rectangles, and 3D Boxes(without a camera) work perfectly, but once a PerspectiveCamera is added, regardless of true/false parameter, I have issues. I am wondering if this a bug that should be

How to hide full screen button of Mac OS window (in JavaFX)?

风流意气都作罢 提交于 2019-12-24 19:28:58
问题 Every window title bar of Mac OS has a full screen button at the top-right corner.Is there any way to hide this default full screen button of Mac OS in JavaFX? Here is my code snippet: public static void launchOkMessageBox(){ pane = new VBox(); scene = new Scene(pane,150,60, Color.GHOSTWHITE); Label label = new Label("Hello Word"); Button okButton = new Button("Ok"); pane.getChildren().add(label); pane.getChildren().add(okButton); pane.setAlignment(Pos.CENTER); pane.setSpacing(10);

JavaFx: show DatePicker

巧了我就是萌 提交于 2019-12-24 19:17:10
问题 I have a ComboBox<MyItem> and I want to show a DatePicker when I select a special item from the ComboBox . I created a class that extends ComboBox, and I have a DatePicker in that class. I have added a listener to its selectedItemProperty : public class CustomComboBox extends ComboBox<MyItem>{ private DatePicker datePicker; public CustomComboBox(){ getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { if (MyItem.DATE.equals(newValue)) { initDatePicker();

JavaFx optional parameters for controller class in start method when it is loaded into the FXML

跟風遠走 提交于 2019-12-24 19:00:23
问题 with the ScheneBuilder I defined the controller class of my fxml, the code genereted inside my AnchorPane tag is: fx:controller="demo.SplashController" now I would like if I had args in the main, to load a new version of the controller, using the appropriate construct. I try this code in the Application.start: FXMLLoader loader = new FXMLLoader(getClass().getResource("page.fxml")); PageController controller; if(!dir.equals("")){ //attribute coming from args controller = new PageController(dir

Exception in Application start method java.lang.reflect.InvocationTargetException JavaFX image transition

徘徊边缘 提交于 2019-12-24 18:31:25
问题 When i try to add image transition for my JavaFX app, it has thrown this error,I checked the previous questions and answers here in Stackoverflow, but all the solutions were specific for each of those questions only.I am using netbeans IDE. Executing H:\thirdf\FinalF\dist\run2135548605\FinalF.jar using platform C:\Program Files\Java\jdk1.8.0_101\jre/bin/java Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native

How can I get the keyboard Caps Lock state in javafx

烈酒焚心 提交于 2019-12-24 17:01:34
问题 In my project, how to keyboard caps lock on state. i have refer this question How can I get the Caps Lock state, and set it to on, if it isn't already?. but i am get solution in javafx. please give me solution.I am also ref for this site https://community.oracle.com/thread/2415027?tstart=0 回答1: You will want this import: import java.awt.Toolkit; If you are wanting it on no matter what, just turn it on with: Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true); If you

Using POJOs as model layer in JavaFX application

旧巷老猫 提交于 2019-12-24 16:31:20
问题 I'm creating simple JavaFX application. I want my model layer to be completely independent from JavaFX - no StringProperty , IntegerProperty and etc. as fields. I want it to be POJO. Main reason to do so is that I want it to be Serializable. I've created DataRepository - simple CRUD-like interface and some implementations of it, so I can at anytime change where I store my data - XML file, SQLite database or anything else. I also have to somehow connect my data storage with JavaFX (to display

Safely close/remove file for ImageView in JavaFX

流过昼夜 提交于 2019-12-24 15:16:40
问题 I have a JavaFX application which displays all images from a certain folder in a VBox. The VBox is built like this: try (DirectoryStream<Path> stream = Files.newDirectoryStream(imagePath)) { for (Path file : stream) { String fileNameLc = file.toString().toLowerCase(); if (fileNameLc.matches(".*\\.(jpg|png)")) { ImageView graph = new ImageView(new Image(Files.newInputStream(file))); graph.setPreserveRatio(true); imageVBox.getChildren().add(graph); } } } catch (IOException ex) { // } There also

JavaFX 8 Spinner control doesn't update value that's displayed

蹲街弑〆低调 提交于 2019-12-24 14:41:35
问题 I am new to Java programming and opted for developing my tool UI in JavaFX8. I need to have a Spinner (new in JavaFX8u40!) for which the user can specify a integer value from 0 to 120 seconds (the easy part) but also a button which allows the user to set the spinner value directly to the given pre-set button value (here, 0). Trouble is that when I click the button to test it, the spinner value doesn't seem to update and remains at 60 (spinner initial value) or any other value that may have

TextArea setScrollTop

喜你入骨 提交于 2019-12-24 13:52:08
问题 I created this simple example of TextArea import javafx.application.Application; import static javafx.application.Application.launch; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.TextArea; import javafx.scene.layout.HBox; import javafx.stage.Stage; public class MainApp extends Application { @Override public void start(Stage stage) throws Exception { HBox hbox = new HBox(); // Text Area TextArea dataPane = new TextArea();