On Mac, there is a big delay when I create multiple JInternalFrame windows in JFrame and drag them around.
https://i.sstatic.net/Av15A.gif
there is a big delay when I create multiple JInternalFrame windows in JFrame and drag them around
public static void main(String... args) {
System.out.println("Hello World!");
JFrame mainFrame = new JFrame("Hello");
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setSize(1920, 1080);
JDesktopPane desktopPane = new JDesktopPane();
mainFrame.setContentPane(desktopPane);
for (int i = 0; i< 10; i++) {
JInternalFrame internalFrame = new JInternalFrame("Hello");
internalFrame.setPreferredSize(new Dimension(1800, 1000));
desktopPane.add(internalFrame);
internalFrame.setVisible(true);
internalFrame.pack();
// internalFrame.setDebugGraphicsOptions(DebugGraphics.LOG_OPTION);
}
mainFrame.setVisible(true);
}
No problem if debug is turned on.
internalFrame.setDebugGraphicsOptions(DebugGraphics.LOG_OPTION);
I have tested both Java 15 and Java 8 and both have this problem.
Does anyone know why there is a serious delay when dragging the JInternalFrame window?
for (int i = 0; i< 10; i++) {
JInternalFrame internalFrame = new JInternalFrame(String.valueOf(i));
internalFrame.setPreferredSize(new Dimension(1800, 1000));
desktopPane.add(internalFrame);
internalFrame.setVisible(true);
internalFrame.pack();
internalFrame.setOpaque(true);
// internalFrame.setDebugGraphicsOptions(DebugGraphics.LOG_OPTION);
}
Adding internalFrame.setOpaque(true);
can ease this problem.