Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need a Property Sheet with Apply/OK/Cancel: is this the recommended way?  RSS feed

 
Steve Stevenson
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I was using Visual C++ & MFC, there was a special window for property sheets that displayed a tabbed UI with a series of buttons on the bottom labeled "OK", "Cancel", and "Apply". From what I can tell, Swing does not have such a class. The closest I've been able to find is JTabbedPane, but it does not contain the trio of buttons I mentioned. While I can certainly use the JTabbedPane and create my own code to handle those buttons, I'm just curious if Java already has something for this type of window that I just haven't stumbled across.

I'm not looking for a 3rd party library. I just want to know if Java itself (I guess through Swing) has already invented this wheel so that I don't go about reinventing it. I'm trying to learn this language and want to make sure I use as much of the real & standardized stuff as possible. Basically since I'm learning I want to make sure I do something right even if my own personal detour works.


EDIT: I don't really need any source code: I'm just looking for a pointer to point me in the established direction on how these are typically made in Java.
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that Swing has a component with exactly that combination of buttons, but I think that you should be looking at JDialog and JOptionPane rather than JTabbedPane. Check out the tutorial How to Make Dialogs for much better information than what I've got.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can pass a JTabbedPane (or any other component, or even an array of components [which will be stacked vertically]) as the message argument to a JOptionPane static show...Dialog method.

Edit And you can either use the YES_NO_CANCEL_OPTION and customize the button texts, or use an appropriate form of showOptionDialog(..) to get the three buttons you need.
 
Steve Stevenson
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent! I will check out those leads and come up with something to create that property sheet.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!