Java JSlider diamond is transparent?

When I make a JSlider, the slider "diamond" seems to be transparent (except for the border). I can't figure out why. Has anyone seen this before or have any ideas? //create slider JSlider slider = new JSlider(JSlider.HORIZONTAL, 0,10, 5); slider.setBounds(100,500,300,40); mainContainer.add(slider); Edit: I seem to have answered my own question. It turns out that I needed to set the look and feel before the JSlider: //Set Look and Feel try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) {} catch (InstantiationException e) {} catch (IllegalAccessException e) {} catch (UnsupportedLookAndFeelException e) {} //create slider JSlider slider = new JSlider(JSlider.HORIZONTAL, 0,10, 5); slider.setBounds(100,500,300,40); mainContainer.add(slider); Reversing the order results in the transparency problem.
1) slider.setBounds(100,500,300,40); Don't do that, use layout managers. 2) "I seem to have answered my own question." Enter that as an answer and accept it when you get the chance.

以上就是Java JSlider diamond is transparent?的详细内容,更多请关注web前端其它相关文章!

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

评论 抢沙发

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

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

联系我们

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

支付宝扫一扫打赏

微信扫一扫打赏