6,601 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
6
votes
0
answers
165
views
How do I get a display's precise refresh rate?
Currently, I'm using Component.getGraphicsConfiguration().getDevice().getDisplayMode().getRefreshRate() to get the monitor's natural framerate. However, that returns an integer, and my monitor's ...
3
votes
2
answers
173
views
Why does Container's add(panel, Integer) provide a different result than add(panel, int)?
To provide background and explanation of the question:
I was working with a base program (below) to figure out how to use JLayeredPane. I created a JLayeredPane and added it to the JFrame, then moved ...
0
votes
1
answer
152
views
How do I tell when the screen's refresh rate changes?
I have to repaint the screen every refresh, and matching with the native refresh rate makes smooth animations. It seems the easiest way to get the native refresh rate is via:
Component....
4
votes
0
answers
133
views
Font rendering difference when app-loaded vs Windows-registered in Java Swing app
I am getting different rendering behavior of a font, "DejaVu Sans Mono", in my Java Swing application if the application loads the font itself vs it being registered with Windows (installed ...
1
vote
2
answers
90
views
Why are GridBagLayout.setConstraints and panel.add won't accept my indexed array of different components?
I'm creating a GUI which will have multiple different components (like JButtons, JTextFields, etc., although I'm testing it out with JButtons first) in a grid with different sizes, and I have created ...
3
votes
1
answer
50
views
BasicRobot.robotWithCurrentAwtHierarchy() freezes indefinitely
If I run these tests separately, they complete successfully.
However, if I run them all with mvn test, the one that happens to be executed later freezes indefinitely.
import org.fest.swing.core....
1
vote
1
answer
98
views
Java: Calculating text width for different fonts on different operating systems with FontMetrics
I am generating OpenXML (OOXML) Word files with Java. I want to avoid starting chapters or tables at the bottom of a page which would cause them to be split to the next page. So I need to know where ...
2
votes
1
answer
178
views
How do I call Scanner with Swing in Java?
I am trying to start a console based Main.main() from a Swing GUI, but the Scanner doesn't accept any input, I think that scanner isnt running.
This is my code in the GUI:
bankBtn.addActionListener(e -...
0
votes
2
answers
193
views
Problems in scaling Java swing to full screen also Windows is making it harder
I want my program to be full screen so I use the following line of code in constructor of my frame class:
static GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment()....
0
votes
0
answers
57
views
Java AffineTransformOp.filter() Causes Weird Tearing in Tilemap on some devices
so I'm trying to make a simple tile map in Java with Graphics. On my main device at home everything works perfectly well, yet on my Laptop, I get this weird tearing.
It seems to be caused by ...
2
votes
1
answer
75
views
How to reduce the height of a JPanel used as a header in Java Swing?
I’m building a simple Java Swing UI and want a thin red header bar at the top with just a title label ("Unit Converter").
However, the JPanel takes up too much vertical space. I only want a slim ...
0
votes
1
answer
57
views
jagged line with drawLine() using Java AWT
I'm testing 2D walk of specific math functions using Java AWT, and I found weird patterns. Manual drawing 2D walk of the functions didn't show any weird patterns, so I started to check Java AWT ...
0
votes
0
answers
59
views
Change coordinate system from top to bottom left corner for angles
I want in Java to change the coordinate system for an Arc2D which has a startAngle and an angleExtent from the Java coordinate system (reference is top left corner) to another which is bottom left ...
0
votes
1
answer
55
views
Distorted Tray Icon Image
I'm making an auto-clicker app that runs in the background with jnativehook in the tray, which can open up a java.awt app when the icon is clicked. That whole part works when run from vscode with run ...
-1
votes
1
answer
67
views
Is it common practice in Java to add JPanels with custom layouts to a JFrame to organize components? [closed]
I'm learning Java Swing and wanted to make sure I understand the common approach to building GUIs.
As far as I understand, the typical workflow is:
Create a JFrame as the main window.
Add one or more ...