javafx

How do I make a class in JavaFX 2.0 a usable Node?

喜你入骨 提交于 2020-01-15 04:36:42
问题 I am new to JavaFX so please don't hesitate to explain basic concepts. I am able to create a simple GUI and I have a TabPane with two tabs in my program. My question is how do I create a class that can be used as a node? For example, tab.setContent(stuff) would add stuff to a tab , tab assuming of course that stuff is a Node . So let's say I create a class called Clock and want to add an instance of it to tab , how do I do such a thing? The clock should be a graphical object. I'm new to

JavaFX Show a pane on Mouse hover

半腔热情 提交于 2020-01-15 04:02:31
问题 I have a JavaFX application where i want to show a pane on mousehover event on a Button , The output i am expecting is similar to windows taskbar preview style, where on hovering the TaskBar icons a preview pane is shown on top. (like below) how can i achieve this effect using JavaFX. 回答1: Code is very raw but gets the core feature you asked for (of course it can be achived in more than one way, depening on needs, I've just published the solution which was the fastest to implement for me)

JavaFX on Raspberry PI: Error loading stock shader

孤街醉人 提交于 2020-01-15 03:35:28
问题 Am currently trying to deploy my JavaFX application which runs smoothly on windows, on my Raspberry Model B+ v1.2. Since JavaFX is not directly available on the Raspi I've performed the adaptions with Gluon as described here (however with the newest version 144): Running Javafx GUI on the Raspberry Pi Now when I run my JFX application which is just going to show a simple window, I get the following error stack about problem with shaders (Error loading stock shader AlphaTexture_Color): Program

Missing JavaFX application class sample.Main

心不动则不痛 提交于 2020-01-15 03:32:11
问题 My JavaFx project is working properly in intellij idea. In edit configurations, I have chosen the main class as sample.Main and when clicking the run button of intellij idea, project works properly. Then I have converted my JavaFX project to a .jar file using build artifacts. But when trying to run .jar by using java -jar project.jar , there is an error "Missing JavaFX application class sample.Main". I have used same class in both occasions. So why does it output error while running .jar? 回答1

Populating textfields with tableview data when a line is clicked

…衆ロ難τιáo~ 提交于 2020-01-15 03:20:06
问题 I want to use the data that I load in the tableview to populate some textfields. Is there a way to make a OnMouseClick action event that will populate a bunch of textfields with the data from the tableview? I want this because I want to make an update method, in which you don't have to write the whole service details(like price, department, availability, and name) again just to change one particular thing, but this is not an issue, I know how to do it, just need to auto populate the

How to create JavaFX Transition with Equally-Timed Elements?

别说谁变了你拦得住时间么 提交于 2020-01-15 02:47:09
问题 I'm experimenting with JavaFX and animations, especially PathTransition . I'm creating a simple program that makes a ball "bounce," without using the QuadCurveTo class. Here is my code so far: Ellipse ball = new Ellipse(375, 250, 10, 10); root.getChildren().add(ball); Path path = new Path(); path.getElements().add(new MoveTo(375, 500)); int posX = 375; int posY = 500; int changeX = 10; int changeY = 50; int gravity = 10; // approximate in m/s^2 int sec = 0; for(; posY<=500; sec++, posX-

JAVAFX Make dynamic textArea size

送分小仙女□ 提交于 2020-01-15 02:42:47
问题 I'm making chat application using JAVAFX. The messages displayed in textArea, but the textArea always in the same size. How can I make the textArea to fit exactly to the amount of text? TNX 回答1: The following code does exactly what You wants public class Main extends Application { @Override public void start(Stage primaryStage) { try { AnchorPane root = new AnchorPane(); Scene scene = new Scene(root,400,400); scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm(

JAVAFX Make dynamic textArea size

梦想的初衷 提交于 2020-01-15 02:41:05
问题 I'm making chat application using JAVAFX. The messages displayed in textArea, but the textArea always in the same size. How can I make the textArea to fit exactly to the amount of text? TNX 回答1: The following code does exactly what You wants public class Main extends Application { @Override public void start(Stage primaryStage) { try { AnchorPane root = new AnchorPane(); Scene scene = new Scene(root,400,400); scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm(

Why does the compiler generate unchecked warnings when using TableColumn<S, T> rather than TableColumn<S, ?> to select a cell in a JavaFX8 TableView?

≯℡__Kan透↙ 提交于 2020-01-15 01:49:08
问题 A relative Java newbie question. I'm cleaning up my code and came across two unchecked warnings (" unchecked method invocation " and " unchecked conversion ") while programmatically selecting a cell in a TableView . I was able to resolve the warnings but don't understand what caused them. This was how I initially coded the select() : TablePosition<?, ?> previousPos; //... table.getSelectionModel().select (previousPos.getRow(), previousPos.getTableColumn()); and I resolved the warnings by

How do I start again an external JavaFX program? Launch prevents this, even if the JavaFX program ended with Platform.Exit

坚强是说给别人听的谎言 提交于 2020-01-14 22:54:21
问题 From my MainProject (Java 8) i starts a JavaFX 8 Class. public void startFX() { if (isRestartPrintModul() == true) { fxMain.init(); } else { setRestartPrintModul(true); fxMain.main(new String[] {"ohne"}); } } This is my FXMain: package quality; import javafx.application.Application; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.stage.Modality; import javafx