Package net.sourceforge.jiu.gui.awt

# Class JiuAwtFrame

java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
net.sourceforge.jiu.gui.awt.JiuAwtFrame

All Implemented Interfaces:
  `ActionListener`, `ComponentListener`, `ImageObserver`, `MenuContainer`, `Serializable`, `EventListener`, `Accessible`, `JiuInfo`, `ProgressListener`

public class JiuAwtFrame extends Frame implements ActionListener, ComponentListener, JiuInfo, ProgressListener
The frame class for the AWT demo program `jiuawt`.

Since:
  0.8.0
Author:
  Marco Schmidt
See Also:
  - Serialized Form

## Nested Class Summary

## Nested classes/interfaces inherited from class java.awt.Frame

`Frame.AccessibleAWTFrame`

## Nested classes/interfaces inherited from class java.awt.Window

`Window.AccessibleAWTWindow, Window.Type`

## Nested classes/interfaces inherited from class java.awt.Container

`Container.AccessibleAWTContainer`

## Nested classes/interfaces inherited from class java.awt.Component

`Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`APP_NAME`
The name of this application, jiuawt, plus the version number taken from `JiuInfo`.
`private ImageCanvas`
`canvas`
`private EditorState`
`editor`
`private AwtMenuWrapper`
`menuWrapper`
`private AwtOperationProcessor`
`processor`
`private ScrollPane`
`scrollPane`
`(package private) static final long`
`serialVersionUID`
`private Label`
`statusBar`

### 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

`accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

### Fields inherited from interface java.awt.image.ImageObserver

`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

### Fields inherited from interface net.sourceforge.jiu.apps.JiuInfo

`JIU_FEEDBACK_ADDRESS, JIU_HOMEPAGE, JIU_NUMERICAL_VERSION, JIU_VERSION`

## Constructor Summary

Constructors
Constructor
Description
`JiuAwtFrame(EditorState editorState)`
Create an object of this class, using the argument editor state.

## Method Summary

Modifier and Type
Method
Description
`void`
`actionPerformed(ActionEvent e)`
Processes event objects that get created when menu items are picked.
`void`
`componentHidden(ComponentEvent e)`
`void`
`componentMoved(ComponentEvent e)`
`void`
`componentResized(ComponentEvent e)`
`void`
`componentShown(ComponentEvent e)`
`void`
`maximize()`
Maximize the frame on the desktop.
`void`
`setDefaultCursor()`
Sets the current cursor to be `Cursor.DEFAULT_CURSOR`.
`void`
`setOriginalSize()`
If an image is currently loaded,
`void`
`setProgress(float progress)`
Set a new progress status.
`void`
`setProgress(int zeroBasedIndex, int totalItems)`
Sets a new progress level.
`void`
`setStatusBar(String text)`
`void`
`setWaitCursor()`
`void`
`showError(String text)`
Displays the argument text in a message box with error in the title bar.
`void`
`showInfo(String title, String text)`
Shows a modal dialog with given title bar and message text.
`void`
`updateCanvas()`
If there is an image loaded, forces a canvas redraw by calling repaint.
`void`
`updateImage()`
Removes the current canvas from the frame (if there is an image loaded) and creates a new canvas for the current image.
`void`
`updateStatusBar()`
Creates a description string for the current image and sets the status bar to that text.
`void`
`updateTitle()`
Sets the frame's title bar to the application name, plus the file name of the currently loaded image file, plus the current zoom factor, plus an optional asterisk in case the image was modified but not yet saved.
`void`
`zoomIn()`
If an image is currently displayed, zoom in one level.
`void`
`zoomOut()`
If an image is currently displayed, zoom out one level.

### Methods inherited from class java.awt.Frame

`addNotify, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setBackground, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated`

### Methods inherited from class java.awt.Window

`addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront`

### Methods inherited from class java.awt.Container

`add, add, add, add, add, addContainerListener, addImpl, 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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree`

### Methods inherited from class java.awt.Component

`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.awt.MenuContainer

`getFont, postEvent`

## Field Details

### APP_NAME

public static final String APP_NAME
The name of this application, jiuawt, plus the version number taken from `JiuInfo`. Example: `jiuawt 0.8.0`. Will be displayed in the title bar of this frame.

### serialVersionUID

static final long serialVersionUID

See Also:
  - Constant Field Values

### editor

private EditorState editor

### menuWrapper

private AwtMenuWrapper menuWrapper

### processor

private AwtOperationProcessor processor

### statusBar

private Label statusBar

### scrollPane

private ScrollPane scrollPane

### canvas

private ImageCanvas canvas

## Constructor Details

### JiuAwtFrame

public JiuAwtFrame(EditorState editorState)
Create an object of this class, using the argument editor state. String resources to initialize the menu etc. will be taken from the EditorState object's Strings variable

Parameters:
  `editorState` - EditorState object used by this frame

## Method Details

### actionPerformed

public void actionPerformed(ActionEvent e)
Processes event objects that get created when menu items are picked. Determines the `MenuIndexConstants` value for a given event object and calls the internal `AwtOperationProcessor` object's process method with the menu value. The operation will then be performed.

Specified by:
  `actionPerformed` in interface `ActionListener`
Parameters:
  `e` - the ActionEvent object

### componentHidden

public void componentHidden(ComponentEvent e)

Specified by:
  `componentHidden` in interface `ComponentListener`

### componentMoved

public void componentMoved(ComponentEvent e)

Specified by:
  `componentMoved` in interface `ComponentListener`

### componentResized

public void componentResized(ComponentEvent e)

Specified by:
  `componentResized` in interface `ComponentListener`

### componentShown

public void componentShown(ComponentEvent e)

Specified by:
  `componentShown` in interface `ComponentListener`

### maximize

public void maximize()
Maximize the frame on the desktop. There is no such function in the 1.1 AWT (was added in 1.4), so this class determines the screen size and sets the frame to be a little smaller than that (to make up for task bars etc.). So this is just a heuristical approach.

### showError

public void showError(String text)
Displays the argument text in a message box with error in the title bar.

Parameters:
  `text` - the error message to be displayed

### setDefaultCursor

public void setDefaultCursor()
Sets the current cursor to be `Cursor.DEFAULT_CURSOR`.

### setOriginalSize

public void setOriginalSize()
If an image is currently loaded,

### setProgress

public void setProgress(int zeroBasedIndex, int totalItems)
Description copied from interface: `ProgressListener`
Sets a new progress level. If an operation consists of totalItems steps, which are numbered from 0 to totalItems - 1, this method can be called after the completion of each step.

Example: if there are three steps and the first one is done, the parameters must be 0 and 3, which will indicated 33% completion. Parameters 1 and 3 mean 66%, 2 and 3 100%. If you use 3 and 3, an IllegalArgumentException will be thrown.

Computes `(float)(zeroBasedIndex + 1) / (float)totalItems` and calls `ProgressListener.setProgress(float)` with that value.

Specified by:
  `setProgress` in interface `ProgressListener`
Parameters:
  `zeroBasedIndex` - the index of the step that was just completed
  `totalItems` - the number of steps in this operation

### setProgress

public void setProgress(float progress)
Set a new progress status.

Specified by:
  `setProgress` in interface `ProgressListener`
Parameters:
  `progress` - float from 0.0f to 1.0f, indicating the progress between 0 and 100 percent

### setStatusBar

public void setStatusBar(String text)

### setWaitCursor

public void setWaitCursor()

### showInfo

public void showInfo(String title, String text)
Shows a modal dialog with given title bar and message text.

Parameters:
  `title` - will be displayed in the dialog's title bar
  `text` - will be displayed in the dialog's center part

### updateCanvas

public void updateCanvas()
If there is an image loaded, forces a canvas redraw by calling repaint.

### updateImage

public void updateImage()
Removes the current canvas from the frame (if there is an image loaded) and creates a new canvas for the current image.

### updateStatusBar

public void updateStatusBar()
Creates a description string for the current image and sets the status bar to that text.

### updateTitle

public void updateTitle()
Sets the frame's title bar to the application name, plus the file name of the currently loaded image file, plus the current zoom factor, plus an optional asterisk in case the image was modified but not yet saved.

### zoomIn

public void zoomIn()
If an image is currently displayed, zoom in one level.

### zoomOut

public void zoomOut()
If an image is currently displayed, zoom out one level.