Skip to main content
Code Review

Return to Revisions

2 of 2
Better formatting.
syb0rg
  • 21.9k
  • 10
  • 113
  • 192

Some comments:

  • Make sure you have a consistent indentation style. It makes it difficult to follow the code flow, if there are multiple lines with different indentation.

  • You should separate the view and the game logic. Having both the Swing design setup and the actual game logic mixed up—in a single method—makes the code very hard to navigate. Ideally, both should be in separate classes.

  • Consider making a subclass of JFrame for your game view. It will be the only thing responsible for setting up the visuals. You can pass it a GameStructure object (which would be only the game logic), so it can combine everything.

  • for(j = 0; j<64; j++) — Instead of hard-coding the length of the worldList, you should be able to adjust automatically if I add new words to the word list without changing anything else.

  • tf.addActionListener(new ActionListener() { ... — Instead of having an anonymous listener, consider making an actual type to clean everything up. As you only need to have a single listener, you can also make the class you’re in implement ActionListener, so you can pass this to addActionListener.

poke
  • 752
  • 8
  • 14
default

AltStyle によって変換されたページ (->オリジナル) /