Skip to content
Advertisement

Tag: swing

Can’t Change button or panel location in Swing (Java)

I can’t change the location of Button or Panel in “setbounds” in java swing.It’s just stuck to the top. What should I change here? Should I add a “Gridlayout” to the button or something? Changing the panel location does nothing for the button. public class Main { Answer In Java Swing, a layout manager decides on where the contained components

Buttons not showing up in JPanel

I’m having a ton of trouble figuring out why the buttons in this won’t show? They were showing up earlier today when I test ran the program but now I’ve been stuck for 2 hours trying to get the buttons to show up again. It’s also really weird because the panel is definitely showing up because the phrase “Welcome to

Loading images/files inside jar

There are already heaps of answers to this problem. I have also tried a lot of them. I have not found a solution yet. I load some images within my project (Swing – ImageIcons). In the run dialog all of them are also displayed in my GUI. But after compiling the program can’t be started at all. The error messages

checkbox appears when button pressed, java

My code displays a texture where you can type something in and than it should appear under the label with a checkbox. What I want is that the checkbox is only there if the title is set through the textfield. I couldn’t find anything on this topic just cb.validate(); but that didn’t really help me. I also tried doing this.add(cb);

JButton text changes on its own?

The following simple code: can always reproduce the same bug (at least for my setups, which are given below). The program is supposed to change the button text, according to the text-field’s text, when the button is clicked. The problem is that the text of the button reverts/changes back to its previous value on its own unexpectedly. The problem arises

Advertisement