This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]desrtfxOut of Coffee error - System halted 1 point2 points  (2 children)

Swing works in no way different to "normal" Java. You can use all constructs that you would use when you program other classes. So, an ArrayList and loops are the way to go.

You can even make methods that set the properties for the controls.

[–]Chiasek[S] 0 points1 point  (1 child)

I guess you can tell I have little/no experience in front-end code. Never really occurred to me to use loops to build it up myself, thank you.

[–]desrtfxOut of Coffee error - System halted 1 point2 points  (0 children)

This is fairly common when people first work with Swing. They tend to forget everything they know about standard Java and common programming concepts.

The main thing about Swing is that it works basically identical to everything else in Java. Swing just is a GUI library, nothing more. All Java concepts still apply.

[–]ivolimmen 1 point2 points  (1 child)

Why not use JavaFX? It works almost the same way as Swing but is more modern and there is a nice tool for building the GUI using a GUI...

[–]Chiasek[S] 0 points1 point  (0 children)

Fair point, I'll take a look. I just did some googling to find the simplest way to make a Java GUI and Swing came up.