Class JiuAwtFrame

    • Constructor Detail

      • 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 Detail

      • 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
      • 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
      • 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.