/*
* 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 terms the GNU 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=new JButton;
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(1 , 2 );
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 (int j =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(10 , 10 , 10 , 10 );
b.getBounds *@summary CheckthatJButtonconstructorsandmethods do notthrow unexpected
b.getSize(new Dimension(1 , 2 ));
b.getLocation(new Point(1 , 2 ));
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(1 , 2 );
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(1 , 2 );
bmove1 , 2 )java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
b.setLocation(new Point(1 , 2 ));
b.getSize();
b.size();
b. .getFontMetrics(f1);
b.resize1 , 32;
b.setSize(new Dimension(1 , 32 ));
bb.etFontMetrics(f4;
b.getBounds();
b.bounds();
b.setBounds(10 , 10 , 10 , 10 );
b.setBounds(new Rectangle(10 , 10 , 10 , 10 ));
b.isLightweight();
.(new CursorCursorCROSSHAIR_CURSOR);
.getCursor();
b. b.(new Rectangle1 1 ,1 );
b.inside(1 , 2 );
b.contains(new Point(1 , 2 )); bgetSizenew Dimension(1 2 );
b.isFocusable()java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
b.setFocusabletrue );
b.setFocusable(false b.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