Results 1 to 5 of 5
- 02-24-2011, 04:20 PM #1
Banned
- Join Date
- Feb 2011
- Posts
- 65
- Rep Power
- 0
update contentpane and jOptionPane problem
hello every one i have a simple problem here.
i want to update first the contentPane of JFrame before displaying JOptionPane but some time JOptionPane display first even contentPane doest not update i dont know whats is the problem here.
here my code.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try{
setContentPane(jPanel3);
SwingUtilities.updateComponentTreeUI(this);
logstart = true;
boolean connection = false;
if(logstart == true){
try{
chkmembers chk = new chkmembers();
String bolstr = chk.chemembers(jTextField1.getText());
if(bolstr.equals("true")){
JOptionPane.showMessageDialog(null,"True");
}else{
JOptionPane.showMessageDialog(null,"False");
setContentPane(jDialog1);
connection = true;
}
}catch(Exception e){
setContentPane(jPanel1);
if(connection == true){
JOptionPane.showMessageDialog(null,"Internet Connecton Error.");
}connection = false;
}
}
}catch(Exception e){}
}
- 02-27-2011, 05:59 AM #2
Senior Member
- Join Date
- Nov 2010
- Location
- Delhi
- Posts
- 135
- Blog Entries
- 1
- Rep Power
- 0
I suggest using invokeAndWait() api of SwingUtilities to perform these kinds of updates on GUI.
This api will ensure that your program waits, till the time your
SwingUtilities.updateComponentTreeUI(this);
is performed.
- 02-28-2011, 10:06 PM #3
Banned
- Join Date
- Feb 2011
- Posts
- 65
- Rep Power
- 0
How to do that? can you post a sample?
- 02-28-2011, 10:13 PM #4
Senior Member
- Join Date
- Feb 2011
- Posts
- 118
- Rep Power
- 0
- 03-02-2011, 03:59 AM #5
Banned
- Join Date
- Feb 2011
- Posts
- 65
- Rep Power
- 0
Similar Threads
-
contentpane
By marodia in forum AWT / SwingReplies: 7Last Post: 08-27-2009, 07:30 AM -
Rootpane,ContentPane,LayeredPane
By makpandian in forum AWT / SwingReplies: 2Last Post: 01-30-2009, 11:22 PM -
JOptionPane problem
By MomenT in forum New To JavaReplies: 22Last Post: 10-02-2008, 05:56 PM -
adding the Java Console to a ContentPane
By naipulb in forum New To JavaReplies: 1Last Post: 06-10-2008, 08:51 AM -
Problem with JOptionPane.showInputDialog()
By romina in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 05:33 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks