publicclass SetFontTest extends Applet
{
List list = new List(8, false);
Button button1 = new Button("Enlarge font");
Button button2 = new Button("Change mode");
button1.addActionListener( new ActionListener(){ publicvoid actionPerformed(ActionEvent ae){
list.setFont( new Font( "SansSerif", Font.PLAIN, 30 ) );
list.repaint();
}
});
button2.addActionListener( new ActionListener(){ publicvoid actionPerformed(ActionEvent ae){
list.setMultipleMode(true);
}
});
this.setLayout (new FlowLayout ());
String[] instructions =
{ "1) Click on the 'Enlarge font' button to enlarge font of the list.", "2) If you see that the rows of the list overlap one another "+ "then the test failed. Otherwise, goto to the step 3.", "3) Click on the 'Change mode' button to set multiple-selection mode.", "4) If you see that the rows of the list overlap one another "+ "then the test failed. Otherwise, the test passed."
};
Sysout.createDialogWithInstructions( instructions );
}//End init()
publicvoid start ()
{
setSize (200,200);
setVisible(true);
validate();
}// start()
}
/* Place other classes related to the test after this line */
TextArea instructionsText;
TextArea messageText; int maxStringLength = 80;
//DO NOT call this directly, go through Sysout public TestDialog( Frame frame, String name )
{ super( frame, name ); int scrollBoth = TextArea.SCROLLBARS_BOTH;
instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
add( "North", instructionsText );
//DO NOT call this directly, go through Sysout publicvoid printInstructions( String[] instructions )
{ //Clear out any current instructions
instructionsText.setText( "" );
//Go down array of instruction strings
String printStr, remainingStr; for( int i=0; i < instructions.length; i++ )
{ //chop up each into pieces maxSringLength long
remainingStr = instructions[ i ]; while( remainingStr.length() > 0 )
{ //if longer than max then chop off first max chars to print if( remainingStr.length() >= maxStringLength )
{ //Try to chop on a word boundary int posOfSpace = remainingStr.
lastIndexOf( ' ', maxStringLength - 1 );
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.