Fix crash in ClienUI configChanged event
Fix crash that can happen when ConfigChanged event arrives to ClientUI and pack method is called in the event thread. Move swing/awt related calls to swing thread to avoid this issue. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -269,16 +269,19 @@ public class ClientUI extends JFrame
|
|||||||
|
|
||||||
Dimension size = new Dimension(width, height);
|
Dimension size = new Dimension(width, height);
|
||||||
|
|
||||||
client.setSize(size);
|
SwingUtilities.invokeLater(() ->
|
||||||
client.setPreferredSize(size);
|
|
||||||
|
|
||||||
client.getParent().setPreferredSize(size);
|
|
||||||
client.getParent().setSize(size);
|
|
||||||
|
|
||||||
if (isVisible())
|
|
||||||
{
|
{
|
||||||
pack();
|
client.setSize(size);
|
||||||
}
|
client.setPreferredSize(size);
|
||||||
|
|
||||||
|
client.getParent().setPreferredSize(size);
|
||||||
|
client.getParent().setSize(size);
|
||||||
|
|
||||||
|
if (isVisible())
|
||||||
|
{
|
||||||
|
pack();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setUIFont(FontUIResource f)
|
private static void setUIFont(FontUIResource f)
|
||||||
|
|||||||
Reference in New Issue
Block a user