14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.awt.Component;
25 import java.awt.FlowLayout;
26 import java.awt.Frame;
27 import java.awt.Robot;
28
29 import javax.swing.JButton;
30 import javax.swing.SwingUtilities;
31
32 /**
33 * @test
34 * @bug 8071306
35 * @author Sergey Bylokhov
36 */
37 public final class SetEnabledPerformance {
38
39 private static Frame frame;
40
41 private static void createAndShowGUI() {
42 frame = new Frame();
43 frame.setLayout(new FlowLayout(FlowLayout.CENTER, 25, 0));
44 frame.setSize(600, 600);
45 frame.setLocationRelativeTo(null);
46 for (int i = 1; i < 10001; ++i) {
47 frame.add(new JButton("Button " + i));
48 }
49 frame.setVisible(true);
50 }
51
52 public static void main(final String[] args) throws Exception {
53 SwingUtilities.invokeAndWait(() -> createAndShowGUI());
|
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.awt.Component;
25 import java.awt.FlowLayout;
26 import java.awt.Frame;
27 import java.awt.Robot;
28
29 import javax.swing.JButton;
30 import javax.swing.SwingUtilities;
31
32 /**
33 * @test
34 * @key headful
35 * @bug 8071306
36 * @author Sergey Bylokhov
37 */
38 public final class SetEnabledPerformance {
39
40 private static Frame frame;
41
42 private static void createAndShowGUI() {
43 frame = new Frame();
44 frame.setLayout(new FlowLayout(FlowLayout.CENTER, 25, 0));
45 frame.setSize(600, 600);
46 frame.setLocationRelativeTo(null);
47 for (int i = 1; i < 10001; ++i) {
48 frame.add(new JButton("Button " + i));
49 }
50 frame.setVisible(true);
51 }
52
53 public static void main(final String[] args) throws Exception {
54 SwingUtilities.invokeAndWait(() -> createAndShowGUI());
|