JSplitPane
似乎为添加的任何内容添加了边框Component
。
这在嵌套的 JSplitPanes 中最为明显 - 例如:
public class JSplitPaneToy {
public static void main(String[] args) {
JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
makePanel(), makePanel());
sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, makePanel(), sp);
sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, makePanel(), sp);
sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, makePanel(), sp);
JFrame frame = new JFrame("JSplitPane Toy");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(sp);
frame.pack();
frame.setVisible(true);
}
private static JScrollPane makePanel() {
JScrollPane pane = new JScrollPane(new JTable(
new Object[][]{{0, 1, 2}, {1, 2, 3}, {2, 3, 4}}, new Object[]{1, 2, 3}));
pane.setPreferredSize(new Dimension(200, 100));
return pane;
}
}
即,每个后续嵌套组件似乎都设置得更靠后——即添加了某种形式的阴影边框。
- 为什么要添加此边框?(这实际上是在添加边框吗...?)
- 如何防止添加此“边框”?