Jump to content

Easy Chatbox Paint


Folks

Recommended Posts

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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