Skip to content
Advertisement

Tag: awt

How do I align a JPanel centered underneath another JPanel?

I have the following GUI that I’m working on. panel1 contains the titel and titelInput . At the moment I am setting the BorderLayout of panel1 to BorderLayout.NORTH and panel2 to BorderLayout.CENTER to see if it is possible to see both (which it is not). As far as I know, panel2 overlays panel1 because BorderLayout is always centered in the

Update class variables on button click

If i click my “Run” button on my GUI after changing the value of a textfield, the variable won’t update. I have the button in one class: and in another class, i have all my Data collected: in the RunSimulation class, the class variables in Data are accessed. If I print out Data.campusSize, it will always give the same value,

Why is the swing gui behaving strange?

I just started making my Java application on Minesweeper. The idea is a GridLayout JPanel inside a JFrame. But after executing the program I get some weird window. There is this strange gray corner on the upper left corner. And the tiles don’t all show. Somehow hovering the mouse over them shows. The program produced this ugly abomination. How to

How to change the default JFrame Window color?

I am building an app for Windows using Java Swing/AWT interfaces in IntelliJ Idea. I am using a default JFrame to display my application GUI. However, I would like to change the default frame outline (window) colour to either transparent or custom colour. Here is what I am trying to achieve: This is the window I have: These two are

Swing – How to modify the border color of a JButton?

How to modify the border color of a JButton? I want to get something like this: But I canĀ“t modify the color, the borde is black: And If I try to add a LineBorder or any other borde, I am not able to remove the inner border: Answer I tried an example below and all seems fine, unless you are

Curious behavior of java.awt.Component, setVisible(), LayoutManager

I was trying to create a GUI and found some curious behavior of java.awt.Component. I wanted to setVisible(true)/setVisible(false) an java.awt.Component by an external Event. But this only works when the to be switched Component was already visible in the first place. Attached, I provided a minimal replica of my problem. When you remove line testButton.setVisible(false);, testButton is viewable and also

Advertisement