MacOS JInternalFrame border problem
With new MacOS versions, the good old Aqua LaF has some problems.
If you create a simple MDI application with JDesktopPane and JInternalFrame, following problem will occur:
The code for our problem:
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.plaf.UIResource;
public class TestJVxTabbedPane
{
public static void main(String[] args) throws Exception
{
new TestJVxTabbedPane();
}
public TestJVxTabbedPane()
{
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new BorderLayout());
JDesktopPane dpan = new JDesktopPane();
dpan.setBackground(Color.white);
JInternalFrame fr = new JInternalFrame();
fr.setTitle("Super Frame");
fr.setPreferredSize(new Dimension(200, 200));
fr.pack();
fr.setResizable(true);
fr.setMaximizable(true);
fr.setIconifiable(true);
fr.setClosable(true);
fr.setVisible(true);
dpan.add(fr);
frame.getContentPane().add(dpan, BorderLayout.CENTER);
frame.setSize(500, 400);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
(nothing special, a simple JInternalFrame, JDesktopPane combination)
We don't like bad looking UIs, so we fixed the problem in JVx:
The fix will work without JVx as well. We made tests with different MacOS versions and our solution worked in all our tests.
And what is the workaround without using JVx??
see https://sourceforge.net/p/jvx/code/HEAD/tree/trunk/java/swing/src/com/sibvisions/rad/ui/swing/ext/JVxInternalFrame.java
The constructor contains the fixed border.