Changed bgc of testArea and played on pref size of list and scrollPane
This commit is contained in:
parent
2de64956e4
commit
ea75636e7f
@ -133,11 +133,12 @@ public class ChatWindow extends JFrame {
|
|||||||
// updates list elements when list is resized
|
// updates list elements when list is resized
|
||||||
@Override
|
@Override
|
||||||
public void componentResized(ComponentEvent e) {
|
public void componentResized(ComponentEvent e) {
|
||||||
messageList.synchronizeModel();
|
|
||||||
var prefSize = e.getComponent().getPreferredSize();
|
var prefSize = e.getComponent().getPreferredSize();
|
||||||
|
e.getComponent().setPreferredSize(prefSize);
|
||||||
|
messageList.synchronizeModel();
|
||||||
messageList.setMinimumSize(new Dimension(prefSize.width, 0));
|
messageList.setMinimumSize(new Dimension(prefSize.width, 0));
|
||||||
messageList.setMaximumSize(new Dimension(prefSize.width, Integer.MAX_VALUE));
|
messageList.setMaximumSize(new Dimension(prefSize.width, Integer.MAX_VALUE));
|
||||||
messageList.setPreferredSize(new Dimension(prefSize.width, messageList.getPreferredSize().height));
|
messageList.setPreferredSize(new Dimension(prefSize.width, (int) messageList.getPreferredSize().getHeight()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
@ -91,7 +91,7 @@ public class MessageListRenderer implements ComponentListCellRenderer<Message> {
|
|||||||
messageTextArea.setWrapStyleWord(true);
|
messageTextArea.setWrapStyleWord(true);
|
||||||
messageTextArea.setForeground(theme.getMessageTextColor());
|
messageTextArea.setForeground(theme.getMessageTextColor());
|
||||||
messageTextArea.setAlignmentX(0.5f);
|
messageTextArea.setAlignmentX(0.5f);
|
||||||
messageTextArea.setBackground(Color.RED);
|
messageTextArea.setBackground(theme.getCellColor());
|
||||||
messageTextArea.setEditable(false);
|
messageTextArea.setEditable(false);
|
||||||
var font = new Font("Arial", Font.PLAIN, 14);
|
var font = new Font("Arial", Font.PLAIN, 14);
|
||||||
messageTextArea.setFont(font);
|
messageTextArea.setFont(font);
|
||||||
|
Reference in New Issue
Block a user