• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tabbed Pane  RSS feed

 
Shanthala Rao
Greenhorn
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
tabbedPane..
 
Dave Vick
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

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