publicstaticvoid main(String[] args) {
String[] instructions =
{ "You must have a printer available to perform this test.", "The test passes if you get a printout of a gray rectangle", "with white text without any exception."
};
publicstatic BufferedImage prepareFrontImage() { // build my own test images
BufferedImage result = new BufferedImage(400, 200,
BufferedImage.TYPE_BYTE_GRAY);
Graphics2D g2D = (Graphics2D)result.getGraphics();
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF); int w = result.getWidth(), h = result.getHeight();
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.