Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

the term modal

 
kenji mapes
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Professor used the terms modal and non-modal during a GUI design class module.

Would anyone care to elaboarate on the terms for me?

Thanks.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If something is "modal" it has "modes". A "mode" is a situation in which you're only allowed to do one thing. For example a "model dialog box" is one that forces you to interact with it, preventing you from using the rest of the application's windows; a non-modal dialog box leaves the windows behind it still responsive.

Another example: most graphics programs are modal; each tool is a mode. In pencil mode you draw pencil lines, in eraser mode you erase, etc.
 
kenji mapes
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, just what i was looking for.
 
kenji mapes
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ugh, forgot to ask. JOptionPanes are mostly non-modal that I know of. How about JDialogs?
 
Morgan Christian
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually use jdialogs for 100% required input or errors/notices etc...

modality (is that really a word?) can be set by myDialog.setModel(boolean).
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kenji mapes:
Ugh, forgot to ask. JOptionPanes are mostly non-modal that I know of. How about JDialogs?


The only type of dialog generated by JOptionPane that is not modal is a message dialog. The other three are modal: confirm, option and input. JDialog has several constructors and those that do not have parameter for modality are non-modal. Those that do have a parameter for it use the parameter. Any Dialog can have it's modality changed using setModal(boolean).

You should see the JDialog documentation for more information. JOptionPane, regrettably, does not document very well the modality of it's dialogs, but I've already mentioned what each one is.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic