Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to compare AlertType  RSS feed

Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI frens,
this is my code.

//other necessary code

private Alert customAlert;

* CustomAlert constructor.

CustomAlert(String msg,AlertType type) {

customAlert=new Alert("Exception",msg,Image.createImage("/icError.png"),AlertType.ERROR);
else if(type.equals(AlertType.INFO)){
customAlert=new Alert("Information",msg,Image.createImage("/icInfo.png"),AlertType.INFO);
else if(type.equals(AlertType.WARNING)){
customAlert=new Alert("Warning",msg,Image.createImage("/icWarning.png"),AlertType.WARNING);
customAlert=new Alert("Other Alert",msg,Image.createImage("/icWarning.png"),AlertType.WARNING);



but when i create object saying CustomAlert("error",AlertType.ERROR) none of the statements are executed.

Can anyone tell how to check the type of alert.
if AlertType.SOMETHING was an int i could have checked it , but
AlertType.SOMETHING is of type AlertType itself .
i can't use .equals also because its doing only '==' .
I don't want to go for , say


pleaseeeeeeeee helpppppppp.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!