I was working on JRootPaneUI (I am trying to develop a look and feel), and I was making a window with rounded corners. The issue is if I do not use setShape, it would leave some artifacts on the corner of the window. However to do so I should set the window to undecorated, and if someone decides to make their window decorated, it would break the UI. So, I was wondering how I could override the JFrame's setUndecorated method.
Currently this is the code I came up with.
@Override
public void installUI(JComponent component) {
JRootPane rootPane = (JRootPane) component;
JFrame frame = (JFrame) rootPane.getParent();
// Override instance frame's setUndecorated method here
}
There probably is something wrong about using the following method to get the JFrame, so if there is a better method to do so, please consider including it.