File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -95,8 +95,9 @@ public void actionPerformed(ActionEvent e) {
95
95
}
96
96
97
97
jPanel .setAlignmentY (Component .CENTER_ALIGNMENT );
98
- jPanel .setPreferredSize (new Dimension (100 , 500 ));
99
- jPanel .setMaximumSize (new Dimension (100 , 500 ));
98
+
99
+ // set height of panel to appropriate size based on the number of chats
100
+ jPanel .setPreferredSize (new Dimension (100 , 60 * this .chats .size ()));
100
101
jPanel .setBorder (BorderFactory .createTitledBorder ("My Chats" ));
101
102
102
103
@@ -115,7 +116,8 @@ private void scrollableChats(JPanel jPanel) {
115
116
JScrollPane scrollFrame = new JScrollPane (jPanel );
116
117
jScrollPane = scrollFrame ;
117
118
scrollFrame .setPreferredSize (new Dimension ( 200 ,500 ));
118
- jFrame .add (scrollFrame );
119
+ scrollFrame . getVerticalScrollBar ().setUnitIncrement (5 );
120
+ jFrame .getContentPane ().add (scrollFrame );
119
121
}
120
122
121
123
@@ -147,7 +149,7 @@ public void updateChatOrder(Chat chat){
147
149
148
150
/**
149
151
* Add a new chat to the screen, if the chat already exists (i.e. there exists a chat with the
150
- * same ID, do nothing.
152
+ * same ID, do nothing)
151
153
* @param chat The new chat to be added
152
154
*/
153
155
public void addNewChat (Chat chat ){
You can’t perform that action at this time.
0 commit comments