shaikh_mshariq 2 Junior Poster in Training

Hi, To all posters. I am in a confusion. I want to make a popup using JFrame. I am using JFrame.setUndecorated(true); in one class i made for popup,it works fine when i execute that class but if i use this class to get my customize popup messages it doesnot paint well on the screen.

I tried a lot using validate() method but it doesnt work. Please Help if some one knows the problem. My Code is Below.

public final class Notifier extends JDialog {

      private JLabel label2;


  public Notifier(String msg) {
    setSize(400, 30);
    setResizable(false);
    setLocation(400,400);
    label2 = new JLabel();
    label2.setBackground(Color.blue);
    label2.setHorizontalAlignment(label2.CENTER);
    getContentPane().add(label2,new BorderLayout().CENTER);
    setUndecorated(true); 
    getContentPane().setBackground(Color.WHITE);
    paint(msg);
    setVisible(true);
    getContentPane().validate();
  }
public void paint(String str){
    label2.setText(str);
}
 public static void main(String s[]){
     Notifier noti=new Notifier("Test");
     noti.setVisible(true);

  }



}

Demo Use of this class:

public void focusLost(java.awt.event.FocusEvent e) {
    Notifier nt=new Notifier("Please Wait Querying To The Server . . .");
    nt.setLocationRelativeTo(parentFrame);
    nt.show();
//Processing Logic Here
    nt.hide();
    WindowsClient.getInstance().setVisible(true);

    }

Thanx in Advance. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.