import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TestIgoImagePanel extends JFrame implements ActionListener{ private IgoImagePanel jp_ban; private JButton bt_forward; private JPanel jp_button; private IntBoard intBoard; private int counts; TestIgoImagePanel(){ super("TestIgoImagePanelのフレーム"); setSize(650,730); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jp_ban=new IgoImagePanel(); jp_ban.setSize(630,630); jp_ban.setLocation(0,0); getContentPane().setLayout(new BorderLayout()); getContentPane().add(jp_ban,BorderLayout.CENTER); bt_forward=new JButton(">"); bt_forward.addActionListener(this); jp_button=new JPanel(); jp_button.setSize(550,65); jp_button.setLocation(25,570+10); jp_button.setLayout(new GridLayout(1,1)); jp_button.add(bt_forward); getContentPane().add(jp_button,BorderLayout.SOUTH); intBoard=new IntBoard(); counts=-1; } public void actionPerformed(ActionEvent ae){ if((JButton)ae.getSource()==bt_forward){ counts++; switch(counts){ case 0: intBoard.update(1,4,15); jp_ban.update(intBoard); break; case 1: intBoard.update(2,3,15); jp_ban.update(intBoard); break; case 2: intBoard.update(1,15,15); jp_ban.update(intBoard); break; case 3: intBoard.update(2,3,2); jp_ban.update(intBoard); break; } } } public static void main(String[] args){ TestIgoImagePanel frame=new TestIgoImagePanel(); frame.setVisible(true); } }