Tuesday, 10 September 2013

Updating my Graphics

Updating my Graphics

I just want to say thanks in advance for help. I really appreciate it.
So I'm just starting to learn about programming in Java and even more
recently with graphics, and I've run into some problems. I want to create
a game like dwarf fortress in look, with colored text instead of images.
This is what I have so far:
public void paint(Graphics g) {
super.paint(g);
g.setColor(Color.red);
for (int i = 0; i < 50; i++) {
g.drawString("[Game goes here]", 100, 150);
g.dispose();
System.out.println(i);
}
g.dispose();
}
public GTest() {
setSize(Toolkit.getDefaultToolkit().getScreenSize().width / 3, Toolkit
.getDefaultToolkit().getScreenSize().width / 3 + 50);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}
public static void main(String[] args) {
GTest myWindow = new GTest();
}
I want it to update the graphics on a timer, but I'm not really sure how
to do this.
I know that this is a pretty broad question and I would be happy to
clarify anything you might want to know. Again thank you for the help.

No comments:

Post a Comment