Skip to content
Advertisement

Tag: swing

How to make multiple buttons work individually in Swing?

I am trying to develop an application and I have decided to learn Swing to create the GUI. I have never learnt this before, it seems quite simple but I haven’t gotten my head around ActionListener. I am trying to make the buttons respond by producing some debug text in the console. Could someone take a look and point out

How do I print a shape in a loop? [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 1 year ago. Improve this question I am trying to print shapes in a loop, but when I run

Java Stop Sound Button Not Working Correctly

So I have been making a stop button recently and have been wondering how can I stop a button sound instantly when already playing. The problem : When you click the stop sound button, it only stops the next button you press. What Im Trying to Achieve : When you click the stop sound button, it stops all playing sounds.

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

How to pause and resum a timer in Java

I have a small game where I need to pause the timer when the user press Pause button and after to resume the timer and to continue to increase the seconds when the user press the Resume button. I researched a lot and I tried different solutions but none worked for me. Can you please help me to achieve this

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,

Advertisement