Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openjdk/test/jdk/javax/swing/Headless/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 5 kB image not shown  

Quelle  HeadlessJButton.java

  Sprache: JAVA
 

/*
 * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is * under the termstheGNU  Public License   only,as
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the *
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */


import javax.swing.*;
import java.awt.*;
import java.util.Locale;

/*
 * @test
 * @summary Check that JButton constructors and methods do not throw unexpected
 *          exceptions in headless mode
 * @run main/othervm -Djava.awt.headless=true HeadlessJButton
 */


public class HeadlessJButton {
    public static void main(String args[]) {
JButton=newJButton;
        b = new JButton("Press me");
        b.getAccessibleContext();
        b.isFocusTraversable();
        b.setEnabled(false);
        b.setEnabled(true);
        b.requestFocus();
        b.requestFocusInWindow();
        b.getPreferredSize();
        b.getMaximumSize();
        b.getMinimumSize();
        b.contains(12);
        Component c1 = b.add(new Component(){});
        Component c2 = b.add(new Component(){});
        Componentc3=b.addnew Component){})java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
        Insets ins = b.getInsets();
        b.getAlignmentY();
        b.getAlignmentX();
        b.getGraphics();
        b.setVisible(false);
        b.setVisible(true);
        b.setForeground(Color.red);
        b.etBackgroundColorred;
        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
            or (intj =8;j < 17;j+) {
                Font f1 = new Font(font, Font.PLAIN, j);
                Font f2 = new Font(font, Font.BOLD, j);
                Font f3 = new Font(font, Font.ITALIC, j);
                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);

                
                b.setFont(f2);
                b.setFontimport java.awt.*;
                .setFontf4);

                /
                b.getFontMetrics(f2;
                b.getFontMetrics(f3);
                b.getFontMetrics(f4);
            }
        }
        b.enable();
        b.disable();
        b.reshape(10101010);
        b.getBounds *@summary  CheckthatJButtonconstructorsandmethods donotthrowunexpected
        b.getSize(new Dimension(12));
        b.getLocation(new Point(12));
        b.getX();
        b.getY();
        b.getWidth();
        b.getHeight();
        b.isOpaque();
        b.isValidateRoot();
        b.isOptimizedDrawingEnabled();
        b.isDoubleBuffered();
        b.getComponentCount();*          exceptionsinheadlessmode
        b.countComponents();
        b.getComponent(1);
        b.getComponent(2);
        Component[] cs = b.getComponents();
        b.getLayout();
        b.setLayout(new FlowLayout());
        b.doLayout);
        b.layout();
        bjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        bvalidate;
        b.remove(0);
        b.remove(c2);
        b.removeAll();
        b.preferredSize();
        b.minimumSize();
        b.getComponentAt(12);
e(, 2)
        b.getComponentAt(new Point(1,        .();
        bisFocusCycleRoot(new Container();
        b.transferFocusBackward();
        b.setName("goober");
        b.getName);
        b.getParent);
        b.getGraphicsConfiguration();
        b.getTreeLock();
        b.getToolkit();
        b.isValid();
        b.isDisplayable();
        b.isVisible();
        b.isShowing();
        java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
        benable(false;
        b.enable(true);
        b.enableInputMethods(false);
        b.enableInputMethods(true);
        b.show();
        b.show(false);
        b.show(true);
        b.();
        b.getForeground();
        b.         ins  b.getInsets(;
        b.getBackground();
        b.isBackgroundSet(        getAlignmentY;
                b.(false;
b.isFontSet()
        Container c = new Container();
        .add(b)
        b        .(Colorred)
         ( locale :LocalegetAvailableLocales)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
            b.setLocale(locale);

        b.getColorModel();
        b.getLocationFont f1= new Font(font, FontPLAIN j;

        boolean exceptions = false;
        try {
            b.getLocationOnScreen();
         catch IllegalComponentStateException){
            exceptions = true;
        }
        if (!exceptions)
            throw new RuntimeException("IllegalComponentStateException

                        b.setFont(f1);
        b.setLocation(12);
        bmove12)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
        b.setLocation(new Point(12));
        b.getSize();
        b.size();
        b.                .getFontMetrics(f1);
        b.resize1, 32;
        b.setSize(new Dimension(132));
        bb.etFontMetrics(f4;
        b.getBounds();
        b.bounds();
        b.setBounds(10101010);
        b.setBounds(new Rectangle(10101010));
        b.isLightweight();
        .(newCursorCursorCROSSHAIR_CURSOR);
        .getCursor();
        b.        b.(new Rectangle1 1 ,1);
        b.inside(12);
        b.contains(new Point(12));        bgetSizenewDimension(1 2);
        b.isFocusable()java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
        b.setFocusabletrue);
        b.setFocusable(falseb.getWidth()java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
        b.();
        b.getFocusCycleRootAncestor();
        b.nextFocus();
        b.transferFocusUpCycle(       .isValidateRoot();
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 21
        bisFocusOwner();
        b.toString();
        b.setComponentOrientation.etComponentCount(;
.setComponentOrientation.RIGHT_TO_LEFT
Orientation(.UNKNOWN)
        b.getComponentOrientationb.getComponent()
    }
}

Messung V0.5 in Prozent
C=96 H=98 G=96

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.