对于我的布局,我希望在 JPanel 的底部有双边框,一个应该稍暗,另一个应该稍亮。
目前我有 1 个边界:
JPanel pnlTop = new JPanel(new BorderLayout()) {
protected void paintComponent(Graphics grphcs) {
super.paintComponent(grphcs);
Graphics2D g2d = (Graphics2D) grphcs;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
GradientPaint gp = new GradientPaint(0, 0,
new java.awt.Color(237, 237, 237), 0, getHeight(),
new java.awt.Color(222, 222, 222));
g2d.setPaint(gp);
g2d.fillRect(0, 0, getWidth(), getHeight());
}
};
pnlTop.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(173, 173, 166)));
pnlTop.setPreferredSize(new Dimension(2000, 90));
add(pnlTop, BorderLayout.PAGE_START);
我怎么能在我已经拥有的边框下面添加另一个边框?这可能吗?