• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Tabbed Pane

Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to display a dialog when a
button is pressed in one of the tabs of the tabbed
Pane.How to do this??I cannot add Dialog to
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm fairly new at this myself but can't you just display a JOptionPane when the button is pressed? Something like this should work:
myButton.addActionListener(new ActionListener() {
public void actionPerformed( ActionEvent e ){
JOptionPane.showMessageDialog( topContainer.this,
"This is the message that apears",
"message", JOptionPane.PLAIN_MESSAGE );
myButton is a button, the topContainer in the parameters to showDialoge is a reference to the parent frame that will display the dialog. the single word message is what appears in the title bar of the message.
I think that'll work for you. If it doesn't work it might be looking for an actual Frame or JFrame to display in. If that is the case then try making the reference to the parent null, then it should give you a default frame. But I don't think you'll have any problems, according to the api it is looking for a component so the JTabbedPane should be fine for you.
Hope that helps

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!