ActionListener
, ComponentListener
, ImageObserver
, MenuContainer
, Serializable
, EventListener
, Accessible
, JiuInfo
, ProgressListener
public class JiuAwtFrame extends Frame implements ActionListener, ComponentListener, JiuInfo, ProgressListener
jiuawt
.Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Container.AccessibleAWTContainer
Frame.AccessibleAWTFrame
Window.AccessibleAWTWindow, Window.Type
Modifier and Type | Field | Description |
---|---|---|
static 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 long |
serialVersionUID |
|
private Label |
statusBar |
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
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
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
JIU_FEEDBACK_ADDRESS, JIU_HOMEPAGE, JIU_NUMERICAL_VERSION, JIU_VERSION
Constructor | Description |
---|---|
JiuAwtFrame(EditorState editorState) |
Create an object of this class, using the argument editor
state.
|
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.
|
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
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
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
getFont, postEvent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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
public static final String APP_NAME
JiuInfo
.
Example: jiuawt 0.8.0
.
Will be displayed in the title bar of this frame.static final long serialVersionUID
private EditorState editor
private AwtMenuWrapper menuWrapper
private AwtOperationProcessor processor
private Label statusBar
private ScrollPane scrollPane
private ImageCanvas canvas
public JiuAwtFrame(EditorState editorState)
editorState
- EditorState object used by this framepublic void actionPerformed(ActionEvent e)
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.actionPerformed
in interface ActionListener
e
- the ActionEvent objectpublic void componentHidden(ComponentEvent e)
componentHidden
in interface ComponentListener
public void componentMoved(ComponentEvent e)
componentMoved
in interface ComponentListener
public void componentResized(ComponentEvent e)
componentResized
in interface ComponentListener
public void componentShown(ComponentEvent e)
componentShown
in interface ComponentListener
public void maximize()
public void showError(String text)
text
- the error message to be displayedpublic void setDefaultCursor()
Cursor.DEFAULT_CURSOR
.public void setOriginalSize()
public void setProgress(int zeroBasedIndex, int totalItems)
ProgressListener
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.
setProgress
in interface ProgressListener
zeroBasedIndex
- the index of the step that was just completedtotalItems
- the number of steps in this operationpublic void setProgress(float progress)
setProgress
in interface ProgressListener
progress
- float from 0.0f to 1.0f, indicating the progress between 0 and 100 percentpublic void setStatusBar(String text)
public void setWaitCursor()
public void showInfo(String title, String text)
title
- will be displayed in the dialog's title bartext
- will be displayed in the dialog's center partpublic void updateCanvas()
public void updateImage()
public void updateStatusBar()
public void updateTitle()
public void zoomIn()
public void zoomOut()