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)