All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class CH.ifa.draw.application.DrawApplication

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Frame
                                   |
                                   +----CH.ifa.draw.application.DrawApplication

public class DrawApplication
extends Frame
implements DrawingEditor, PaletteListener
DrawApplication defines a standard presentation for standalone drawing editors. The presentation is customized in subclasses. The application is started as follows:
 public static void main(String[] args) {
     MayDrawApp window = new MyDrawApp();
     window.open();
 }
 


Variable Index

 o ALIGNMENT_MENU
The index of the alignment menu in the menu bar.
 o ATTRIBUTES_MENU
The index of the attributes menu in the menu bar.
 o EDIT_MENU
The index of the edit menu in the menu bar.
 o FILE_MENU
The index of the file menu in the menu bar.
 o IMAGES

Constructor Index

 o DrawApplication()
Constructs a drawing window with a default title.
 o DrawApplication(String)
Constructs a drawing window with the given title.

Method Index

 o addListeners()
Registers the listeners for this window
 o createAlignmentMenu()
Creates the alignment menu.
 o createArrowMenu()
Creates the arrows menu.
 o createAttributesMenu()
Creates the attributes menu and its submenus.
 o createColorMenu(String, String)
Creates the color menu.
 o createContents(StandardDrawingView)
Creates the contents component of the application frame.
 o createDebugMenu()
Creates the debug menu.
 o createDrawing()
Creates the drawing used in this application.
 o createDrawingView()
Creates the drawing view used in this application.
 o createEditMenu()
Creates the edit menu.
 o createFileMenu()
Creates the file menu.
 o createFontMenu()
Creates the fonts menus.
 o createFontSizeMenu()
Creates the font size menu.
 o createFontStyleMenu()
Creates the font style menu with entries (Plain, Italic, Bold).
 o createMenus(MenuBar)
Creates the standard menus.
 o createSelectionTool()
Creates the selection tool used in this editor.
 o createStatusLine()
Creates the status line.
 o createToolButton(String, String, Tool)
Creates a tool button with the given image, tool, and text
 o createToolPalette()
Creates the tool palette.
 o createTools(Panel)
Creates the tools.
 o defaultSize()
Gets the default size of the window.
 o destroy()
Handles additional clean up operations.
 o drawing()
Gets the current drawing.
 o exit()
Exits the application.
 o getDrawingViewSize()
Override to define the dimensions of the drawing view.
 o open()
Opens the window and initializes its contents.
 o paletteUserOver(PaletteButton, boolean)
Handles when the mouse enters or leaves a palette button.
 o paletteUserSelected(PaletteButton)
Handles a user selection in the palette.
 o print()
Prints the drawing.
 o promptNew()
Resets the drawing to a new empty drawing.
 o promptOpen()
Shows a file dialog and opens a drawing.
 o promptSaveAs()
Shows a file dialog and saves drawing.
 o promptSaveAsSerialized()
Shows a file dialog and saves drawing.
 o selectionChanged(DrawingView)
Handles a change of the current selection.
 o setDrawing(Drawing)
Sets the drawing to be edited.
 o showStatus(String)
Shows a status message.
 o tool()
Gets the current tool.
 o toolDone()
Sets the default tool of the editor.
 o view()
Gets the current drawing view.

Variables

 o IMAGES
 public static final String IMAGES
 o FILE_MENU
 public static final int FILE_MENU
The index of the file menu in the menu bar.

 o EDIT_MENU
 public static final int EDIT_MENU
The index of the edit menu in the menu bar.

 o ALIGNMENT_MENU
 public static final int ALIGNMENT_MENU
The index of the alignment menu in the menu bar.

 o ATTRIBUTES_MENU
 public static final int ATTRIBUTES_MENU
The index of the attributes menu in the menu bar.

Constructors

 o DrawApplication
 public DrawApplication()
Constructs a drawing window with a default title.

 o DrawApplication
 public DrawApplication(String title)
Constructs a drawing window with the given title.

Methods

 o open
 public void open()
Opens the window and initializes its contents. Clients usually only call but don't override it.

 o addListeners
 protected void addListeners()
Registers the listeners for this window

 o createMenus
 protected void createMenus(MenuBar mb)
Creates the standard menus. Clients override this method to add additional menus.

 o createFileMenu
 protected Menu createFileMenu()
Creates the file menu. Clients override this method to add additional menu items.

 o createEditMenu
 protected Menu createEditMenu()
Creates the edit menu. Clients override this method to add additional menu items.

 o createAlignmentMenu
 protected Menu createAlignmentMenu()
Creates the alignment menu. Clients override this method to add additional menu items.

 o createDebugMenu
 protected Menu createDebugMenu()
Creates the debug menu. Clients override this method to add additional menu items.

 o createAttributesMenu
 protected Menu createAttributesMenu()
Creates the attributes menu and its submenus. Clients override this method to add additional menu items.

 o createColorMenu
 protected Menu createColorMenu(String title,
                                String attribute)
Creates the color menu.

 o createArrowMenu
 protected Menu createArrowMenu()
Creates the arrows menu.

 o createFontMenu
 protected Menu createFontMenu()
Creates the fonts menus. It installs all available fonts supported by the toolkit implementation.

 o createFontStyleMenu
 protected Menu createFontStyleMenu()
Creates the font style menu with entries (Plain, Italic, Bold).

 o createFontSizeMenu
 protected Menu createFontSizeMenu()
Creates the font size menu.

 o createToolPalette
 protected Panel createToolPalette()
Creates the tool palette.

 o createTools
 protected void createTools(Panel palette)
Creates the tools. By default only the selection tool is added. Override this method to add additional tools. Call the inherited method to include the selection tool.

Parameters:
palette - the palette where the tools are added.
 o createSelectionTool
 protected Tool createSelectionTool()
Creates the selection tool used in this editor. Override to use a custom selection tool.

 o createToolButton
 protected ToolButton createToolButton(String iconName,
                                       String toolName,
                                       Tool tool)
Creates a tool button with the given image, tool, and text

 o createDrawingView
 protected StandardDrawingView createDrawingView()
Creates the drawing view used in this application. You need to override this method to use a DrawingView subclass in your application. By default a standard DrawingView is returned.

 o getDrawingViewSize
 protected Dimension getDrawingViewSize()
Override to define the dimensions of the drawing view.

 o createDrawing
 protected Drawing createDrawing()
Creates the drawing used in this application. You need to override this method to use a Drawing subclass in your application. By default a standard Drawing is returned.

 o createContents
 protected Component createContents(StandardDrawingView view)
Creates the contents component of the application frame. By default the DrawingView is returned in a ScrollPane.

 o setDrawing
 public void setDrawing(Drawing drawing)
Sets the drawing to be edited.

 o defaultSize
 protected Dimension defaultSize()
Gets the default size of the window.

 o createStatusLine
 protected TextField createStatusLine()
Creates the status line.

 o paletteUserSelected
 public void paletteUserSelected(PaletteButton button)
Handles a user selection in the palette.

See Also:
PaletteListener
 o paletteUserOver
 public void paletteUserOver(PaletteButton button,
                             boolean inside)
Handles when the mouse enters or leaves a palette button.

See Also:
PaletteListener
 o drawing
 public Drawing drawing()
Gets the current drawing.

See Also:
DrawingEditor
 o tool
 public Tool tool()
Gets the current tool.

See Also:
DrawingEditor
 o view
 public DrawingView view()
Gets the current drawing view.

See Also:
DrawingEditor
 o toolDone
 public void toolDone()
Sets the default tool of the editor.

See Also:
DrawingEditor
 o selectionChanged
 public void selectionChanged(DrawingView view)
Handles a change of the current selection. Updates all menu items that are selection sensitive.

See Also:
DrawingEditor
 o showStatus
 public void showStatus(String string)
Shows a status message.

See Also:
DrawingEditor
 o exit
 public void exit()
Exits the application. You should never override this method

 o destroy
 protected void destroy()
Handles additional clean up operations. Override to destroy or release drawing editor resources.

 o promptNew
 public void promptNew()
Resets the drawing to a new empty drawing.

 o promptOpen
 public void promptOpen()
Shows a file dialog and opens a drawing.

 o promptSaveAs
 public void promptSaveAs()
Shows a file dialog and saves drawing.

 o promptSaveAsSerialized
 public void promptSaveAsSerialized()
Shows a file dialog and saves drawing.

 o print
 public void print()
Prints the drawing.


All Packages  Class Hierarchy  This Package  Previous  Next  Index