Jump to content

Easy Chatbox Paint


Recommended Posts

Posted

While working on my own paint, I liked the aesthetic of the chatbox so I wanted to keep the look and paint over it with the same or similar colors. I figured I'd share since others might find it useful.

Side note I just noticed there is a chatbox in the api which might have something to make this easier or better but I am too lazy to look into it at this point.

private static final int CHAT_BOX_X = 0;
private static final int CHAT_BOX_Y = 338;
private static final int CHAT_BOX_WIDTH = 519;
private static final int CHAT_BOX_HEIGHT = 142;
private static final int CHAT_BOX_PADDING = 6;

private static final Color CHAT_BOX_COLOR = new Color(200, 180, 150);

public void fillChatBoxPadded(final Graphics2D g) {
    int paddedX = CHAT_BOX_X + CHAT_BOX_PADDING;
    int paddedY = CHAT_BOX_Y + CHAT_BOX_PADDING;
    int paddedWidth = CHAT_BOX_WIDTH - (2 * CHAT_BOX_PADDING);
    int paddedHeight = CHAT_BOX_HEIGHT - (2 * CHAT_BOX_PADDING);

    g.setColor(CHAT_BOX_COLOR);
    g.fillRect(paddedX, paddedY, paddedWidth, paddedHeight);
    g.setColor(Color.black);
    g.drawRect(paddedX, paddedY, paddedWidth, paddedHeight);
}

public void fillChatBox(final Graphics2D g) {
    g.setColor(CHAT_BOX_COLOR);
    g.fillRect(CHAT_BOX_X, CHAT_BOX_Y, CHAT_BOX_WIDTH, CHAT_BOX_HEIGHT);
    g.setColor(Color.black);
    g.drawRect(CHAT_BOX_X, CHAT_BOX_Y, CHAT_BOX_WIDTH, CHAT_BOX_HEIGHT);
}

 

With padding
hC7xEvI.png

Without padding

qOWHJPC.png

 

  • Like 2
  • Heart 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...