/*
test %W% %E% %I%, %G%
@bug 6315717
@summary manual control over the Robot
@author Andrei Dmitriev : area=awt.robot
@run applet/manual=yesno ManualInstructions.html
*/
{
}
public void init()
{
try {
} catch (AWTException ex) {
throw new RuntimeException(ex);
}
this.setLayout (new BorderLayout ());
// on X systems two buttons are reserved for wheel though they are countable by MouseInfo.
int buttonsNumber = toolkit.equals("sun.awt.windows.WToolkit")?MouseInfo.getNumberOfButtons():MouseInfo.getNumberOfButtons()-2;
for (int i = 0; i < 8; i++){
}
public void actionPerformed(ActionEvent e){
public void run(){
}
};
}
});
public void actionPerformed(ActionEvent e){
public void run(){
}
};
}
});
public void actionPerformed(ActionEvent e){
public void run(){
}
};
}
});
public void mousePressed(MouseEvent e){
}
public void mouseReleased(MouseEvent e){
}
public void mouseClicked(MouseEvent e){
}
});
String[] instructions =
{
"Do provide an instruction to the robot by",
"choosing the button number to act and ",
"pressing appropriate java.awt.Button on the left.",
"Inspect an output in the TextArea below.",
"Please don't generate non-natural sequences like Release-Release, etc.",
"If you use keyboard be sure that you released the keyboard shortly.",
"If events are generated well press Pass, otherwise Fail."
};
}//End init()
/*
//this only works for standard buttons and for old JDK builds
int mask = 0;
switch (button){
case 1: {
mask = InputEvent.BUTTON1_MASK;
break;
}
case 2: {
mask = InputEvent.BUTTON2_MASK;
break;
}
case 3: {
mask = InputEvent.BUTTON3_MASK;
break;
}
}
return mask;
*/
}
return new Point(target.getLocationOnScreen().x + target.getWidth()/2, target.getLocationOnScreen().y + target.getHeight()/2);
}
public void start ()
{
//Get things going. Request focus, set size, et cetera
setVisible(true);
validate();
f.setLayout(new FlowLayout());
f.add(buttonNumber);
f.pack();
f.setVisible(true);
}// start()
}// class
/* Place other classes related to the test after this line */
/****************************************************
Standard Test Machinery
DO NOT modify anything below -- it's a standard
chunk of code whose purpose is to make user
interaction uniform, and thereby make it simpler
to read and understand someone else's test.
****************************************************/
/**
This is part of the standard test machinery.
It creates a dialog (with the instructions), and is the interface
for sending text messages to the user.
To print the instructions, send an array of strings to Sysout.createDialog
WithInstructions method. Put one line of instructions per array entry.
To display a message for the tester to see, simply call Sysout.println
with the string to be displayed.
This mimics System.out.println but works within the test harness as well
as standalone.
*/
class Sysout
{
{
dialog.setVisible(true);
println( "Any messages for the tester will display here." );
}
public static void createDialog( )
{
dialog.setVisible(true);
println( "Any messages for the tester will display here." );
}
{
}
{
}
}// Sysout class
/**
This is part of the standard test machinery. It provides a place for the
test instructions to be displayed, and a place for interactive messages
to the user to be displayed.
To have the test instructions displayed, see Sysout.
To have a message to the user be displayed, see Sysout.
Do not call anything in this dialog directly.
*/
{
//DO NOT call this directly, go through Sysout
{
pack();
setVisible(true);
}// TestDialog()
//DO NOT call this directly, go through Sysout
{
//Clear out any current instructions
//Go down array of instruction strings
{
//chop up each into pieces maxSringLength long
remainingStr = instructions[ i ];
{
//if longer than max then chop off first max chars to print
{
//Try to chop on a word boundary
int posOfSpace = remainingStr.
}
//else just print
else
{
remainingStr = "";
}
}// while
}// for
}//printInstructions()
//DO NOT call this directly, go through Sysout
{
}
}// TestDialog class