javafx interview questions
Top javafx frequently asked interview questions
Are there any ways to debug javascript and html that is executed within a Javafx WebView? Something similar to Firebug or Chrome's developer console?
I have an application that renders fine in Firefox and Chrome, but does not render correctly inside a WebView. It really could be any number of things, but without some debugging tools I don't know how to track down the root cause.
Thanks.
Source: (StackOverflow)
I have an element with the ID history
type of TableView
. How can I find and access this object if I have the instance of Scene scene
?
Source: (StackOverflow)
I need to write a desktop app and its been a while since I started used Swing so will have a learning curve with either technology.
Are there any advantages in doing my app using JavaFX 2?
Source: (StackOverflow)
I have been doing some research on this but I am still VERY confused to say the least.
Can anyone give me a concrete example of when to use Task
and when to use Platform.runLater(Runnable);
? What exactly is the difference? Is there a golden rule to when to use any of these?
Also correct me if I'm wrong but aren't these two "Objects" a way of creating another thread inside the main thread in a GUI (used for updating the GUI)?
Source: (StackOverflow)
Is it possible to run JavaFX applications on iPhone/Android/Win8 mobile?
Can one develop an entire application on JavaFX and more or less deploy it as is, as a web-app if developed on JavaFX?
Source: (StackOverflow)
So, cutting my teeth on JavaFX, so far things are moving along fine.
However, all of the text fields have a line running across them, 10px or so from the top.
Not just in my application, but in the SceneBuilder application as well.
Note, I'm not using any explicit CSS, I don't know what SceneBuilder uses. The screen shot is from SceneBuilder, my screens look identical.
So, it's something fundamental.
java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
On Mac OS 10.9.5
Just curious if anyone else has seen this and has a suggestion.
Edit: I downloaded the samples, it's clearly something to do with the Modena theme. The Caspian theme looks just fine. Below is a screenshot from the Modena.jar TextFields section. It's interesting that the TextArea
suffers a similar issue, though not as universally as the TextField
.
More addenda:
Folks keep clamoring for this, so here it is. I essentially just followed this: https://docs.oracle.com/javafx/2/get_started/form.htm and use a default Netbeans 8.0.2 JavaFX Application project. Just cut and pasted it in from the website.
public class Fxlinetest extends Application {
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("JavaFX Welcome");
GridPane grid = new GridPane();
grid.setAlignment(Pos.CENTER);
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(25, 25, 25, 25));
Text scenetitle = new Text("Welcome");
scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
grid.add(scenetitle, 0, 0, 2, 1);
Label userName = new Label("User Name:");
grid.add(userName, 0, 1);
TextField userTextField = new TextField();
grid.add(userTextField, 1, 1);
Label pw = new Label("Password:");
grid.add(pw, 0, 2);
PasswordField pwBox = new PasswordField();
grid.add(pwBox, 1, 2);
Button btn = new Button("Sign in");
HBox hbBtn = new HBox(10);
hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
hbBtn.getChildren().add(btn);
grid.add(hbBtn, 1, 4);
final Text actiontarget = new Text();
grid.add(actiontarget, 1, 6);
Scene scene = new Scene(grid, 300, 275);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
Here's is a screen shot of the ThreeDOM view from ScenicView 8.6, notice the line:
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
Here's the sample screen using the Caspian theme via:
System.setProperty("javafx.userAgentStylesheetUrl", "caspian");
Source: (StackOverflow)
Is it possible to change the application icon using JavaFX, or does it have to be done using Swing?
Source: (StackOverflow)
I have a very big program that is currently using SWT
. The program can be run on both windows, mac and linux, and it is a big desktop application with many elements.
Now SWT being somewhat old I would like to switch to either Swing
or JavaFX
. And I would like to hear your thoughts on three things.
My main concern is what will be better for a desktop GUI application? (I looked online and a lot of people suggest that FX is just as good as Swing, but I didn't see many valid arguments except simple opinion flame wars). It has to work on both Windows, Mac and some popular linux distributions.
I am using MVC methology in my application, if that is of any help.
Source: (StackOverflow)
How can I pass parameters to a secondary window in javafx? Is there a way to communicate with the corresponding controller?
For example:
The user chooses a customer from a TableView
and a new window is opened, showing the customer's info.
Stage newStage = new Stage();
try
{
AnchorPane page = (AnchorPane) FXMLLoader.load(HectorGestion.class.getResource(fxmlResource));
Scene scene = new Scene(page);
newStage.setScene(scene);
newStage.setTitle(windowTitle);
newStage.setResizable(isResizable);
if(showRightAway)
{
newStage.show();
}
}
newStage
would be the new window. The problem is, I can't find a way to tell the controller where to look for the customer's info (by passing the id as parameter).
Any ideas?
Source: (StackOverflow)
I'm mostly a C# programmer, I stopped writing Java about 10 years ago, but I try to keep up with the technology in Java by reading articles, talking with friends, etc.
I've heard about the new rich GUI framework called JavaFX, but couldn't find any resource comparing it with non-Java parallels.
Since I'm very familiar with C# and WPF, I'd like to get a feel about how similar or different the two technologies are.
EDIT: Seeing as there's no answers coming, I'll try to be more specific:
- WPF uses XAML to create the visual tree, does JavaFX have something similar?
- WPF is best used with binding to a view model in an MVVM pattern, does JavaFX also make extensive use of binding?
- WPF utilizes the GPU for rendering, does JavaFX do the same?
- How does Silverlight compare to JavaFX when run through a browser on a net pc?
... More to come...
I'm changing this to community wiki so that the comparisons can keep getting updated (hopefully).
Source: (StackOverflow)
I am trying to find the elusive JavaFX scene builder so I can use it in Intellij. =I am on Windows OS.
Oracle have stated that the JavaFX scene builder is included in a new download, but no matter how I search I cannot find it (see http://www.oracle.com/technetwork/java/javafx/downloads/index.html). I think they have linked to the incorrect page and googling for it is getting me nowhere.
I already have Java 8 SDK installed and working fine. Apparently JavaFX is now included in that, but nowhere in the Java folder can I find the scene builder and it seems to be completely missing online.
Please can anyone help? I am just wanting to write a small GUI program and it seems like JavaFX is the way to go (if it isn't then feel free to disabuse me of this notion!)
Source: (StackOverflow)
I have this common issue, as it appears to be. My table view wont refresh my items after I reset them. I have checked the data and it's the new one.
I tried multiple solution from internet but no success.
Can't reset all the columns because it adds one empty one extra (dont know why) and the resize just breakes.
My table is not editable. The new data is changed.
The data is refreshed if I change the ordering of the items and the rows change (:|).
I'm just left without ideas.
At the moment the refresh code is pretty simple.
ObservableList<User> data = FXCollections.observableArrayList(User.getResellers());
reseller_table.setItems(data);
Again the new data is correct. When I make an selection to the tableView it returns the new correct Item.
Source: (StackOverflow)
I'm trying to decide whether I could switch to JavaFX for the user interface of my Java application. Most of my users would be using the Oracle JRE, which has JavaFX integrated these days. However, some are using OpenJDK (on linux). This (old) question suggests that OpenJDK deals very badly with JavaFX. According to this question, the alternative OpenJFX will only be fully integrated into OpenJDK in version 9. So my question is twofold:
- Is the JavaFX support in OpenJDK still so bad?
- If so, are there any Linux distributions that already offer an OpenJFX package so users wouldn't have to build it themselves?
Source: (StackOverflow)
For those of us learning JavaFX, what are the best resources you've found so far?
(One of the difficulties in finding good JavaFX resources is that things written before July 2008 are often no longer valid because of changes made to beta version of the language)
I've found:
What have you found that I might be missing?
Source: (StackOverflow)