• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to compare AlertType

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI frens,
this is my code.

******************************************************
//other necessary code

private Alert customAlert;

/**
* CustomAlert constructor.
*/

CustomAlert(String msg,AlertType type) {

if(type==AlertType.ERROR)
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);
System.out.println("info");
}
else if(type.equals(AlertType.WARNING)){
customAlert=new Alert("Warning",msg,Image.createImage("/icWarning.png"),AlertType.WARNING);
}
else{
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

CustomAlert("message",1);
or
CustomAlert("message","error");

pleaseeeeeeeee helpppppppp.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic