import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class JButtonSampleFlow04
extends JFrame {
public JButtonSampleFlow04() throws HeadlessException {
upperPanel.
setBackground(Color.
BLUE);
lowerPanel.
setBackground(Color.
BLUE);
container.add(upperPanel);
container.add(middlePanel);
container.add(lowerPanel);
MyButton button1 = new MyButton("Button-1");
MyButton button2 = new MyButton("Button-2");
MyButton button3 = new MyButton("Button-3");
MyButton button4 = new MyButton("Button-4");
MyButton button5 = new MyButton("Button-5");
MyButton button6 = new MyButton("Button-6");
middlePanel.add(button1);
middlePanel.add(button2);
middlePanel.add(button3);
middlePanel.add(smallerPanel1);
middlePanel.add(smallerPanel2);
smallerPanel2.add(button4);
smallerPanel2.add(button5);
smallerPanel2.add(button6);
}
super(s);
this.s = s;
}
});
}
}
public static void main
(String[] args
) { JButtonSampleFlow04 frame = new JButtonSampleFlow04();
frame.setTitle("課題1");
frame.
setDefaultCloseOperation(JFrame.
EXIT_ON_CLOSE); frame.
setBounds(new Rectangle(500 + 8,
300 + 34)); frame.setVisible(true);
}
}
aW1wb3J0IGphdmF4LnN3aW5nLio7CmltcG9ydCBqYXZhLmF3dC4qOwppbXBvcnQgamF2YS5hd3QuZXZlbnQuQWN0aW9uRXZlbnQ7CmltcG9ydCBqYXZhLmF3dC5ldmVudC5BY3Rpb25MaXN0ZW5lcjsKCnB1YmxpYyBjbGFzcyBKQnV0dG9uU2FtcGxlRmxvdzA0IGV4dGVuZHMgSkZyYW1lIHsKCiAgICBwdWJsaWMgSkJ1dHRvblNhbXBsZUZsb3cwNCgpIHRocm93cyBIZWFkbGVzc0V4Y2VwdGlvbiB7CgogICAgICAgIENvbnRhaW5lciBjb250YWluZXIgPSBnZXRDb250ZW50UGFuZSgpOwogICAgICAgIGNvbnRhaW5lci5zZXRMYXlvdXQobmV3IEdyaWRMYXlvdXQoMywgMSkpOwoKICAgICAgICBKUGFuZWwgdXBwZXJQYW5lbCA9IG5ldyBKUGFuZW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