• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JOptionPane affecting JTabbedPane

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am using a JTabbedPane with 4 different tabs displaying a form on each.
I have a button below the JTabbedPane that when pressed checks if all the required fields have been entered. If not then i use a JOptionPane to notify the user.

The problem is when the user clicks "OK" the JTabbedPane disappears and the screen is left with the contents of the first tab.

Anyone know what I am doing wrong?
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
post a small compilable program that demonstrates the behaviour

just a frame, a JTabbedPane with 4 tabs (each holding just a JPanel),
the button, and the code that dislays the JOptionPane
 
Ben Wong
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem is, each panel has its own class that extends JPanel. The JButton listener checks if the relevant fields have been complete on each JPanel by calling a method to each class.

I've tried relocating the JOptionPane.showMessageDialog() method to each of the JPanel classes instead of the JTabbedPane class but the same thing happens: the JTabbedPane disappears when the "OK" button is pressed.
[ April 05, 2006: Message edited by: Ben Wong ]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, lets do this in reverse.

here's a simple example of your description - add the code to make it disappear

 
reply
    Bookmark Topic Watch Topic
  • New Topic