- Forward


Windowing: Some Advanced Topics
with Examples in Java


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Windows: A Review
Back SMYC Forward
  • Defined:
    • A generic container of GUI components that can be moved by the user
  • Uses:
    • Messages, request input, visually divide an application...
  • Modal vs. Modeless:
    • Blocking vs. Non-blocking
Custom Dialog Boxes
Back SMYC Forward

A Panel for Entering Numbers

javaexamples/gui/SliderPanel.java
 
javaexamples/usinggui/TextMessageDialog.java
 
javaexamples/usinggui/TextMessageDialogDriver.java
 
Custom Dialog Boxes (cont.)
Back SMYC Forward

A Custom Dialog that uses the SliderPanel

javaexamples/usinggui/TextMessageDialog.java
 
Custom Dialog Boxes (cont.)
Back SMYC Forward

A Driver

javaexamples/usinggui/TextMessageDialogDriver.java
 
Popup Menus
Back SMYC Forward
  • Model and Controller:
    • Same as traditional menus
  • View:
    • Appear in their own window
    • Have to worry about positioning
    • Have to worry about heavyweight/lightweight
Popup Menus
Back SMYC Forward

An Example

javaexamples/usinggui/Editor.java
 
Internal Windows
Back SMYC Forward
  • The Components:
    • JInternalFrame
    • JDesktopPane
  • A Big Difference from Traditional Windows:
    • The application must handle "layering" (e.g., cascading, tiling)
Internal Windows (cont.)
Back SMYC Forward

An Example

javaexamples/usinggui/InternalWindowDriver.java
 
Tool Tips
Back SMYC Forward
  • What Are They?
    • Pop-up windows that are used to provide help/tips
  • How Are They Used?
    • A JToolTip can be added to any JComponent using the method public void setToolTipText(String text)
Tool Tips (cont.)
Back SMYC Forward

An Example

javaexamples/layout/JToolTipDriver.java
 
There's Always More to Learn
Back -