Class KmgFormelPlotFrame

    • Field Detail

      • nFrames

        protected static int nFrames
        Number of created PlotFrames.
      • iFrame

        protected int iFrame
        Sequential number of the current PlotFrame.
      • defaultSize

        protected static Dimension defaultSize
      • defaultFont

        protected static Font defaultFont
      • isRepeating

        protected static boolean isRepeating
        Currently processing the slider repeat list.
    • Constructor Detail

      • KmgFormelPlotFrame

        protected KmgFormelPlotFrame​(String title)
    • Method Detail

      • toString

        public String toString()
        Returns a string representation of this PlotFrame.
        Overrides:
        toString in class Component
      • toRawString

        public String toRawString()
        Returns a string representation of this Frame.
      • getPlotFrameNumber

        public int getPlotFrameNumber()
        Returns the sequential number of this PlotFrame.
      • nop

        public KmgFormelPlotFrame nop​(double sliderDependentVariable)
        Deprecated.
        No more needed here.
        Forces the repetition of the statement by inserting an artificial dependency on sliderDependentVariable.

        A slider animated PlotFrame requires the repetition of all statements which depend on the slider variables. All statements which contain a slider variable or a variable which is dependent on a slider variable are repeated automatically on the change of any of the slider dependent variables. Therefore in most cases it is not necessary to explicitly control the repetition. Only if a statement does not contain any slider dependent variable but must be repeated, the nop methods can be used to artificially create a dependency and thus force the repetition.
        Parameters:
        sliderDependentVariable - any of the slider variables var from: var = slider.add(...)
        Returns:
        this
        See Also:
        JxnUtilities.nop(double)
      • setHeadline

        public KmgFormelPlotFrame setHeadline​(String headline)
        Adds a headline to the graphic display.
        Returns:
        this
      • setXYLabels

        public KmgFormelPlotFrame setXYLabels​(String strX,
                                              String strY)
        Sets labels for x- and y-axis.
        Parameters:
        strX - label of horizontal axis.
        strY - label of vertical axis.
        Returns:
        this
      • setFontSize

        public KmgFormelPlotFrame setFontSize​(int size)
        Sets the Font of the PlotFrame.
        Shortcut of: pf.setFont( @Font( "", style, size ) )
        Parameters:
        size - font size.
                size > 0 => style = Font.PLAIN,
                size < 0 => style = Font.BOLD,
                size = 0 => reset to default
        Returns:
        this
        See Also:
        java.awt.Font
      • setFontDefault

        public static Font setFontDefault​(Font font)
        Sets the Font for new PlotFrames.
        Example: KmgFormelPlotFrame.setFontDefault( @Font( "", Font.BOLD, 18 ) )
        Returns:
        the old default
      • setFontAll

        public static int setFontAll​(Font font)
        Sets the Font of all PlotFrames.
        Example: KmgFormelPlotFrame.setFontAll( @Font( "", Font.PLAIN, 16 ) )
        Parameters:
        font - if null apply the default font
        Returns:
        number of PlotFrames changed
      • setCursorTextEnabled

        public KmgFormelPlotFrame setCursorTextEnabled​(boolean cursorTextEnabled)
        Controls the cursor display.

        The cursor can also be changed in the context menu (right mouse-click) of the graphic display.
        Parameters:
        cursorTextEnabled - if true displays a crosshair cursor with cursor coordiantes
        else displays the default cursor (arrow only)
        Returns:
        this
        See Also:
        java.awt.Cursor
      • setAutoScale

        public KmgFormelPlotFrame setAutoScale​(int auto)
        Controls automatic scaling. Also available in the context menu (right mouse-click) of the graphic display.
        Parameters:
        auto - ...
            2: expands and shrinks on slider change and add(painter)
            1: expands on slider change and add(painter)
            0: expands on add(painter) (zooming implies setAutoScale(0))
           -1: no automatic rescale (set by setXYBounds(double, double, double, double))
                ⇒ freezes to current bounds, subsequent add(painter) do not change the scaling, objects added may not be visible
        Returns:
        this
      • rescale

        public KmgFormelPlotFrame rescale()
        (Re)scales the display to the optimal bounds. Also available in the context menu (right mouse-click) of the graphic display.
        Returns:
        this
      • setXYBounds

        public KmgFormelPlotFrame setXYBounds​(double left,
                                              double bottom,
                                              double right,
                                              double top)
        Manually set the bounds to the given values. Implies setAutoScale(-1).
        Returns:
        this
      • writePNG

        public void writePNG​(String filename)
        Writes the graphic display to a png-file. Also available in the context menu (right mouse-click) of the graphic display.
        Note: Supported only if JXN runs as Java application (see JxnPortable)
        Parameters:
        filename - the name of the png-file. Prompts for filename if null or "".
      • setCanvasSize

        public KmgFormelPlotFrame setCanvasSize​(int width,
                                                int height)
        Sets the canvas size of the PlotFrame.
        png-files from writePNG will be of size width x height.
        Returns:
        this
      • setSizeDefault

        public static void setSizeDefault​(int width,
                                          int height)
        Sets the canvas size for new PlotFrames.
        png-files from writePNG will be of size width x height.
      • getSizeDefault

        public static Dimension getSizeDefault()
        Returns the default canvas size.
      • setSizeAll

        public static int setSizeAll​(int width,
                                     int height)
        Sets the canvas size of all PlotFrames.
        png-files from writePNG will be of size width x height.
        Returns:
        number of PlotFrames changed
      • getXYPanel

        public Panel getXYPanel()
        Returns the ZoomPanel (containing the scrollbars) of this PlotFrame.
      • getXYCanvas

        public Canvas getXYCanvas()
        Returns the Canvas (without the scrollbars) of this PlotFrame.
      • moveCanvasTo

        public void moveCanvasTo​(Container cont)
        Moves the Canvas from the PlotFrame to another java.awt.Container and hides the PlotFrame.
        Calls: cont.add( getXYCanvas() ).

        If you are familiar with Java LayoutManagement see the examples in the gallery and the include files on folder JxnPortable/include how to use the moveCanvasTo(...) methods to arrange multiple graphic displays in a common display panel.
      • moveCanvasTo

        public void moveCanvasTo​(Container cont,
                                 Object constraints)
        Moves the Canvas from the PlotFrame to another java.awt.Container and hides the PlotFrame.
        Calls: cont.add( getXYCanvas(), constraints )
        Parameters:
        constraints - e.g. java.awt.BorderLayout.CENTER
      • getRepeating

        public static boolean getRepeating()
        Called internally...
      • repaintCanvas

        public void repaintCanvas()
        Repaints the graphic display (called internally).
      • repaintAll

        public static void repaintAll()
        Called internally...