Problem Viewing Undecorated JFrame

Reply

Join Date: Mar 2006
Posts: 71
Reputation: shaikh_mshariq is an unknown quantity at this point 
Solved Threads: 1
shaikh_mshariq's Avatar
shaikh_mshariq shaikh_mshariq is offline Offline
Junior Poster in Training

Problem Viewing Undecorated JFrame

 
0
  #1
Feb 13th, 2008
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.
Ideas are the building blocks of Ideas

Jason Zebehazy
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC