-
Bug
-
Resolution: Fixed
-
P3
-
6
-
None
-
b45
-
generic
-
generic
-
Verified
PopupMenu.show() is not always throwing IllegalArgumentException
Incorrect exception throwing can be demonstrated on following example:
import java.awt.*;
import java.awt.event.*;
public class PopupMenuShowExceptions
{
public static void main(String args[]) throws Exception {
Frame f = new Frame();
Button b = new Button();
Label l = new Label();
PopupMenu pm1 = new PopupMenu();
f.add(l);
f.show();
Robot r = null;
try {
r = new Robot();
} catch (Exception ex) {
Sysout.println("Error creating robot");
return;
}
r.delay(1000);
try {
l.add(pm1);
pm1.show(b, 0, 0);
r.delay(1000);
Sysout.println("Exception is not thrown when showing Popup Menu on component not in parent's hierarchy");
return;
} catch (IllegalArgumentException ex) {
Sysout.println( "Correct exception when showing popup menu on non-created component");
Sysout.println("Exception: " + ex);
return;
} catch (Exception ex) {
Sysout.println("Incorrect exception thrown: " + ex);
return;
}
Sysout.println();
}//End init()
}
###@###.### 2005-06-01 13:08:25 GMT
Incorrect exception throwing can be demonstrated on following example:
import java.awt.*;
import java.awt.event.*;
public class PopupMenuShowExceptions
{
public static void main(String args[]) throws Exception {
Frame f = new Frame();
Button b = new Button();
Label l = new Label();
PopupMenu pm1 = new PopupMenu();
f.add(l);
f.show();
Robot r = null;
try {
r = new Robot();
} catch (Exception ex) {
Sysout.println("Error creating robot");
return;
}
r.delay(1000);
try {
l.add(pm1);
pm1.show(b, 0, 0);
r.delay(1000);
Sysout.println("Exception is not thrown when showing Popup Menu on component not in parent's hierarchy");
return;
} catch (IllegalArgumentException ex) {
Sysout.println( "Correct exception when showing popup menu on non-created component");
Sysout.println("Exception: " + ex);
return;
} catch (Exception ex) {
Sysout.println("Incorrect exception thrown: " + ex);
return;
}
Sysout.println();
}//End init()
}
###@###.### 2005-06-01 13:08:25 GMT