/*
test %I% %E%
@bug 6315717
@summary verifies that MouseEvent could be constructed correctly for mouse extra buttons in regard to sun.awt.enableExtraMouseButtons property
@author Andrei Dmitriev : area=awt.event
*/
/*
* verify that user can't create the MouseEvent? with button4|5|... when property "sun.awt.enableExtraMouseButtons"=false
* verify that user can create the MouseEvent? with button1|2|3 when property "sun.awt.enableExtraMouseButtons"=false
*/
public class CTORRestrictions_Disable {
try {
} catch (AWTException ex) {
}
frame.setVisible(true);
System.out.println(Toolkit.getDefaultToolkit().getDesktopProperty("sun.awt.enableExtraMouseButtons"));
try {
if (buttonId > 3) {
throw new RuntimeException("Stage 1 FAILED: MouseEvent CTOR accepted the extra button " + (buttonId+1) + " instead of throwing an exception.");
}
} catch (IllegalArgumentException e){
if (buttonId > 3) {
} else {
throw new RuntimeException("Stage 1 FAILED : exception happen on standard button.", e);
}
}
}
try {
if (buttonId > 3) {
throw new RuntimeException("Stage 2 FAILED: MouseEvent CTOR accepted the extra button " + (buttonId+1) + " instead of throwing an exception.");
}
} catch (IllegalArgumentException e){
if (buttonId > 3) {
} else {
throw new RuntimeException("Stage 2 FAILED : exception happen on standard button.", e);
}
}
}
}
mousePosition.x, mousePosition.y,
1,
false, //popupTrigger
buttonId //button
);
}
mousePosition.x, mousePosition.y,
1,
false, //popupTrigger
buttonId //button
);
}
}