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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrameNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of this application, jiuawt, plus the version number taken fromJiuInfo.private ImageCanvasprivate EditorStateprivate AwtMenuWrapperprivate AwtOperationProcessorprivate ScrollPane(package private) static final longprivate LabelFields 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_CURSORFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface net.sourceforge.jiu.apps.JiuInfo
JIU_FEEDBACK_ADDRESS, JIU_HOMEPAGE, JIU_NUMERICAL_VERSION, JIU_VERSION -
Constructor Summary
ConstructorsConstructorDescriptionJiuAwtFrame(EditorState editorState) Create an object of this class, using the argument editor state. -
Method Summary
Modifier and TypeMethodDescriptionvoidProcesses event objects that get created when menu items are picked.voidvoidvoidvoidvoidmaximize()Maximize the frame on the desktop.voidSets the current cursor to beCursor.DEFAULT_CURSOR.voidIf an image is currently loaded,voidsetProgress(float progress) Set a new progress status.voidsetProgress(int zeroBasedIndex, int totalItems) Sets a new progress level.voidsetStatusBar(String text) voidvoidDisplays the argument text in a message box with error in the title bar.voidShows a modal dialog with given title bar and message text.voidIf there is an image loaded, forces a canvas redraw by calling repaint.voidRemoves the current canvas from the frame (if there is an image loaded) and creates a new canvas for the current image.voidCreates a description string for the current image and sets the status bar to that text.voidSets 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.voidzoomIn()If an image is currently displayed, zoom in one level.voidzoomOut()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, setUndecoratedMethods 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, toFrontMethods 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, validateTreeMethods 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.MenuContainer
getFont, postEvent
-
Field Details
-
APP_NAME
The name of this application, jiuawt, plus the version number taken fromJiuInfo. Example:jiuawt 0.8.0. Will be displayed in the title bar of this frame. -
serialVersionUID
static final long serialVersionUID- See Also:
-
editor
-
processor
-
statusBar
-
scrollPane
-
canvas
-
-
Constructor Details
-
JiuAwtFrame
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
Processes event objects that get created when menu items are picked. Determines theMenuIndexConstantsvalue for a given event object and calls the internalAwtOperationProcessorobject's process method with the menu value. The operation will then be performed.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
e- the ActionEvent object
-
componentHidden
- Specified by:
componentHiddenin interfaceComponentListener
-
componentMoved
- Specified by:
componentMovedin interfaceComponentListener
-
componentResized
- Specified by:
componentResizedin interfaceComponentListener
-
componentShown
- Specified by:
componentShownin interfaceComponentListener
-
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
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 beCursor.DEFAULT_CURSOR. -
setOriginalSize
public void setOriginalSize()If an image is currently loaded, -
setProgress
public void setProgress(int zeroBasedIndex, int totalItems) Description copied from interface:ProgressListenerSets 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)totalItemsand callsProgressListener.setProgress(float)with that value.- Specified by:
setProgressin interfaceProgressListener- Parameters:
zeroBasedIndex- the index of the step that was just completedtotalItems- the number of steps in this operation
-
setProgress
public void setProgress(float progress) Set a new progress status.- Specified by:
setProgressin interfaceProgressListener- Parameters:
progress- float from 0.0f to 1.0f, indicating the progress between 0 and 100 percent
-
setStatusBar
-
setWaitCursor
public void setWaitCursor() -
showInfo
Shows a modal dialog with given title bar and message text.- Parameters:
title- will be displayed in the dialog's title bartext- 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.
-