1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
import java.awt.Checkbox;
import java.awt.GridLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.*;
import javax.swing.*;
public class graphicInterface {
public static void main(String[] argv) {
JFrame frame = new JFrame("Test1");
frame.setContentPane(new CheckBoxes());
frame.setLocationRelativeTo(frame.getParent());
frame.setVisible(true);
}
}
class CheckBoxes extends JCheckBox {
CheckBoxes() {
JScrollPane ButtonPanel = new JScrollPane();
ButtonPanel.setLayout(new ScrollPaneLayout());
for (int j=0; j<100 ; j++) {
ButtonPanel.add(new JCheckBox("test" + j, false));
}
add(ButtonPanel);
}
} |