All Questions
75 questions
0
votes
1
answer
39
views
JButton only appears after hovered over, while using CardLayout for handeling scenes [duplicate]
I am trying to create a simple game in Java, but I got stuck on creating a system for handeling the different scenes and the trasitioning between them.
These are my classes:
The scene manager that ...
0
votes
1
answer
56
views
JFrame size affecting JButton size but only vertically?
I am confused about how JFrame extends the JButton vertically to match JFrame min size but not horizontally. I would like for it to not extend in either direction and know why it extends or doesn't.
...
1
vote
1
answer
68
views
Change size of JButtons
I have a very big problem. I need to do vertical menu in the center of window. What could be easier? What I did:
I create JFrame and set BorderLayout to it:
JFrame jfr = new JFrame("Frame");
Then I ...
0
votes
2
answers
953
views
Panel in Java Swing float left with vertical bars
How I can create a JPanel with a lot of buttons aligned float left and with vertical scrollbars only?
The buttons should be sorted like below.
1 2 3 4
5 6 7 8
9 10 11 12
0
votes
2
answers
65
views
Adding JButtons to Scrollpane
JAVA:
I want to add some JButtons to an Scrollpane. The JButtons are the Chats (like in Skype). I want them in a list with 1 column only.
The amount of groups / rows should be flexible.
The size of ...
0
votes
0
answers
33
views
Bottom of button disappears on different computers with same environment
I'm facing issue with Java Swing. On one computer button looks one way, but on other computers it's different. Any idea why?
Environment description (every computer):
Java 1.8.0_171
Windows 10
1
vote
0
answers
52
views
JButton doesn't appear unless mouse hover
I've made a Sudoku program but I have 1 issue I can't fix. I have 4 buttons overall but only one appears unless I hover over the others. I know this has something to do with the setLayout option but I ...
1
vote
2
answers
48
views
Java program wont react till the window gets resized
I have a simple java program and when I run it, using eclipse, it displays the 3 JButtons that I have set to the layout. The buttons are set to change the alignment of the layout. So you press left to ...
0
votes
1
answer
73
views
GUI Layout of My Text Game
Hi I am trying to work on the GUI of my text based game with a border layout, and I almost have what I am trying to achieve with the GUI.
Here is what I want. I have almost everything down.. besides ...
1
vote
2
answers
812
views
Use multiple layout manager in JAVA
I want to place the button below the "898 Food Restaurant" Jlabel. The setLocation() for button not working.
public class MainMenu extends JPanel{
JLabel picLabel,title;
JButton button;
...
-1
votes
1
answer
282
views
calling revalidate after pressing Jbutton in java
I have a frame holding JPanel that holds JButton buttons having numbers from 1 to 9, when the button is pressed it should change its icon to a predefined icon.
When I initialize the buttons I add an ...
0
votes
0
answers
54
views
How to define the position that I want to my JButton on top of a background image?
I have a small frame that I created and I wanted to give it an image as a background, but when I did that I tried to work with boxlayout to define the positons of the buttons.
But it was a disaster ...
-1
votes
1
answer
72
views
PaintComponent not working with JButtons - FIXED
EDIT: Thank you everyone, you really helped me out here. The final thing I needed to do was make the panels layout null, so the JButtons could move. Thank you!
My paintComponents content doesn't show ...
0
votes
1
answer
63
views
Missing Jbutton row inside Jpanel
Can anyone tell me why the JFrame is missing a row of buttons? I'm trying to make a memory card game where you click on the button and it's replaced by an image but some buttons aren't showing up? I ...
0
votes
1
answer
128
views
MouseMotionListener doesn't respond over JButtons
So I have a JPanel called contentPanel that holds 2 inner containers. The first is a scorePanel that holds a few buttons, a slider and a label. The other is a buttonPanel which is a grid of JButtons.
...