final/src/PauseMenu.java

22 lines
818 B
Java

import java.awt.*;
public class PauseMenu extends TextBox {
public PauseMenu(int y, int textYOffset, int xWidth, int yHeight, int totalWidth, Font font, String text) {
super(y, xWidth, yHeight, totalWidth, font, text, null);
this.y -= textYOffset;
}
public void drawCenteredTextBox(Graphics g, String text, Color backgroundColor, Color textColor) {
if (backgroundColor != null) {
g.setColor(textColor);
// TODO: make drawn line widths consistent
((Graphics2D)g).setStroke(new BasicStroke(4f));
g.drawRect(newX, newY, xWidth, yHeight);
g.setColor(backgroundColor);
g.fillRect(newX, newY, xWidth, yHeight);
}
g.setColor(textColor);
drawCenteredString(g, y, newX, xWidth, text);
}
}