Java Community | Help. Code. Learn.

JCH

Java Community | Help. Code. Learn.

We are a Community full of Java developers. You can come here to connect other devs, get help, help others and do many more things!

Join

java-help

❓︱qotw-answers

How do you test GUI on a modern JavaFX application?

Hello, I was wondering how you are currently testing your moderns JavaFX applications. I am currently writing a JavaFX app with JavaFX 21 and Java 21. The build tool I am using is Gradle 8.x I have successfuly deployed JUnit 5.x for unit tests but I am struggling to put up something for GUI testing. I saw TestFX but the project seem quite abandoned and even the docs for setting it up is not up to date. ...

JavaFX UI won't update

```java public class BoardView extends GridPane { private final BoardPresenter presenter; private final SelectorView selector;...

Project Feedback

I would like to clarify, I am asking for feedback not help with my final project :get_gunned: . So I am not so new to java, I have had the opportunity to learn it before but I'm not so good at the OOP stuff. So straight to the problem, I have a project I had to build for my OOP Class finals, the project is FINISHED, but I think I need some feedback to improve my code etc. and since this project is for my OOP Class finals, I hope everything I did here so far counts as proper oop. So the project is a simple cli quiz program built with gradle that reads a txt file to get the questions from. there are 2 types of quizes, multiple choice and true or false. here is the link: https://github.com/alvinskylers/oop-finals.git...

Generate table images

hey, im trying to create table image of scorecard data, i used jswing to turn my HTML table into an image, but it's kinda slow – takes like 4-6 seconds any ideas on how to speed this up/ alternative method ? Would be a big help!
No description

How to properly implement scrolling a distance e.g with robot.mouseWheel()?

Hi, I am trying to recreate mouse scrolling behavior, but my current approach is only to set the amount of wheel turns with done with the wheel (using Robot). As far as I know it's dependent on the mouse settings given by the OS, that states what a notch turn does. However, does somebody know if it's possible to recreate behavior, that scrolls a certain amount of pixels? I need a fairly precise scroll where I can set the distance and I'm not sure how to achieve that. Hope my explanation was sufficient, any help is appreciated!...

Minecraft Client

So i am making a minecraft client in eclipse and im running into this problem when i run it: [18:43:28] [Client thread/INFO]: Setting user: Player296 [18:43:28] [Client thread/INFO]: (Session ID is token:0:Player296) [18:43:29] [Client Shutdown Thread/INFO]: Stopping server does anyone know how to fix it?...

JUnit succeeds when run as "debug as junit test" but fails as "debug as gradle test".

I'm doing a simple hibernate test and the code all works fine when run from Eclipse normally as well as when I create a junit to test it. But I'm now trying to run as ./gradlew test (from bash or within eclipse) and I'm having a problem with: em.persist(jazz); causing:...

how to stub the method which is being called inside the constructor?

for a class im testing, it has parameterized constructor and in that there is a method being called, i tried to stub using doReturn().when.class.function but it doesnt stub it, the function always gets ran. So to stub these kind of functions is there any other way

in java how to use Spy for a class with no no-arg constructor

when i use @Spy annotation i get this error,
org.mockito.exceptions.base.MockitoException: Unable to initialize @Spy annotated field 'videoTranscriptService'.
Please ensure that the type 'VideoTranscriptService' has a no-arg constructor.
org.mockito.exceptions.base.MockitoException: Unable to initialize @Spy annotated field 'videoTranscriptService'.
Please ensure that the type 'VideoTranscriptService' has a no-arg constructor.
...

How long should it take at minimum for a person to learn this much for incoming semester exams ?

Following are the list of topics: 1. First Programming steps with Karel(methods, loops, conditions and first software engineering principles) and Top-down approach 2. Graphics Programming, classes of ACM Library, how to use objects...

mvn dependency:tree skips an transitive dependency

I have a problem according to maven. I have a module A, B and C. For legal reasons I am not allowed to tell the real names. Module A has a dependency to module B, module B has a dependency to module C. They are configured this way in the poms correctly. For some reason, if I call dependency:tree to the modul A, the module B is listed but the module C is not listed. Module A,B and C are in scope compile. They are of packaging "jar". The local repository is fresh. The group-ids for all modules are "x". The version for all modules is "1". Maybe exclusions are made, but I do not know where....

Use Case Diagram Question:

1. A customer uses a drink in the following way: he puts a coin in the drink collector parts, he selects the drink, he collects the chosen drink from the drinks tray and excess change in the change trap. Who is the actor in the system? Is it the drink, the coin collector, the customer, the drinks bin or the coin trap? ...

how do i unit test singleton classes in java?

specifically using mockito and junit

unit4

does someone know how can I download and use unit4 (node) in vscode?

Guice with empty Module

I'm learning Guice and I have working code, but my Module (extending AbstractModule) is empty (because I'm injecting a class not an interface). I can see that there's no overload of Guice.createInjector() which takes no params. Is there some way of not needing a module in my scenario? Not sure if: 1) it's not a big deal; you might add bindings to it later 2) using Guice with an empty module is an anti-pattern - always use interfaces (but I don't think that's correct) 3) I'm missing something....

make github actions build artifact public

https://github.com/asdru22/Game2D/actions/runs/12453995171 i have a jar that is built that i can download. however, only i can download it. how can i change it so that anyone can download it?...

build javaFX jar from github via maven

maven.yml: ```yml This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven ...

How would I hide a specific Character in a ListArray

Basically, i'm making a simple terminal file editor, which has basic syntax highlighting. I'm facing an issue where the character used for the 'cursor' (which is controlled by arrow keys) is fucking up the syntax highlighting. I use 2 variables which store its location (currentLine, and currentColumn), so how would I hide it or something off the syntax highlighting function? Code: ```java...