| | |
Problem Viewing Undecorated JFrame
![]() |
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.
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
Jason Zebehazy
![]() |
Other Threads in the Java Forum
- Previous Thread: help to sum integers in an array
- Next Thread: Text to speech in ubuntu using java.
| Thread Tools | Search this Thread |
2dgraphics account android api apple applet application arguments array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class client code color component count database derby design eclipse eclipsedevelopment encryption error fractal game givemetehcodez graphics gridlayout gui html ide if_statement image input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel julia keyword linux list loop macintosh map method methods midlethttpconnection mobile netbeans newbie nullpointerexception object open-source os problem producer program programming project projectideas property read recursion reference replaysolutions ria scanner search server set size sms sort sourcelabs splash sql stop string swing testautomation threads transforms tree ui unicode validation windows





