08/07/30 15:48:05
>>710
いくら丸投げするにしても仕様が荒すぎないかw
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MaruBatsu {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JLabel label = new JLabel(" ", JLabel.CENTER);
JButton button1 = new JButton("カリグラ");
JButton button2 = new JButton("ネロ");
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { label.setText("○"); }
});
button2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { label.setText("×"); }
});
frame.add(button1, BorderLayout.WEST);
frame.add(button2, BorderLayout.EAST);
frame.add(new Label("第3代ローマ皇帝は?"), BorderLayout.NORTH);
frame.add(label, BorderLayout.SOUTH);
frame.pack();
frame.setVisible(true);
}
});
}
}