Skip to content

Tag: swing

user’s preferred contrast polarity? (OS dark mode setting)

Current operating systems (e.g. Windows, macOS) let the user decide if they want dark content on light blackground (classic) or rather light content on dark blackground (dark mode). Is there something available in Java, so that my (client side) Java programs can automatically adjust their contrast polarity ac…

JDialog not focused on OSX when Java is not on top

My JDialog is not focused when the Java program is not in the front in OSX. How do I achieve this? I have the following test program to illustrate the scenario (at the bottom), running using javac Test.java && java Test from a terminal. When the terminal output “Started first”, it will cha…

Highest performance for Keyboard Input

So I have a small java game engine using a single JFrame. I am currently using Key-Bindings as they were working neatly but I figured that a KeyListener might be architecturally more fitting. But since I honestly don’t really care which I’ll use I wanted to ask if there is a performance difference…

How to scale basic drawings?

I would like to have a list of shapes, that appears in my window. Whenever I’m changing the size of the window, I would like to scale all of my drawings. I already prepared classes, that store information about random shapes in a list (rectangles, ovals, etc.). I have no problem with painting them all, …