7,588 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
3
answers
154
views
Elements appearing in the up position
I noticed this kinda of event some weeks ago, but I ignored, now it's making me curious. the last element that I add always end up in the up position of the screen, no matter how much I try to alter ...
0
votes
0
answers
22
views
Remove Jpanel from jframe
I'm working on a basic Hidden object game for fun. Im not a professional coder by any means. At the main menu of the game (where you select start game, exit, resume, or how to play) I have 4 Jbuttons ...
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 ...
0
votes
0
answers
60
views
How to give Enter and Spacebar keys the same initial focus in a JOptionPane?
I have two buttons and a checkbox within a JOptionPane.
When I first open the window, the space bar has the checkbox selected, and the enter key has the OK button selected.
Weirdly if I tab the two ...
-1
votes
1
answer
94
views
JPanel acting very weird
I want to make it so that it starts with a image and a jbutton, pressing the button hides the image and button and reveals a subpanel with a circle, along with two arrows that should let you redraw ...
1
vote
1
answer
66
views
How should I set up a JPanel to display with white space?
I'm trying to create a class which represents a playing card as a JPanel, (which I add to a window in another class), but I don't know how to make the panel stay at a specific size when I add it to ...
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
81
views
adding items to a JPanel with a button
I've been trying to create a program that tracks a shopping list and adds new JLabels whenever the corresponding buttons are pressed, but for some reason whenever I press the button nothing new comes ...
0
votes
0
answers
59
views
Why are my buttons not showing, only the label is visible? [duplicate]
I’m trying to display two buttons ("Increase" and "Decrease") in one panel and a label ("Points:") in another that should be located under Panel1. But when I run the program, only Panel2 with the ...
-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 ...
0
votes
2
answers
84
views
Why does my JButton lose its full width when added via a JPanel in BorderLayout?
I’m an absolute beginner with Java Swing and trying to build a simple GUI for a unit converter.
In the following code, I add a JButton directly to the JFrame using BorderLayout.PAGE_END. The button ...
0
votes
1
answer
97
views
How to Display Items In JPanel to use for Inventory System?
I'm currently making an inventory display menu to manage tools around the shop easier.
MainMenu (JFrame Form)
I want to make a GUI that populates a JPanel in a JScrollPane with a premade JPanel Form ...
1
vote
1
answer
81
views
Updating a JLabel while the program's running
I'm currently trying to program a GUI for a reversi game(https://en.wikipedia.org/wiki/Reversi), using Java Swing. A part of my task is to print the current number of player's (blue) and machine's (...
0
votes
1
answer
34
views
Why I can't access a method from my custom JPanel?
I have a JFrame with a JPanel inside.
MyFrame class:
public class MyFrame extends JFrame {
private JPanel contentPane;
public static void main(String[] args) {
new MyFrame()....
0
votes
0
answers
52
views
Swing JFrame does not work well with tiling WM
I have created a basic window in Swing using Kotlin and I have an issue when displaying when I'm in Hyprland. The window sometimes starts as a floating window and sometimes it starts tiled. No idea ...