I'm configuring the style of my form that I want to change its background color, in the JavaFX CSS section there was 2 textfield; one for the tag(eg. -fx-border-color) and the other is the value in it. Everytime after I inputted the first textfield I began to switch to the value textfield but the scene builder suddenly freezes. I checked it on my task manager but I found it that it doesn't consume cpu and its instance is still there. What could be the problem?
I had the same issue of the Scene Builder freezing when adding a Tab element to a TabPane etc, and first Running the SceneBuilder application as an Administrator and manually opening the the .fxml file from the Scene Builder has solved this issue. This might not be a permanent fix, but it will be a temporary workaround.
I created a window in JavaFX Scene Builder and costumized the look via CSS. It works fine but the settings for the combobox doesnt apply for the whole box.
How do I correct this?
I am creating a text editor using the gluon scene builder with java fx. The scene builder version is SceneBuilder-10.0.0 used with java version "10.0.1". I have a project to build a Text Editor. While building the components in the scene builder, under the File menu, I have the following menu items: New, Open, Save, Save As, and Close. I am trying to set the shortcut keys in the scene builder itself. There is an option to set the accelerator (under the Inspector Panel, in Properties) with a key. However, when I am setting it for the new menu item (and other menu items), it is set as this ignore ALT+N (Please click on the link to see the image) which makes the short cut key in the text editor to only "N" and not "ALT+N". I tried to code it in the controller class also with setAccelerator(), still it gives me similar results. I even donwloaded a fresh version of the scene builder and still does not work as expected. How can I get the short cut key to be as:
New ALT+N
under the new menu item, instead of the current:
New N
I am trying to make a button with a graphic only, and Scene Builder won't let me clear the text in the button. It automatically reverts to "Button" for some reason. Is there a way to make this stop?
Seems to work fine with JavaFX Scene Builder 8.3.0:
Display a swings JDialog containing a JRViewer for Jasper Report, from within a javafx application menu item click. BUT the JDialog is not MODAL even after setModal(true) as it is not owned by javafx stage. How to make a javafx stage the owner of a JDialog? Alternatively how to display a Jasper report inside a javafx stage, scene?
Don't use a JDialog. In JavaFX you use Stages. Put your Jasper report inside a Scene, put the Scene in a Stage. I think you can't put Swing components inside JavaFX components, so you must check this link: Integrating JavaFX into Swing Applications
Code to make a JavaFX dialog:
Stage stage = new Stage();
stage.setTitle("Title");
stage.setResizable(false);
stage.initModality(Modality.APPLICATION_MODAL);
stage.initOwner(primaryStage);
stage.initStyle(StageStyle.UTILITY);
(...)
Scene scene = new Scene(...);
stage.setScene(scene);
In the code above the Stage will behave exactly like a dialog.
Also check this:
How to create a JavaFX dialog?
Hello World, JavaFX Style
Back to the first (base) question: It's not possible to make a Stage the owner of a JDialog. But, after setting the content of the SwingNode
swingNode.setContent(xxx);
you can get the parent of xxx (may be the parent of the parent of xxx too...) until you find a (AWT-) Frame or (AWT-) Dialog. In the case of SwingNode it's a JLightweightFrame. This object you can use as the owner to create your JDialog.
But, I think there is a bug in the JavaFX SwingNode mechanism. The JDialog appears functionally modal, if you set it modal (setModal(true)), but it may appear behind the main (JavaFX) window. It's still possible to move the main window, to bring it in front and so on, what should not be possible if there is a modal dialog. But this is another topic.
To view a Jasper Report in javafx ( jdk 1.8> ) stage
JasperPrint jp = JasperFillManager.fillReport(reportsource, params,getCon());
SwingNode swingNode = new SwingNode();
swingNode.setContent(new JRViewer(jp));
AnchorPane anchorPane = new AnchorPane();
AnchorPane.setTopAnchor(swingNode,0.0);
AnchorPane.setBottomAnchor(swingNode,0.0);
AnchorPane.setLeftAnchor(swingNode,0.0);
AnchorPane.setRightAnchor(swingNode,0.0);
anchorPane.getChildren().add(swingNode);
Scene scene = new Scene(anchorPane);
Stage stage = new Stage();
stage.setHeight(550);
stage.setWidth(600);
stage.setAlwaysOnTop(true);
stage.setScene(scene);
stage.showAndWait();
Alternatively how to display a Jasper report inside a javafx stage, scene?
Output HTML from your Jasper report and load the report in a JavaFX WebView.
Make a javafx stage the owner of a JDialog?
I don't think this is possible. What should work instead is to make your application a Swing application and host your JavaFX content inside a JFXPanel inside a Swing JFrame. Then you have no Stage and the owner of the JDialog can be the JFrame hosting the JFXPanel.
now it's possible to do that
what you need now is install jdk 8
because swing content in javafx is introduced in jdk8
#FXML
private SwingNode swingNode;
...
JasperPrint jasperPrint = JasperFillManager.fillReport(FileName, hash, connect);
swingNode.setContent(new JRViewer(jasperPrint));
oracle just add tutorial for this too
for the next you can follow this link
oracle tutorial embed swing in javaFX
I have written a JasperReports print preview stage class in JavaFX 8. It is a pure JavaFX code and there is no need for use of SwingNode class.
In comparison to the JRViewer it does not support links and parts, but print preview window does not need it anyway. On the other side, code is much, much shorter and therefore it is easy to understand and to adopt further to everyone's needs.
Source code for this class is freely available at GitHub repository.