How do I make a dialog box? [on hold]
- by bill
By dialog box I mean when player talks to someone, a box shows up with text on it.
I haven't found much about this topic online, so I created a basic dialog box:
//in dialog box i have only two methods
public void createBox(int x, int y, int width, int height, String txt) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.txt = txt;
}
//draw dialog box
public void draw(Graphics2D g) {
if (txt != null) {
g.setColor(Color.red);
g.drawRect(x,y,width,height);
g.setColor(Color.black);
g.fillRect(x, y, width, height);
g.setColor(Color.white);
g.drawString(txt, x + 10, y + 10);
}
}
I wanted to now can I make this better?