1
好了說,我有另一種的JPanel中的JPanel的「控制」和JPanel的「graphPanel」重繪兒童的JPanel
public class outer extends JPanel implements ActionListener{
private JPanel controls,graphPanel;
private JButton doAction
public outer(){
JPanel controls = new JPanel();
JButton doAction = new JButton("Do stuff");
doAction.addActionListener(this);
controls.add(doAction);
JPanel graphPanel = new JPanel();
this.add(controls);
this.add(graphPanel);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==doAction){
//How do I fire paintComponent of controls JPanel on this click
}
怎樣使「graphPanel」重繪我的按鈕被點擊
看看重新驗證()的調用的JPanel。 – Kylar
如果我打電話重繪兩次它的作品 – user252693