3

So for my software engineering class we have to write a game in Java, and let me tell you, it has been a time.

The worst part so far has been the transition over to using a JLayeredPane, so that we actually have a background and a foreground. I offered to handle it, since I've done a bit with swing before now.

So I put together something that I thought should work, only to find that layered panes and layouts do NOT like to work together. So it was off to google...after sooo many hours of pouring over tutorials and javadocs I finally got the layers to draw...only to find that our Buttons had stopped working!

For some reason, putting the buttons inside a JPanel stopped them from actually informing their ActionListener (since the random test button I just added had actually still worked). So OF COURSE that meant I had to rework the buttons too, since their logic relied on that panel.

All in all, what should have been a relatively simple refactoring of our view was tranformed into almost a week's worth of frantic googling and pain through the magic of Java Swing.

Comments
  • 2
    Use a null layout and just position shit manually, thats what i do with my speedcoding games
  • 2
    @EstrellaNieva use some frameworks like libGDX if you want to develop games in Java, it is cross platform so you can even port it to Android afterwards
  • 0
    Why are you using Swing? JavaFX is the new Java GUI framework.
  • 0
    @Nevoic It's just what my professor told use to use.
Add Comment