当前位置: 技术问答>java相关
我想做一个菱形的JComponent,请问可以实现吗?
来源: 互联网 发布时间:2015-05-21
本文导语: 如果有例子,就更好了,谢谢! | JButton img_btn1=new JButton(new ImageIcon(getClass().getResource("image\imgbtn1.gif"))); img_btn1.setRolloverIcon(new ImageIcon(getClass().getResource("image\imgbtn2.gif"))); img_btn1.setPressedIcon...
如果有例子,就更好了,谢谢!
|
JButton img_btn1=new JButton(new ImageIcon(getClass().getResource("image\imgbtn1.gif")));
img_btn1.setRolloverIcon(new ImageIcon(getClass().getResource("image\imgbtn2.gif")));
img_btn1.setPressedIcon(new ImageIcon(getClass().getResource("image\imgbtn3.gif")));
img_btn1.setDisabledIcon(new ImageIcon(getClass().getResource("image\imgbtn2.gif")));
img_btn1.setFocusPainted(false);
img_btn1.setBorderPainted(false);
img_btn1.setContentAreaFilled(false);
img_btn1.setMargin(new Insets(0,0,0,0));
img_btn1.setRolloverIcon(new ImageIcon(getClass().getResource("image\imgbtn2.gif")));
img_btn1.setPressedIcon(new ImageIcon(getClass().getResource("image\imgbtn3.gif")));
img_btn1.setDisabledIcon(new ImageIcon(getClass().getResource("image\imgbtn2.gif")));
img_btn1.setFocusPainted(false);
img_btn1.setBorderPainted(false);
img_btn1.setContentAreaFilled(false);
img_btn1.setMargin(new Insets(0,0,0,0));
|
看看mvc,修改view就可以了.java swing中有很多.
|
可以实现,JComponent是轻量级的组件。
|
轻量级的组件,应该好实现!