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

Changing Colors And Hues

Can I, In Java, Change the color of a picture to a specific color of another picture? like I got two pictures, one in orange and one got blue and brown, I want to change the hues of the blue and brown picture to make the dominated color of the orange picture its color. Like A Sword From A Game, I want to change the color of that blue sword to orange and generate the png

Guidance for multithreading

I've recently completely core Java course, worked on a few small projects with Java and jdbc. And now completed multithreading, and understood most of the concepts how to use but: when to use this concept, when to create threads and apply all other things. how does using this thing make my project easy....

How to improve my quality of given code?

import java.util.Scanner; class WordSearch{ public static void main(String[]args) { Scanner value=new Scanner(System.in);...

Query: Understanding `CompletableFuture.anyOf()` Behavior — First Valid or Fastest Response?

Context: In a task to validate element usage across multiple microservices (MSAs) before deletion, I use parallel API calls with CompletableFuture to speed up the process. I need to return as soon as I receive the first confirmation that the element is in use, but I’m unclear about the behavior of CompletableFuture.anyOf(). Refer to attached file for details. ...

How do I align placement of these circles with mouse click after zooming.

I have the zoom toward mouse click working, but when I try to place circles after zoom, the placement is misaligned. The screenshots show me zooming and trying to place circle in the same pattern, but the circle being rendered in a different position then mouse click placement. Thanks so much for any help....
No description

Need help with padding(i think?)

My program uses string.format to print a table out line by line from a file, which works fine, but it doesn't line up well I tried to fix this by making the end of each column add spaces onto the end, so that they would all be the same length - however I cant figure out how The closest ive gotten is by using 0 padding, but #1 this only works with integers, and two this only seems to work on the left side...

Naming convention question

I have a quick question on naming convention for an object that is the same structure (same fields, etc..) for a response and request object. Should I call it ObjectRequestResponse or just Object or just ObjectResponse? I'm wondering if any of them are better?

im trying to figure out why the key input work randomly,

``` random = new Random(); this.score = score; this.borderHeight = borderHeight; this.borderWidth = borderWidth;...

Shapes drag and drop

Hii, does anybody know how I can make those shapes on GUI? My program must allow users to create a flowchart, but I've never worked with shapes or drag and drop and I've been looking for videos or resources and I'm confused 😭 any help will be greatly appreciated 🙏...
No description

How do I run sql scripts in yaml docker?

I have automation task where I want to initialise table ,data in Spring . I have made the sql scripts in a single sql file but it's not executing the scripts . I found answer jn stackoverflow but it's not working in java 21 . ...

Excluding Gradle plugin dependencies in submodules

I have two different gradle plugins, one in the root project, and another in a submodule. The thing is, I'm getting a reflection related stacktrace when loading the Gradle project which originates from a dependency (I think it was something like Jackson faster xml or something). Removing said plugin in the root project fixes this issue. My conclusion from that is that the plugin in the root project has a different version of that dependency than the one used by the plugin in the submodule. How do I exclude plugin dependencies in submodules? (Sorry for minimal information on that stacktrace, I'm traveling at the moment)...

why cant i make requests to my endpoint?

hey guys. in java spring i have endpoint localhost:8080/sol/payments. and i want to call it with Postman. my body is: ``` { "transactionId": "111", "clientId": "111",...

Looking for a right partner

Time is our most valuable asset, yet so many hours are lost—whether in sleep, unproductive moments, or distractions without progress. Yes, enjoyment is important, but once you reach your goals, you’ll have endless ways to enjoy life. Playing isn’t the only way to find fulfillment. Your current income might be enough for living, but with the right mindset, you can achieve so much more. Don’t doubt your abilities—your potential is limitless....

ClassNotFound: When using VirtualMachine.loadAgent

Hello im trying to dynamically load an agent with virtual machine but when I load on a non custom class loader jvm it works but when I load on a custom one it throws a ClassNotFound and my agentmain is not called is there a way to load the agent on the custom class loader or not

cant figure out how to setup vscode with javafx

I've created a java project and added the lib files from javafx on the project settings, still getting package does not exist, am I forgetting something?

Is anyone using testcontainers for tests?

Is anyone using testcontainers for tests? If so, what are some cool things you have done with it over something like with in-memory db?

about halting paintComponent() on window resize

when using Java Swing. What would be the way to halt the paintComponent() from being called when the frame gets resized/minimized/extended Basically the default model is paintComponent() gets called at the start but also upon window resizing. This is why the graphics disappear upon any manipulation of the frame. I tried asking Perplexity Pro but I was not able to implement running any of these options of code....
No description

Implement discord authentication

Hi, im tring to add login with discord in my nextjs and springboot application but i can't find what should be the best way to implement it, i reimplemented in a lot of different ways but nothing seems the right way to do it.