Java JPanel two borders, different colors?

For my layout i want to have double borders, on the bottom of my JPanel, one should be slightly darker and the other should be slightly lighter. Currently i have 1 border: 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); How could i add another border underneath the one that i already have? Is this possible?

以上就是Java JPanel two borders, different colors?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏