作者lovesneakers (sneakers)
站內java
標題Re: [問題] JButton getGraphics
時間Sun Apr 27 02:46:39 2008
謝謝 willieliao & janyfor
現在我知道只有繼承才辦得到額外再畫圖形上去
但其實我想要達到的是
CustomButton cBtn; // 假設這個是別人提供的 btn, 已經畫了一個圖案在上面
我要怎麼產生一個 JButton nBtn, 偷 cBtn 上面的圖示, 並畫到 nBtn 上面
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.191.75
推 willieliao:一樣,class nBtn extends cBtn { public void paint 04/27 13:26
→ willieliao:(g) {super.paint(g) //後面再加上你自己要加畫的 04/27 13:27
推 willieliao:或者如果只是要偷圖示用cBtn.getIcon()在set到nBtn上 04/27 13:31