|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
org.jhotdraw.application.DrawApplication
public class DrawApplication
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(); }
Field Summary | |
---|---|
static int |
ALIGNMENT_MENU
The index of the alignment menu in the menu bar. |
static int |
ATTRIBUTES_MENU
The index of the attributes menu in the menu bar. |
static int |
EDIT_MENU
The index of the edit menu in the menu bar. |
static int |
FILE_MENU
The index of the file menu in the menu bar. |
static java.lang.String |
IMAGES
|
Fields inherited from class javax.swing.JFrame |
---|
EXIT_ON_CLOSE |
Fields inherited from class java.awt.Frame |
---|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DrawApplication()
Constructs a drawing window with a default title. |
|
DrawApplication(java.lang.String title)
Constructs a drawing window with the given title. |
Method Summary | |
---|---|
void |
addViewChangeListener(ViewChangeListener vsl)
Register to hear when the active view is changed. |
javax.swing.JMenu |
createLookAndFeelMenu()
Create a menu which allows the user to select a different look and feel at runtime. |
StorageFormatManager |
createStorageFormatManager()
Factory method to create a StorageFormatManager for supported storage formats. |
void |
exit()
Exits the application. |
void |
figureSelectionChanged(DrawingView view)
Fired by a view when the figure selection changes. |
java.lang.String |
getApplicationName()
Return the name of the application build from this skeleton application |
java.lang.String |
getDefaultDrawingTitle()
|
Tool |
getDefaultTool()
|
Desktop |
getDesktop()
Get the component, in which the content is embedded. |
java.lang.String[] |
getRequiredVersions()
Subclasses should override this method to specify to which versions of JHotDraw they are compatible. |
StorageFormatManager |
getStorageFormatManager()
Return the StorageFormatManager for this application.The StorageFormatManager is used when storing and restoring Drawing from the file system. |
UndoManager |
getUndoManager()
|
void |
newView()
Open a new view for this application containing a view of the drawing of the currently activated window. |
void |
newWindow()
|
void |
newWindow(Drawing initialDrawing)
Open a new window for this application containing the passed in drawing, or a new drawing if the passed in drawing is null. |
void |
open()
Opens a new window |
void |
paletteUserOver(PaletteButton paletteButton,
boolean inside)
Handles when the mouse enters or leaves a palette button. |
void |
paletteUserSelected(PaletteButton paletteButton)
Handles a user selection in the palette. |
void |
print()
Prints the drawing. |
void |
promptNew()
Resets the drawing to a new empty drawing. |
void |
promptOpen()
Shows a file dialog and opens a drawing. |
void |
promptSaveAs()
Shows a file dialog and saves drawing. |
void |
removeViewChangeListener(ViewChangeListener vsl)
Remove listener |
void |
setApplicationName(java.lang.String applicationName)
Set the name of the application build from this skeleton application |
void |
setTool(Tool t,
java.lang.String name)
Note: it is inconsistent to directly assign a variable but when using it use it from a method. |
void |
showStatus(java.lang.String string)
Shows a status message. |
Tool |
tool()
Gets the current tool. |
void |
toolDone()
Sets the default tool of the editor. |
DrawingView |
view()
Retrieve the active view from the window Gets the current drawing view. |
DrawingView[] |
views()
|
Methods inherited from class javax.swing.JFrame |
---|
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, update |
Methods inherited from class java.awt.Frame |
---|
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
---|
getFont, postEvent |
Field Detail |
---|
public static final java.lang.String IMAGES
public static final int FILE_MENU
public static final int EDIT_MENU
public static final int ALIGNMENT_MENU
public static final int ATTRIBUTES_MENU
Constructor Detail |
---|
public DrawApplication()
public DrawApplication(java.lang.String title)
Method Detail |
---|
public void newView()
public void newWindow(Drawing initialDrawing)
public final void newWindow()
public void open()
public javax.swing.JMenu createLookAndFeelMenu()
public Tool getDefaultTool()
public Desktop getDesktop()
public StorageFormatManager createStorageFormatManager()
public StorageFormatManager getStorageFormatManager()
public void paletteUserSelected(PaletteButton paletteButton)
paletteUserSelected
in interface PaletteListener
PaletteListener
public void paletteUserOver(PaletteButton paletteButton, boolean inside)
paletteUserOver
in interface PaletteListener
PaletteListener
public Tool tool()
tool
in interface DrawingEditor
DrawingEditor
public DrawingView view()
view
in interface DrawingEditor
DrawingEditor
public DrawingView[] views()
views
in interface DrawingEditor
public void toolDone()
toolDone
in interface DrawingEditor
DrawingEditor
public void figureSelectionChanged(DrawingView view)
figureSelectionChanged
in interface DrawingEditor
figureSelectionChanged
in interface FigureSelectionListener
view
- DrawingViewDrawingEditor
public void addViewChangeListener(ViewChangeListener vsl)
addViewChangeListener
in interface DrawingEditor
public void removeViewChangeListener(ViewChangeListener vsl)
removeViewChangeListener
in interface DrawingEditor
public void showStatus(java.lang.String string)
showStatus
in interface DrawingEditor
DrawingEditor
public void setTool(Tool t, java.lang.String name)
public void exit()
public void promptNew()
public void promptOpen()
public void promptSaveAs()
public void print()
public void setApplicationName(java.lang.String applicationName)
public java.lang.String getApplicationName()
public UndoManager getUndoManager()
getUndoManager
in interface DrawingEditor
public java.lang.String[] getRequiredVersions()
getRequiredVersions
in interface VersionRequester
public java.lang.String getDefaultDrawingTitle()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |