Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2005

Tip: Looking for answers? Try searching our database.

Panel text not showing in JFrame

Thread view: 
rjl444 - 10 Feb 2005 15:05 GMT
I have a JFrame to display after a button is clicked. The following
JFrame appears, but the label text does not appear until the thread is
completed. Any advise:

public void run(){
JPanel panel = new JPanel();  // create pane content object
JLabel prompt = new JLabel("Processing log files");

panel.add(prompt);

Container contentPane = myFrame.getContentPane();
contentPane.add(panel);

myFrame.setTitle("Processing logs...Please Wait");
myFrame.setBounds(100,100,350,75); // position frame
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.toFront();
panel.add(prompt);
myFrame.setVisible(true);
myFrame.pack();
System.out.println ("pack1 done");
myFrame.repaint();
myFrame.pack();
}
klynn47@comcast.net - 10 Feb 2005 15:16 GMT
Why are you putting these lines in the run() method?

The reason it's not displaying until the thread is completed is because
you set the JFrame visible near the end of run
rjl444 - 10 Feb 2005 15:28 GMT
I place this in a run as I tried threading this particular method, but
it did not make a difference. I also tried it in a regular method. What
is not showing is that I am processing a file (reading) immediately
after this method runs. The window appears immediatley, while the file
is read,  but the panel text waits until the file is read to show.I
want the panel to display 'please wait'
thanks for any additional help.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.