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();
}
-
ALIGNMENT_MENU
- The index of the alignment menu in the menu bar.
-
ATTRIBUTES_MENU
- The index of the attributes menu in the menu bar.
-
EDIT_MENU
- The index of the edit menu in the menu bar.
-
FILE_MENU
- The index of the file menu in the menu bar.
-
IMAGES
-
-
DrawApplication()
- Constructs a drawing window with a default title.
-
DrawApplication(String)
- Constructs a drawing window with the given title.
-
addListeners()
- Registers the listeners for this window
-
createAlignmentMenu()
- Creates the alignment menu.
-
createArrowMenu()
- Creates the arrows menu.
-
createAttributesMenu()
- Creates the attributes menu and its submenus.
-
createColorMenu(String, String)
- Creates the color menu.
-
createContents(StandardDrawingView)
- Creates the contents component of the application
frame.
-
createDebugMenu()
- Creates the debug menu.
-
createDrawing()
- Creates the drawing used in this application.
-
createDrawingView()
- Creates the drawing view used in this application.
-
createEditMenu()
- Creates the edit menu.
-
createFileMenu()
- Creates the file menu.
-
createFontMenu()
- Creates the fonts menus.
-
createFontSizeMenu()
- Creates the font size menu.
-
createFontStyleMenu()
- Creates the font style menu with entries (Plain, Italic, Bold).
-
createMenus(MenuBar)
- Creates the standard menus.
-
createSelectionTool()
- Creates the selection tool used in this editor.
-
createStatusLine()
- Creates the status line.
-
createToolButton(String, String, Tool)
- Creates a tool button with the given image, tool, and text
-
createToolPalette()
- Creates the tool palette.
-
createTools(Panel)
- Creates the tools.
-
defaultSize()
- Gets the default size of the window.
-
destroy()
- Handles additional clean up operations.
-
drawing()
- Gets the current drawing.
-
exit()
- Exits the application.
-
getDrawingViewSize()
- Override to define the dimensions of the drawing view.
-
open()
- Opens the window and initializes its contents.
-
paletteUserOver(PaletteButton, boolean)
- Handles when the mouse enters or leaves a palette button.
-
paletteUserSelected(PaletteButton)
- Handles a user selection in the palette.
-
print()
- Prints the drawing.
-
promptNew()
- Resets the drawing to a new empty drawing.
-
promptOpen()
- Shows a file dialog and opens a drawing.
-
promptSaveAs()
- Shows a file dialog and saves drawing.
-
promptSaveAsSerialized()
- Shows a file dialog and saves drawing.
-
selectionChanged(DrawingView)
- Handles a change of the current selection.
-
setDrawing(Drawing)
- Sets the drawing to be edited.
-
showStatus(String)
- Shows a status message.
-
tool()
- Gets the current tool.
-
toolDone()
- Sets the default tool of the editor.
-
view()
- Gets the current drawing view.
IMAGES
public static final String IMAGES
FILE_MENU
public static final int FILE_MENU
- The index of the file menu in the menu bar.
EDIT_MENU
public static final int EDIT_MENU
- The index of the edit menu in the menu bar.
ALIGNMENT_MENU
public static final int ALIGNMENT_MENU
- The index of the alignment menu in the menu bar.
ATTRIBUTES_MENU
public static final int ATTRIBUTES_MENU
- The index of the attributes menu in the menu bar.
DrawApplication
public DrawApplication()
- Constructs a drawing window with a default title.
DrawApplication
public DrawApplication(String title)
- Constructs a drawing window with the given title.
open
public void open()
- Opens the window and initializes its contents.
Clients usually only call but don't override it.
addListeners
protected void addListeners()
- Registers the listeners for this window
createMenus
protected void createMenus(MenuBar mb)
- Creates the standard menus. Clients override this
method to add additional menus.
createFileMenu
protected Menu createFileMenu()
- Creates the file menu. Clients override this
method to add additional menu items.
createEditMenu
protected Menu createEditMenu()
- Creates the edit menu. Clients override this
method to add additional menu items.
createAlignmentMenu
protected Menu createAlignmentMenu()
- Creates the alignment menu. Clients override this
method to add additional menu items.
createDebugMenu
protected Menu createDebugMenu()
- Creates the debug menu. Clients override this
method to add additional menu items.
createAttributesMenu
protected Menu createAttributesMenu()
- Creates the attributes menu and its submenus. Clients override this
method to add additional menu items.
createColorMenu
protected Menu createColorMenu(String title,
String attribute)
- Creates the color menu.
createArrowMenu
protected Menu createArrowMenu()
- Creates the arrows menu.
createFontMenu
protected Menu createFontMenu()
- Creates the fonts menus. It installs all available fonts
supported by the toolkit implementation.
createFontStyleMenu
protected Menu createFontStyleMenu()
- Creates the font style menu with entries (Plain, Italic, Bold).
createFontSizeMenu
protected Menu createFontSizeMenu()
- Creates the font size menu.
createToolPalette
protected Panel createToolPalette()
- Creates the tool palette.
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.
createSelectionTool
protected Tool createSelectionTool()
- Creates the selection tool used in this editor. Override to use
a custom selection tool.
createToolButton
protected ToolButton createToolButton(String iconName,
String toolName,
Tool tool)
- Creates a tool button with the given image, tool, and text
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.
getDrawingViewSize
protected Dimension getDrawingViewSize()
- Override to define the dimensions of the drawing view.
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.
createContents
protected Component createContents(StandardDrawingView view)
- Creates the contents component of the application
frame. By default the DrawingView is returned in
a ScrollPane.
setDrawing
public void setDrawing(Drawing drawing)
- Sets the drawing to be edited.
defaultSize
protected Dimension defaultSize()
- Gets the default size of the window.
createStatusLine
protected TextField createStatusLine()
- Creates the status line.
paletteUserSelected
public void paletteUserSelected(PaletteButton button)
- Handles a user selection in the palette.
- See Also:
- PaletteListener
paletteUserOver
public void paletteUserOver(PaletteButton button,
boolean inside)
- Handles when the mouse enters or leaves a palette button.
- See Also:
- PaletteListener
drawing
public Drawing drawing()
- Gets the current drawing.
- See Also:
- DrawingEditor
tool
public Tool tool()
- Gets the current tool.
- See Also:
- DrawingEditor
view
public DrawingView view()
- Gets the current drawing view.
- See Also:
- DrawingEditor
toolDone
public void toolDone()
- Sets the default tool of the editor.
- See Also:
- DrawingEditor
selectionChanged
public void selectionChanged(DrawingView view)
- Handles a change of the current selection. Updates all
menu items that are selection sensitive.
- See Also:
- DrawingEditor
showStatus
public void showStatus(String string)
- Shows a status message.
- See Also:
- DrawingEditor
exit
public void exit()
- Exits the application. You should never override this method
destroy
protected void destroy()
- Handles additional clean up operations. Override to destroy
or release drawing editor resources.
promptNew
public void promptNew()
- Resets the drawing to a new empty drawing.
promptOpen
public void promptOpen()
- Shows a file dialog and opens a drawing.
promptSaveAs
public void promptSaveAs()
- Shows a file dialog and saves drawing.
promptSaveAsSerialized
public void promptSaveAsSerialized()
- Shows a file dialog and saves drawing.
print
public void print()
- Prints the drawing.
All Packages Class Hierarchy This Package Previous Next Index