Hello mates!
I am having an issue where the text in a scroll area does not stay contained within the area itself. When you scroll, the text goes out of the borders instead of being hidden. Here is a picture of the issue:
Here is my code for the chat window:
[java]
Vector2f dimensions = new Vector2f(space, settings.getHeight() / 2);
chatWindow = new Window(screen, “CHATWINDOW”, new Vector2f(0, 0), dimensions);
chatWindow.setWindowTitle(“Public Conversation”);
chatArea = new ScrollArea(screen, “CHAT”, new Vector2f(5, 5), new Vector2f(dimensions.x - 10, dimensions.y - 10), true);
chatArea.setText(“Public Chat”);
chatWindow.addChild(chatArea);
Vector2f button = new Vector2f(100, 25);
textField = new TextField(screen, “text”, new Vector2f(10, dimensions.y - button.y - 10), new Vector2f(dimensions.x - button.x - 20, button.y));
chatWindow.addChild(textField);
ButtonAdapter send = new ButtonAdapter(screen, “SEND”, new Vector2f(dimensions.x - button.x - 10, dimensions.y - button.y - 10), button) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
if (textField.getText().length() > 1) {
Chat chat = new Chat(textField.getText(), null);
Client.send(chat);
textField.setText("");
}
}
};
send.setText(“Broadcast”);
chatWindow.addChild(send);
chatWindow.setPosition(new Vector2f(0, settings.getHeight() - dimensions.y));
screen.addElement(chatWindow); [/java]
I update the chatArea using the “setText” area, so I don’t know if there is a better way and this is the reason for my issues. Thanks for your help, and have a fantastic day!