[問題] JButton getGraphics

看板java作者 (sneakers)時間17年前 (2008/04/24 04:07), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/7 (看更多)
public class NewBtn extends JFrame { public NewBtn() { setSize(100, 100); JButton btn = new JButton(); add(btn); setVisible(true); Graphics g = btn.getGraphics(); g.setColor(Color.BLUE); g.fillOval(0, 0, 100, 100); } public static void main(String[] args) { new NewBtn(); } } 請問我要像上面的方法, 在生出 JButton 後改變其 Graphics 能辦到嗎? 不用繼承的方法 我試的結果似乎都會被它的 text 蓋在底下 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.191.75 ※ 編輯: lovesneakers 來自: 140.113.191.75 (04/24 04:39)
文章代碼(AID): #183vSP9N (java)
討論串 (同標題文章)
文章代碼(AID): #183vSP9N (java)