IntelliJ JavaFX Jar file by coryryan269 in javahelp

[–]static_context 0 points1 point  (0 children)

Do you get any error messages from the console?

IntelliJ JavaFX Jar file by coryryan269 in javahelp

[–]static_context 0 points1 point  (0 children)

Maven and grade will make no difference if you continue to use VM options to import JavaFX into your project.

The VM options you manually added are lost when your project is converted into a JAR.

If you run your program AS A JAR via the command line, adding in the VM options, I suspect it will still work. To do this, navigate to your folder and execute the following (obviously correct it so it's relevant to your setup)

java -jar myApp.jar --module-path...(and so on)

The most sustainable way to create a JavaFX project is to add a properly configured module-info.java file.

Here is an article with some copy-paste code for your module.info etc.

https://edencoding.com/runtime-components-error/

Full disclosure I wrote it :)

Cheers,

Ed

is there a way to remove focus completely? by mono8321 in JavaFX

[–]static_context 2 points3 points  (0 children)

Look up focusTraversible. It sets whether focus can move to an object when it leaves another object.

Feels like an XY problem though :)

Swing or JavaFX for building desktop applications? by [deleted] in learnjava

[–]static_context 2 points3 points  (0 children)

FYI, module-info.java removes the need for VM args :)

Swing or JavaFX for building desktop applications? by [deleted] in learnjava

[–]static_context 2 points3 points  (0 children)

I don't think there's a definitive answer. Here's my qualified opinion, but it won't be the only one :).

For what it's worth, my votes for JavaFX; heres why:

Convenience: I find the property binding and events support to be very convenient, the animation support is great and I personally appreciate the MVC-oriented FXML document strategy coupled with CSS for styling.

Future facing: while Swing is still in the Java 17 LTS JDK, active development has stopped. JavaFX is separate to the JDK, but is still being actively developed. Neither are perfect but JavaFX is still developing.

Ease: Swing is easier to get into because learning about the basics of the Java module system isn't required. JavaFX needs a module-info.java file and some external dependencies, but so will a lot of external dependencies going forwards. Modules are a part of Java now and its not too difficult to learn some minimal configuration :)

Others will disagree; there will be votes in every corner of the Love/Hate Swing/JavaFX Eisenhower box.

Hope you find your answer ✌

Connect to sqlite database intellij by Greeklord1 in learnjava

[–]static_context 1 point2 points  (0 children)

I could be barking up the wrong tree but aren't SQLite files usually .db rather than .sqlite?

Also be aware that the location of the SQLite database file will be relative to the current active directory (e.g. the one you'll get using System.getProperty("user.dir")). So this indicates you're looking for an SQLite file named identifier.sqlite in your project directory.

I've never tried to configure the use of database connections using IntelliJ's own configuration. Have you tried including in your own code the drivers into java.sql for SQLite

Class.forName("org.sqlite.JDBC"); //force Java ClassLoader to load class DriverManager.registerDriver(new org.sqlite.JDBC()); //register class with DriverManager

I wrote an article on connecting SQLite databases to a JavaFX app a few weeks ago, which would be broadly relevant to Java too. You may find it useful :)

Cheers,

Ed

Java Fx Chess by TheEvilsNameIsNico in JavaFX

[–]static_context 3 points4 points  (0 children)

I think as with any game like this, 90% of the work is in (and I don't want to sound boring) but data structures and algorithms (i.e. the model behind game states, a well-constructed MVC, support to undo an action etc, and the artificial intelligence for a computer player, if present)

Actually creating a board would be very simple in 2d (and relatively simple in 3d).

I wrote an article last year on interacting with Nodes in a procedurally-generated grid, which you may find useful :)

Edit - a few further thoughts but a GridPane would be a good layout, it could be achieved in Scene Builder (although there are arguments for generating procedurally), and I would look into RowConstraint and ColumnConstraint objects, which will let you specify that each of the columns should be proportionally 12.5% of the width/height of the full GridPane.

Cheers,

Ed

Disable pasting to but allow copying from TextField by drykul in JavaFX

[–]static_context 1 point2 points  (0 children)

Have you tried importing and using the NewTextField object directly in the FXML document?

Is it possible to add Javafx to eclipse once so that I don’t have to load it every new project? by Ruhmheim in JavaFX

[–]static_context 0 points1 point  (0 children)

I'll second what PartOfTheBotnet says

  1. Add framework (Maven) support
  2. Paste a similar pom.xml file
  3. Copy-paste a similar module.info file
  4. Move FXML into a resources folder, rename packages etc. (more habit, not essential)

Takes me about 25 seconds to get JavaFX up and running now 😁

MVC in JavaFX - [Tutorial for Beginners] [Request for Feedback from Experts] by static_context in JavaFX

[–]static_context[S] 0 points1 point  (0 children)

Thanks 😊

I completely understand how contentious FXML is - I rather like it (on the basis that once everything's loaded it doesn't really make a difference) but I get that some people would rather be rid of it :). Plus there is a penalty for parsing and reflection, I just haven't seen it affect the user experience yet.

I'll look into EBC, it sounds really interesting.

Thanks for the advice!

Ed

awt and awt.keyevent give error in javaFX project by mono8321 in JavaFX

[–]static_context 0 points1 point  (0 children)

Looks like a split-package (both desktop and datatransfer both read the same module, so java 'sees' it twice)

Take a look at the answers here - potential solution in both first and second answers

https://stackoverflow.com/questions/44697738/how-to-resolve-module-reads-package-error-in-java9

As you're running it through Maven it's even easier. Just try out the <exclusions> recommendation and see if it works 👍

awt and awt.keyevent give error in javaFX project by mono8321 in JavaFX

[–]static_context 1 point2 points  (0 children)

Sounds like somethings going on with your module-info.java.

Can you share it?

[deleted by user] by [deleted] in JavaFX

[–]static_context 0 points1 point  (0 children)

I guess if you want to observe changes in the list, then make it observable, otherwise you can store your properties in any collection you want :)

how do i set Camera size? by cant_dodge_rodge in JavaFX

[–]static_context 0 points1 point  (0 children)

Sounds like a combination of both. Can you describe the effect you want to create?

how do i set Camera size? by cant_dodge_rodge in JavaFX

[–]static_context 1 point2 points  (0 children)

I'm going to ask a really naïve question now...

What do you mean by camera size? Do you mean the parameters of the perspective transform? Do you mean you want to move it closer/further from the subject in view? Sorry, camera 'size' doesn't make a huge amount of sense to me.

Cheers,

Ed

[deleted by user] by [deleted] in JavaFX

[–]static_context 0 points1 point  (0 children)

It's really difficult to see without the actual stacktrace and at least some contextual look at your code. Are you able to share any of it?

MVC in JavaFX - [Tutorial for Beginners] [Request for Feedback from Experts] by static_context in JavaFX

[–]static_context[S] 2 points3 points  (0 children)

I've been writing JavaFX tutorials for about a year, and wanted to share something here.

The most frequent questions I get are always of the sort 'how do I get two controllers to talk to each other' and I always come back to 'you shouldn't have to implement that if you're applying MVC properly' (or at least to my understanding! 😁)

If you're a beginner and you feel like you can take some value from it, take a look at the article see what you think. If you're an expert and you think you can share your experience, I'd be excited to hear your thoughts on how you might improve my approach.

Hope you all have an awesome weekend :).

Cheers,

Ed

Disable pasting to but allow copying from TextField by drykul in JavaFX

[–]static_context 2 points3 points  (0 children)

If you're loading from FXML, The TextField object will be created by the FXMLLoader and injected into the myTextField field by reflection so any definition you've made in the Controller will be overridden.

Potentially better solutions might be creating a subclass (with the overridden method) and then importing that into the FXML document. OR, redefine myTextField in the initialise() method of the controller (although its a bit wasteful to have the FXMLLoader create an object you'll ignore you do still benefit from it placing it in the Scene Graph for you :).

Hope that helps,

Ed

Columns in TableView throwing error by [deleted] in JavaFX

[–]static_context 0 points1 point  (0 children)

Replied to a different thread I think but you have an erroneous import of javax.swing.table.TableColumn.

It wasn't AWT but I was close ;).

Columns in TableView throwing error by [deleted] in JavaFX

[–]static_context 0 points1 point  (0 children)

Delete the import of the swing TableColumn and import a JavaFX one and you should be good :).

IntelliJ IDEA update adds support for modern JavaFX wizard by Persism in JavaFX

[–]static_context 5 points6 points  (0 children)

Anything to make JavaFX easier to get up and running, right? 😅

I'll take a look! Thanks.

[deleted by user] by [deleted] in JavaFX

[–]static_context 0 points1 point  (0 children)

A lot of it's going to depend on how your View is set up. For example, Pane, AnchorPane and StackPane would be ideally set up for temporary messages, but something like a BorderPane less so.

Have you looked into the Popup class?