repainting a jframe containing two jpanels
as i stated in a thread i posted a few hours ago, im programming a hangman project for the final in this introductory java class im taking. i have a background in C/C++, but java is new to me.
right now, it looks like this:
ugly, ugly. i'll worry about the layout once i get the game working properly.
the graphic and the word to be guessed are in one panel, and the keyboard is in another. the keyboard buttons get the following ActionListener code:
when the keyboard buttons are given this ActionListener, they pass it the whole GameScreen JFrame that holds the keyboard panel and the graphics panel, which button called it, what letter that button corresponds with, and the hangman object (which handles most of the gameplay internally).
public class KeyboardButtonAction implements ActionListener
//private data members
private char letter = 0;
private JButton parentButton = null;
private JFrame parentWindow = null;
private Hangman hangman = null;
public KeyboardButtonAction(JFrame parentWindow, JButton parentButton, char letter, Hangman hangman)
this.parentWindow = parentWindow;
this.parentButton = parentButton;
this.letter = Character.toLowerCase(letter);
this.hangman = hangman;
//handle the button press ActionEvent
public void actionPerformed(ActionEvent e)
my question is just this: how am i misusing repaint()? i expected it to update the entire window (so the dashes below the graphic update with properly guessed letters, etc).
i'll happily post any more code that is needed to facilitate answering this question. =)
thanks in advance.