Package wprover

Class GExpert

  • All Implemented Interfaces:
    java.awt.dnd.DropTargetListener, java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

    public class GExpert
    extends javax.swing.JFrame
    implements java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.dnd.DropTargetListener, java.awt.event.WindowListener
    GExpert is the main class for the GEXPERT application. It initializes the application, sets up the GUI, and handles user interactions. It also manages the language settings and file operations.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JFrame

        javax.swing.JFrame.AccessibleJFrame
      • Nested classes/interfaces inherited from class java.awt.Frame

        java.awt.Frame.AccessibleAWTFrame
      • Nested classes/interfaces inherited from class java.awt.Window

        java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String _command  
      static java.util.ArrayList<java.lang.String> commandlineCommand  
      static int commandLineRequestsPerformed  
      static java.util.ArrayList<java.lang.Object> commandlineSrc  
      static Cons conclusion  
      CProperty cp  
      wprover.DPanel d  
      DrawTextProcess dp  
      static long HotKeyTimer  
      static org.xnap.commons.i18n.I18n i18n  
      static java.lang.String lan  
      ListTree lp  
      javax.swing.JScrollPane scroll  
      • Fields inherited from class javax.swing.JFrame

        accessibleContext, rootPane, rootPaneCheckingEnabled
      • 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

        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 javax.swing.WindowConstants

        DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
    • Constructor Summary

      Constructors 
      Constructor Description
      GExpert()
      Constructs a new GExpert instance and initializes the application if it is running as an application.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)
      Handles action events by sending the action command and source to the sendAction method.
      javax.swing.JMenuItem addAMenu​(javax.swing.JMenu bar, java.lang.String name, java.lang.String tooltip, int ne, java.awt.event.ActionListener listener)
      Adds a menu item to the specified menu bar with the given name, tooltip, mnemonic, and action listener.
      javax.swing.JMenuItem addAMenu​(javax.swing.JMenu bar, java.lang.String name, java.lang.String tooltip, java.awt.event.ActionListener listener)
      Adds a menu item to the specified menu bar with the given name, tooltip, and action listener.
      protected void addButtons​(javax.swing.JToolBar toolBar)
      Adds primary action buttons to the provided tool bar.
      void addButtonToDrawGroup​(javax.swing.JToggleButton b)
      Adds a button to the draw group.
      void addImageToItem​(javax.swing.JMenu item)
      Adds a blank image icon to the specified menu.
      void addImageToItem​(javax.swing.JMenuItem item)
      Adds a blank image icon to the specified menu item.
      void addImageToItem​(javax.swing.JMenuItem item, java.lang.String name)
      Adds an image icon to the specified menu item with the given name.
      void addMenueToolBar()
      Initializes and adds the menu and tool bar(s) to the application frame.
      javax.swing.JRadioButtonMenuItem addRadioButtonMenuItem​(javax.swing.JMenu bar, java.lang.String name, java.lang.String tooltip, java.awt.event.ActionListener listener)
      Creates a JRadioButtonMenuItem with the specified name, tooltip, and action listener.
      javax.swing.JRadioButtonMenuItem addRadioButtonMenuItem​(javax.swing.JMenu bar, java.lang.String name, java.lang.String tooltip, java.awt.event.ActionListener listener, java.lang.String command)
      Creates a JRadioButtonMenuItem with the specified name, tooltip, action listener, and command.
      javax.swing.JRadioButtonMenuItem addRadioButtonMenuItem​(javax.swing.JMenu bar, java.lang.String name, java.lang.String text, java.lang.String tooltip, java.awt.event.ActionListener listener)
      Creates a JRadioButtonMenuItem with the specified name, custom text, tooltip, and action listener.
      protected void addRightButtons​(javax.swing.JToolBar toolBar)
      Adds right-side buttons to the provided tool bar.
      void addSplitListener()
      Adds a component listener to the drawing panel to handle resizing and visibility changes.
      void centerDialog​(javax.swing.JDialog dlg)
      Centers the given dialog relative to the main frame.
      int Clear()
      Clears the current diagram and resets the application state.
      void closeAllDialogs()
      Closes all open dialogs in the application.
      protected static javax.swing.ImageIcon createImageIcon​(java.lang.String path)
      Create an ImageIcon from the path.
      void createTipLabel()
      Creates and initializes the tip label.
      void dragEnter​(java.awt.dnd.DropTargetDragEvent dtde)  
      void dragExit​(java.awt.dnd.DropTargetEvent dte)  
      void dragOver​(java.awt.dnd.DropTargetDragEvent dtde)  
      void drop​(java.awt.dnd.DropTargetDropEvent dtde)
      This method is called when the user drops a file on the window.
      void dropActionChanged​(java.awt.dnd.DropTargetDragEvent dtde)  
      boolean get_User_Overwrite_Option​(java.lang.String name)
      Prompts the user to confirm overwriting an existing file.
      AnimatePanel getAnimateDialog()
      Returns the AnimatePanel object, initializing it if necessary.
      java.awt.image.BufferedImage getBufferedImage​(java.awt.Rectangle rc)
      Returns a buffered image of the drawing area bounded by the specified rectangle.
      java.awt.image.BufferedImage getBufferedImage2​(java.awt.Rectangle rc)
      Returns a buffered image of the content pane bounded by the specified rectangle.
      ConcDialog getConcDialog()
      Returns the conclusion dialog, initializing it if necessary.
      javax.swing.JComponent getContent()
      Returns the main content pane of the application.
      java.awt.Font getDefaultFont()
      Returns the default font of the application.
      DialogProperty getDialogProperty()
      Returns the dialog property, initializing it if necessary.
      CDialogProve getDialogProve()
      Returns the prove dialog, initializing it if necessary.
      javax.swing.JFileChooser getFileChooser​(boolean importGgb)
      Returns a file chooser, initializing it if necessary.
      static java.lang.String getFileSeparator()
      Returns the file separator.
      java.awt.Frame getFrame()
      Returns the Frame object of the application.
      Language getLan()
      Returns the current language settings.
      static java.lang.String getLanguage​(java.lang.String s1)
      Returns the translated string for the given key.
      static java.lang.String getLanguageTip​(java.lang.String s1)
      Returns the tooltip text for the given key.
      MProveInputPanel getMannalInputToolBar()
      Returns the manual input toolbar.
      PanelProve getpprove()
      Returns the PanelProve object.
      int getProveStatus()
      Returns the prove status.
      static java.net.URL getResourceURL​(java.lang.String path)
      Get the resource URL from the path.
      RuleDialog getRuleDialog​(int n)
      Returns the RuleDialog object for the specified rule, initializing it if necessary.
      SelectDialog getSelectDialog()
      Returns the select dialog, initializing it if necessary.
      CStyleDialog getStyleDialog()
      Returns the style dialog.
      static java.lang.String getTranslationViaGettext​(java.lang.String s)
      Returns the translated string for the given key using gettext.
      static java.lang.String getTranslationViaGettext​(java.lang.String s, java.lang.String... p)
      Returns the translated string for the given key using gettext with parameters.
      UndoEditDialog getUndoEditDialog()
      Returns the undo edit dialog, initializing it if necessary.
      static java.lang.String getUserDir()
      Returns the user directory.
      static java.lang.String getUserHome()
      Returns the user home directory.
      boolean hasAFrame()
      Checks if the animate frame is present.
      boolean hasMannualInputBar()
      Checks if the manual input bar is present.
      void init()
      Initializes the GExpert application, setting up the GUI components, loading preferences, language settings, and rules.
      void initAttribute()
      Initializes the attributes of the application, setting the font if the language is not English.
      void initKeyMap()
      Initializes the key mapping by registering a KeyEventPostProcessor.
      boolean isconcVisible()
      Checks if the conclusion dialog is visible.
      boolean isDialogProveVisible()
      Checks if the prove dialog is visible.
      boolean isPPanelVisible()
      Checks if the panel is visible.
      static boolean isRunningFromJar()
      Checks if the application is running in a JAR file (including CheerpJ web environment).
      static boolean isRunningInCheerpJ()
      Checks if the application is running in a CheerpJ web environment.
      void keyPressed​(java.awt.event.KeyEvent e)
      Handles key pressed events.
      void keyReleased​(java.awt.event.KeyEvent e)
      Handles key released events.
      void keyTyped​(java.awt.event.KeyEvent e)
      Handles key typed events.
      void loadCursor()
      Loads the cursor for the application.
      void loadLanguage()
      Loads the language settings for the application and sets up internationalization.
      void loadPreference()
      Loads the user preferences from the configuration file.
      void loadRules()
      Loads the rules for the GExpert application.
      static void main​(java.lang.String[] args)
      Main entry point of the application.
      protected javax.swing.JToggleButton makeAButton​(java.lang.String imageName, java.lang.String actionCommand, java.lang.String toolTipText, java.lang.String altText)
      Creates a toggle button with the specified image, action command, tooltip text, and alternate text.
      protected javax.swing.JToggleButton makeAButton​(java.lang.String imageName, java.lang.String actionCommand, java.lang.String toolTipText, java.lang.String altText, boolean t)
      Creates a toggle button with the specified image, action command, tooltip text, alternate text, and an optional action listener.
      protected javax.swing.JToggleButton makeAButtonWith2ICon​(java.lang.String imageName, java.lang.String imageNameSelected, java.lang.String actionCommand, java.lang.String toolTipText, java.lang.String altText)
      Creates a toggle button with two icons, one for the default state and one for the selected state.
      boolean need_save()
      Checks if there are any unsaved changes.
      void onKeyCancel()
      Cancels the current action triggered by key events.
      boolean openAFile​(java.io.File file)
      Opens and loads a project file.
      boolean openResourceFile​(java.lang.String resourcePath)
      Opens and loads a project file from a resource path.
      static void openURL​(java.lang.String url)
      Opens the specified URL in the system's default web browser or handles it appropriately for the current environment (desktop or web/CheerpJ).
      static void performCommandLineRequests​(GExpert exp, boolean breakOnProve)
      Perform command line requests.
      void reloadLP()
      Reloads the list of points if the list panel and undo dialog are visible.
      void resetAllButtonStatus()
      This method is used to reset all button status.
      void restorScroll()
      This method is used to restore the scroll.
      boolean saveAFile​(boolean n)
      Saves the current file.
      void saveAFile​(java.lang.String path)
      Saves the project to a file at the specified path.
      void saveAsGIF()
      Saves the current animation as a GIF.
      void saveAsImage()
      Saves the current view as an image file.
      void saveAsPDF()
      Saves the current view as a PDF file.
      boolean saveBeforeExit()
      Prompts the user to save any unsaved changes before exiting the application.
      void saveProofAsGIF()
      Saves the proof as a GIF image.
      void selectAPoint​(CPoint p)
      Selects a point in the number check dialog if it is visible.
      void sendAction​(java.lang.String command, java.lang.Object src)
      Processes an action command based on the provided command string and source.
      void setActionMove()
      Sets the action to "Move" and selects the move button.
      void setActionPool​(int a)
      Configures the action pool based on the specified pool type.
      void setActionSelect()
      Sets the action to "Select" and selects the select button.
      void setActionTip​(java.lang.String name, java.lang.String tip)
      This method is used to set the text of the label.
      void setBKState()
      Sets the enabled state of the undo and redo buttons based on the sizes of the undo and redo lists.
      void setDrawCursor​(int t)
      Sets the cursor to the specified predefined cursor type.
      void setLabelText2​(java.lang.String s)
      This method is used to set the text of the label2.
      void setLocation​(int x, int y)
      Sets the location of the frame.
      static void setLookAndFeel()  
      void setTextLabel2​(java.lang.String s)
      This method is used to set the text of the label2.
      void setTextLabel2​(java.lang.String s, int n)
      This method is used to set the text of the label2.
      void setTipText​(java.lang.String text)
      This method is used to set the text of the tip.
      static void setUIFont​(javax.swing.plaf.FontUIResource f)
      Sets the default UI font for all components.
      void showAnimatePane()
      Shows the animate pane.
      void showNumDialog()
      Shows the number check dialog if there are points to check.
      void showppanel​(boolean t)
      Shows or hides the panel.
      void showProveBar​(boolean show)
      Shows or hides the prove bar.
      void showRulePanel​(java.lang.String s, int x, int y)
      Shows the rule panel at the specified location.
      void showStyleDialog()
      Shows the style dialog.
      void start()
      Starts or initializes the component.
      void stop()
      Stops or cleans up the component.
      void stopTimer()
      This method is used to stop the timer.
      void switchProveBarVisibility​(boolean r)
      Switches the visibility of the prove bar.
      void updateActionPool​(int n)
      Updates the action pool using the currently selected list of objects.
      void updateTitle()
      This method is used to update the title of the window.
      void viewElementsAuto​(CClass c)
      Automatically sets the panel type for the given class.
      void windowActivated​(java.awt.event.WindowEvent e)  
      void windowClosed​(java.awt.event.WindowEvent e)  
      void windowClosing​(java.awt.event.WindowEvent e)
      This method is called when the user closes the window.
      void windowDeactivated​(java.awt.event.WindowEvent e)  
      void windowDeiconified​(java.awt.event.WindowEvent e)  
      void windowIconified​(java.awt.event.WindowEvent e)  
      void windowOpened​(java.awt.event.WindowEvent e)  
      • Methods inherited from class javax.swing.JFrame

        addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • Methods inherited from class java.awt.Frame

        addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, 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, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, 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, 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, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, 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, 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, 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 Detail

      • d

        public wprover.DPanel d
      • scroll

        public javax.swing.JScrollPane scroll
      • _command

        public java.lang.String _command
      • lan

        public static java.lang.String lan
      • i18n

        public static org.xnap.commons.i18n.I18n i18n
      • conclusion

        public static Cons conclusion
      • commandlineCommand

        public static java.util.ArrayList<java.lang.String> commandlineCommand
      • commandlineSrc

        public static java.util.ArrayList<java.lang.Object> commandlineSrc
      • commandLineRequestsPerformed

        public static int commandLineRequestsPerformed
      • HotKeyTimer

        public static long HotKeyTimer
    • Constructor Detail

      • GExpert

        public GExpert()
        Constructs a new GExpert instance and initializes the application if it is running as an application.
    • Method Detail

      • init

        public void init()
        Initializes the GExpert application, setting up the GUI components, loading preferences, language settings, and rules. It also initializes various attributes and sets up the main content pane.
      • loadRules

        public void loadRules()
        Loads the rules for the GExpert application.
      • getContent

        public javax.swing.JComponent getContent()
        Returns the main content pane of the application.
        Returns:
        the main content pane
      • addSplitListener

        public void addSplitListener()
        Adds a component listener to the drawing panel to handle resizing and visibility changes.
      • loadPreference

        public void loadPreference()
        Loads the user preferences from the configuration file.
      • loadLanguage

        public void loadLanguage()
        Loads the language settings for the application and sets up internationalization.
      • initAttribute

        public void initAttribute()
        Initializes the attributes of the application, setting the font if the language is not English.
      • getDefaultFont

        public java.awt.Font getDefaultFont()
        Returns the default font of the application.
        Returns:
        the default Font object, or null if the language is not set
      • getFrame

        public java.awt.Frame getFrame()
        Returns the Frame object of the application.
        Returns:
        the Frame object, or null if no Frame is found
      • loadCursor

        public void loadCursor()
        Loads the cursor for the application.
      • isPPanelVisible

        public boolean isPPanelVisible()
        Checks if the panel is visible.
        Returns:
        true if the panel is visible, false otherwise
      • showppanel

        public void showppanel​(boolean t)
        Shows or hides the panel.
        Parameters:
        t - if true, hides the panel; if false, shows the panel
      • showRulePanel

        public void showRulePanel​(java.lang.String s,
                                  int x,
                                  int y)
        Shows the rule panel at the specified location.
        Parameters:
        s - the rule to be shown
        x - the x-coordinate of the location
        y - the y-coordinate of the location
      • getpprove

        public PanelProve getpprove()
        Returns the PanelProve object.
        Returns:
        the PanelProve object
      • hasAFrame

        public boolean hasAFrame()
        Checks if the animate frame is present.
        Returns:
        true if the animate frame is present, false otherwise
      • getAnimateDialog

        public AnimatePanel getAnimateDialog()
        Returns the AnimatePanel object, initializing it if necessary.
        Returns:
        the AnimatePanel object
      • showAnimatePane

        public void showAnimatePane()
        Shows the animate pane.
      • getRuleDialog

        public RuleDialog getRuleDialog​(int n)
        Returns the RuleDialog object for the specified rule, initializing it if necessary.
        Parameters:
        n - the rule number
        Returns:
        the RuleDialog object
      • viewElementsAuto

        public void viewElementsAuto​(CClass c)
        Automatically sets the panel type for the given class.
        Parameters:
        c - the class for which the panel type is to be set
      • getDialogProperty

        public DialogProperty getDialogProperty()
        Returns the dialog property, initializing it if necessary.
        Returns:
        the dialog property
      • centerDialog

        public void centerDialog​(javax.swing.JDialog dlg)
        Centers the given dialog relative to the main frame.
        Parameters:
        dlg - the dialog to be centered
      • getSelectDialog

        public SelectDialog getSelectDialog()
        Returns the select dialog, initializing it if necessary.
        Returns:
        the select dialog
      • isconcVisible

        public boolean isconcVisible()
        Checks if the conclusion dialog is visible.
        Returns:
        true if the conclusion dialog is visible, false otherwise
      • getConcDialog

        public ConcDialog getConcDialog()
        Returns the conclusion dialog, initializing it if necessary.
        Returns:
        the conclusion dialog
      • showNumDialog

        public void showNumDialog()
        Shows the number check dialog if there are points to check.
      • selectAPoint

        public void selectAPoint​(CPoint p)
        Selects a point in the number check dialog if it is visible.
        Parameters:
        p - the point to be selected
      • getUndoEditDialog

        public UndoEditDialog getUndoEditDialog()
        Returns the undo edit dialog, initializing it if necessary.
        Returns:
        the undo edit dialog
      • isDialogProveVisible

        public boolean isDialogProveVisible()
        Checks if the prove dialog is visible.
        Returns:
        true if the prove dialog is visible, false otherwise
      • getDialogProve

        public CDialogProve getDialogProve()
        Returns the prove dialog, initializing it if necessary.
        Returns:
        the prove dialog
      • getFileChooser

        public javax.swing.JFileChooser getFileChooser​(boolean importGgb)
        Returns a file chooser, initializing it if necessary.
        Parameters:
        importGgb - if true, sets the file filter to GeoGebra files; otherwise, sets it to GEX files
        Returns:
        the file chooser
      • getUserDir

        public static java.lang.String getUserDir()
        Returns the user directory.
        Returns:
        the user directory
      • getUserHome

        public static java.lang.String getUserHome()
        Returns the user home directory.
        Returns:
        the user home directory
      • getFileSeparator

        public static java.lang.String getFileSeparator()
        Returns the file separator.
        Returns:
        the file separator
      • hasMannualInputBar

        public boolean hasMannualInputBar()
        Checks if the manual input bar is present.
        Returns:
        true if the manual input bar is present, false otherwise
      • getProveStatus

        public int getProveStatus()
        Returns the prove status.
        Returns:
        the prove status
      • getStyleDialog

        public CStyleDialog getStyleDialog()
        Returns the style dialog.
        Returns:
        the style dialog
      • getMannalInputToolBar

        public MProveInputPanel getMannalInputToolBar()
        Returns the manual input toolbar.
        Returns:
        the manual input toolbar
      • addButtonToDrawGroup

        public void addButtonToDrawGroup​(javax.swing.JToggleButton b)
        Adds a button to the draw group.
        Parameters:
        b - the button to be added
      • switchProveBarVisibility

        public void switchProveBarVisibility​(boolean r)
        Switches the visibility of the prove bar.
        Parameters:
        r - if false, hides the prove bar; if true, shows the prove bar
      • showProveBar

        public void showProveBar​(boolean show)
        Shows or hides the prove bar.
        Parameters:
        show - if true, shows the prove bar; if false, hides the prove bar
      • showStyleDialog

        public void showStyleDialog()
        Shows the style dialog.
      • createTipLabel

        public void createTipLabel()
        Creates and initializes the tip label.
      • setLocation

        public void setLocation​(int x,
                                int y)
        Sets the location of the frame.
        Overrides:
        setLocation in class java.awt.Window
        Parameters:
        x - the x-coordinate of the frame
        y - the y-coordinate of the frame
      • addMenueToolBar

        public void addMenueToolBar()
        Initializes and adds the menu and tool bar(s) to the application frame.

        This method creates and configures the top toolbar, the right-side toolbar, and the menu bar with all necessary menus and menu items for file operations, examples, construction, constraints, actions, and help. Toolbar buttons and menu items are set up with icons and action listeners.

      • addRadioButtonMenuItem

        public javax.swing.JRadioButtonMenuItem addRadioButtonMenuItem​(javax.swing.JMenu bar,
                                                                       java.lang.String name,
                                                                       java.lang.String tooltip,
                                                                       java.awt.event.ActionListener listener,
                                                                       java.lang.String command)
        Creates a JRadioButtonMenuItem with the specified name, tooltip, action listener, and command.
        Parameters:
        bar - the menu to add the item to
        name - the display name and action command of the menu item
        tooltip - the tooltip text to display
        listener - the action listener to register on the menu item
        command - the specific action command to set
        Returns:
        the created JRadioButtonMenuItem
      • addRadioButtonMenuItem

        public javax.swing.JRadioButtonMenuItem addRadioButtonMenuItem​(javax.swing.JMenu bar,
                                                                       java.lang.String name,
                                                                       java.lang.String text,
                                                                       java.lang.String tooltip,
                                                                       java.awt.event.ActionListener listener)
        Creates a JRadioButtonMenuItem with the specified name, custom text, tooltip, and action listener. The menu item's text is set to its localized value.
        Parameters:
        bar - the menu to add the item to
        name - the internal name of the menu item used as its action command
        text - the text to display on the menu item (to be localized)
        tooltip - the tooltip text to display
        listener - the action listener to register on the menu item
        Returns:
        the created JRadioButtonMenuItem with localized text
      • addRadioButtonMenuItem

        public javax.swing.JRadioButtonMenuItem addRadioButtonMenuItem​(javax.swing.JMenu bar,
                                                                       java.lang.String name,
                                                                       java.lang.String tooltip,
                                                                       java.awt.event.ActionListener listener)
        Creates a JRadioButtonMenuItem with the specified name, tooltip, and action listener. The menu item's text and action command are set based on the provided name. If the tooltip is null, a localized language tip may be used instead.
        Parameters:
        bar - the menu to add the item to
        name - the name used as the action command and display text of the menu item
        tooltip - the tooltip text to display (or a localized tip if null)
        listener - the action listener to register on the menu item
        Returns:
        the created JRadioButtonMenuItem
      • addAMenu

        public javax.swing.JMenuItem addAMenu​(javax.swing.JMenu bar,
                                              java.lang.String name,
                                              java.lang.String tooltip,
                                              int ne,
                                              java.awt.event.ActionListener listener)
        Adds a menu item to the specified menu bar with the given name, tooltip, mnemonic, and action listener.
        Parameters:
        bar - the menu bar to which the menu item will be added
        name - the name of the menu item
        tooltip - the tooltip text for the menu item
        ne - the mnemonic for the menu item
        listener - the action listener for the menu item
        Returns:
        the created JMenuItem
      • addImageToItem

        public void addImageToItem​(javax.swing.JMenuItem item)
        Adds a blank image icon to the specified menu item.
        Parameters:
        item - the menu item to which the image icon will be added
      • addImageToItem

        public void addImageToItem​(javax.swing.JMenu item)
        Adds a blank image icon to the specified menu.
        Parameters:
        item - the menu to which the image icon will be added
      • addImageToItem

        public void addImageToItem​(javax.swing.JMenuItem item,
                                   java.lang.String name)
        Adds an image icon to the specified menu item with the given name.
        Parameters:
        item - the menu item to which the image icon will be added
        name - the name of the image icon
      • addAMenu

        public javax.swing.JMenuItem addAMenu​(javax.swing.JMenu bar,
                                              java.lang.String name,
                                              java.lang.String tooltip,
                                              java.awt.event.ActionListener listener)
        Adds a menu item to the specified menu bar with the given name, tooltip, and action listener.
        Parameters:
        bar - the menu bar to which the menu item will be added
        name - the name of the menu item
        tooltip - the tooltip text for the menu item
        listener - the action listener for the menu item
        Returns:
        the created JMenuItem
      • getLan

        public Language getLan()
        Returns the current language settings.
        Returns:
        the current Language object
      • getLanguage

        public static java.lang.String getLanguage​(java.lang.String s1)
        Returns the translated string for the given key.
        Parameters:
        s1 - the key to be translated
        Returns:
        the translated string
      • getLanguageTip

        public static java.lang.String getLanguageTip​(java.lang.String s1)
        Returns the tooltip text for the given key.
        Parameters:
        s1 - the key to be translated
        Returns:
        the translated tooltip text
      • getTranslationViaGettext

        public static java.lang.String getTranslationViaGettext​(java.lang.String s)
        Returns the translated string for the given key using gettext.
        Parameters:
        s - the key to be translated
        Returns:
        the translated string
      • getTranslationViaGettext

        public static java.lang.String getTranslationViaGettext​(java.lang.String s,
                                                                java.lang.String... p)
        Returns the translated string for the given key using gettext with parameters.
        Parameters:
        s - the key to be translated
        p - the parameters for the translation
        Returns:
        the translated string
      • setActionMove

        public void setActionMove()
        Sets the action to "Move" and selects the move button.
      • setActionSelect

        public void setActionSelect()
        Sets the action to "Select" and selects the select button.
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Handles action events by sending the action command and source to the sendAction method.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        e - the action event
      • sendAction

        public void sendAction​(java.lang.String command,
                               java.lang.Object src)
        Processes an action command based on the provided command string and source.

        This method interprets the action command triggered by the user and executes the corresponding operation such as saving files, opening dialogs, performing undo/redo actions, updating the UI state, and other application-specific functions.

        Parameters:
        command - the action command to be processed
        src - the source object that triggered the command (e.g., JMenuItem, JToggleButton, or File)
      • setBKState

        public void setBKState()
        Sets the enabled state of the undo and redo buttons based on the sizes of the undo and redo lists.
      • saveBeforeExit

        public boolean saveBeforeExit()
        Prompts the user to save any unsaved changes before exiting the application.
        Returns:
        true if the user chose to save or discard changes, false if the user canceled the operation
      • need_save

        public boolean need_save()
        Checks if there are any unsaved changes.
        Returns:
        true if there are unsaved changes, false otherwise
      • saveAFile

        public boolean saveAFile​(boolean n)
        Saves the current file. If the file does not exist or the user chooses "Save as...", prompts the user to select a file location.
        Parameters:
        n - if true, prompts the user to select a file location
        Returns:
        true if the file was saved successfully, false otherwise
      • Clear

        public int Clear()
        Clears the current diagram and resets the application state. Prompts the user to save any unsaved changes before clearing.
        Returns:
        0 if the diagram was cleared successfully, 2 if the user canceled the operation
      • closeAllDialogs

        public void closeAllDialogs()
        Closes all open dialogs in the application.
      • setDrawCursor

        public void setDrawCursor​(int t)
        Sets the cursor to the specified predefined cursor type.
        Parameters:
        t - the predefined cursor type
      • reloadLP

        public void reloadLP()
        Reloads the list of points if the list panel and undo dialog are visible.
      • get_User_Overwrite_Option

        public boolean get_User_Overwrite_Option​(java.lang.String name)
        Prompts the user to confirm overwriting an existing file.
        Parameters:
        name - the name of the file to be overwritten
        Returns:
        true if the user chose to overwrite the file, false otherwise
      • saveAFile

        public void saveAFile​(java.lang.String path)
                       throws java.io.IOException
        Saves the project to a file at the specified path.
        Parameters:
        path - the file path to save the project
        Throws:
        java.io.IOException - if an I/O error occurs during saving
      • saveProofAsGIF

        public void saveProofAsGIF()
        Saves the proof as a GIF image. Opens dialogs to select the region and file destination, then encodes the proof into a GIF.
      • saveAsGIF

        public void saveAsGIF()
        Saves the current animation as a GIF. Displays GIF options, captures the animation frames, and writes them to the selected file.
      • saveAsImage

        public void saveAsImage()
        Saves the current view as an image file. Opens a file chooser to select the output format and destination, then writes the captured image.
      • getBufferedImage

        public java.awt.image.BufferedImage getBufferedImage​(java.awt.Rectangle rc)
        Returns a buffered image of the drawing area bounded by the specified rectangle.
        Parameters:
        rc - the rectangle defining the area to capture
        Returns:
        the buffered image of the drawing area
      • getBufferedImage2

        public java.awt.image.BufferedImage getBufferedImage2​(java.awt.Rectangle rc)
        Returns a buffered image of the content pane bounded by the specified rectangle.
        Parameters:
        rc - the rectangle defining the area to capture
        Returns:
        the buffered image of the content pane
      • openAFile

        public boolean openAFile​(java.io.File file)
        Opens and loads a project file. Adjusts the file extension if necessary, then loads the project data accordingly.
        Parameters:
        file - the file to open
        Returns:
        true if the file was successfully loaded, false otherwise
      • openResourceFile

        public boolean openResourceFile​(java.lang.String resourcePath)
        Opens and loads a project file from a resource path.
        Parameters:
        resourcePath - the path of the resource to open
        Returns:
        true if the file was successfully loaded, false otherwise
      • addRightButtons

        protected void addRightButtons​(javax.swing.JToolBar toolBar)
        Adds right-side buttons to the provided tool bar.
        Parameters:
        toolBar - the tool bar to which the right-side buttons are added
      • addButtons

        protected void addButtons​(javax.swing.JToolBar toolBar)
        Adds primary action buttons to the provided tool bar.
        Parameters:
        toolBar - the tool bar to which the primary action buttons are added
      • makeAButton

        protected javax.swing.JToggleButton makeAButton​(java.lang.String imageName,
                                                        java.lang.String actionCommand,
                                                        java.lang.String toolTipText,
                                                        java.lang.String altText,
                                                        boolean t)
        Creates a toggle button with the specified image, action command, tooltip text, alternate text, and an optional action listener.
        Parameters:
        imageName - the name of the image file (without extension) to be used as the button icon
        actionCommand - the action command to be set for the button
        toolTipText - the tooltip text to be displayed when the mouse hovers over the button
        altText - the alternate text to be used if the image cannot be found
        t - a boolean indicating whether to add an action listener to the button
        Returns:
        the created JToggleButton
      • makeAButton

        protected javax.swing.JToggleButton makeAButton​(java.lang.String imageName,
                                                        java.lang.String actionCommand,
                                                        java.lang.String toolTipText,
                                                        java.lang.String altText)
        Creates a toggle button with the specified image, action command, tooltip text, and alternate text.
        Parameters:
        imageName - the name of the image file (without extension) to be used as the button icon
        actionCommand - the action command to be set for the button
        toolTipText - the tooltip text to be displayed when the mouse hovers over the button
        altText - the alternate text to be used if the image cannot be found
        Returns:
        the created JToggleButton
      • makeAButtonWith2ICon

        protected javax.swing.JToggleButton makeAButtonWith2ICon​(java.lang.String imageName,
                                                                 java.lang.String imageNameSelected,
                                                                 java.lang.String actionCommand,
                                                                 java.lang.String toolTipText,
                                                                 java.lang.String altText)
        Creates a toggle button with two icons, one for the default state and one for the selected state.
        Parameters:
        imageName - the name of the image file (without extension) to be used as the button icon in the default state
        imageNameSelected - the name of the image file (without extension) to be used as the button icon in the selected state
        actionCommand - the action command to be set for the button
        toolTipText - the tooltip text to be displayed when the mouse hovers over the button
        altText - the alternate text to be used if the image cannot be found
        Returns:
        the created DActionButton with two status icons
      • resetAllButtonStatus

        public void resetAllButtonStatus()
        This method is used to reset all button status. It is used to reset all button status when the user drags a file on the window.
      • updateTitle

        public void updateTitle()
        This method is used to update the title of the window. It is used to update the title of the window when the user drags a file on the window.
      • restorScroll

        public void restorScroll()
        This method is used to restore the scroll. It is used to restore the scroll when the user drags a file on the window.
      • setActionTip

        public void setActionTip​(java.lang.String name,
                                 java.lang.String tip)
        This method is used to set the text of the label. It is used to set the text of the label when the user drags a file on the window.
      • setTextLabel2

        public void setTextLabel2​(java.lang.String s,
                                  int n)
        This method is used to set the text of the label2. It is used to set the text of the label2 when the user drags a file on the window.
      • setLabelText2

        public void setLabelText2​(java.lang.String s)
        This method is used to set the text of the label2. It is used to set the text of the label2 when the user drags a file on the window.
      • stopTimer

        public void stopTimer()
        This method is used to stop the timer. It is used to stop the timer when the user drags a file on the window.
      • setTextLabel2

        public void setTextLabel2​(java.lang.String s)
        This method is used to set the text of the label2. It is used to set the text of the label2 when the user drags a file on the window.
      • setTipText

        public void setTipText​(java.lang.String text)
        This method is used to set the text of the tip. It is used to set the text of the tip when the user drags a file on the window.
      • dragEnter

        public void dragEnter​(java.awt.dnd.DropTargetDragEvent dtde)
        Specified by:
        dragEnter in interface java.awt.dnd.DropTargetListener
      • dragExit

        public void dragExit​(java.awt.dnd.DropTargetEvent dte)
        Specified by:
        dragExit in interface java.awt.dnd.DropTargetListener
      • dragOver

        public void dragOver​(java.awt.dnd.DropTargetDragEvent dtde)
        Specified by:
        dragOver in interface java.awt.dnd.DropTargetListener
      • dropActionChanged

        public void dropActionChanged​(java.awt.dnd.DropTargetDragEvent dtde)
        Specified by:
        dropActionChanged in interface java.awt.dnd.DropTargetListener
      • drop

        public void drop​(java.awt.dnd.DropTargetDropEvent dtde)
        This method is called when the user drops a file on the window. It accepts the drop and adds the file to the text area.
        Specified by:
        drop in interface java.awt.dnd.DropTargetListener
      • windowOpened

        public void windowOpened​(java.awt.event.WindowEvent e)
        Specified by:
        windowOpened in interface java.awt.event.WindowListener
      • windowClosing

        public void windowClosing​(java.awt.event.WindowEvent e)
        This method is called when the user closes the window. It asks the user if he wants to save the file before quitting.
        Specified by:
        windowClosing in interface java.awt.event.WindowListener
      • windowClosed

        public void windowClosed​(java.awt.event.WindowEvent e)
        Specified by:
        windowClosed in interface java.awt.event.WindowListener
      • windowIconified

        public void windowIconified​(java.awt.event.WindowEvent e)
        Specified by:
        windowIconified in interface java.awt.event.WindowListener
      • windowDeiconified

        public void windowDeiconified​(java.awt.event.WindowEvent e)
        Specified by:
        windowDeiconified in interface java.awt.event.WindowListener
      • windowActivated

        public void windowActivated​(java.awt.event.WindowEvent e)
        Specified by:
        windowActivated in interface java.awt.event.WindowListener
      • windowDeactivated

        public void windowDeactivated​(java.awt.event.WindowEvent e)
        Specified by:
        windowDeactivated in interface java.awt.event.WindowListener
      • createImageIcon

        protected static javax.swing.ImageIcon createImageIcon​(java.lang.String path)
        Create an ImageIcon from the path.
        Parameters:
        path - the path to the image
        Returns:
        the ImageIcon
      • getResourceURL

        public static java.net.URL getResourceURL​(java.lang.String path)
        Get the resource URL from the path.
        Parameters:
        path - the path to the resource
        Returns:
        the URL of the resource
      • performCommandLineRequests

        public static void performCommandLineRequests​(GExpert exp,
                                                      boolean breakOnProve)
        Perform command line requests. In the array commandlineCommand there are the commands requested by the user and in the array commandLineSrc the parameters for them. Some commands (now it is the "Prove" command) may be done asynchronous, so we cannot wait for their finish her and cannot continue with the remaining requests. Instead, we will continue performing the requests later, when the asynchronous command finishes.
        Parameters:
        exp - a GExpert instance
        breakOnProve - if the "Prove" command should be assumed as an asynchronous call
      • setLookAndFeel

        public static void setLookAndFeel()
      • main

        public static void main​(java.lang.String[] args)
        Main entry point of the application. Processes command line options and initializes the GUI.
        Parameters:
        args - command line arguments.
      • isRunningFromJar

        public static boolean isRunningFromJar()
        Checks if the application is running in a JAR file (including CheerpJ web environment).
        Returns:
        true if running from a JAR file, false otherwise.
      • isRunningInCheerpJ

        public static boolean isRunningInCheerpJ()
        Checks if the application is running in a CheerpJ web environment.
        Returns:
        true if likely running in CheerpJ, false otherwise.
      • openURL

        public static void openURL​(java.lang.String url)
        Opens the specified URL in the system's default web browser or handles it appropriately for the current environment (desktop or web/CheerpJ).
        Parameters:
        url - the URL to open.
      • saveAsPDF

        public void saveAsPDF()
        Saves the current view as a PDF file. Prompts the user to choose a file and generates the PDF output.
      • keyTyped

        public void keyTyped​(java.awt.event.KeyEvent e)
        Handles key typed events.
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
        Parameters:
        e - the key event.
      • keyPressed

        public void keyPressed​(java.awt.event.KeyEvent e)
        Handles key pressed events.
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
        Parameters:
        e - the key event.
      • keyReleased

        public void keyReleased​(java.awt.event.KeyEvent e)
        Handles key released events.
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
        Parameters:
        e - the key event.
      • setUIFont

        public static void setUIFont​(javax.swing.plaf.FontUIResource f)
        Sets the default UI font for all components.
        Parameters:
        f - the FontUIResource to be used.
      • start

        public void start()
        Starts or initializes the component.
      • stop

        public void stop()
        Stops or cleans up the component.
      • updateActionPool

        public void updateActionPool​(int n)
        Updates the action pool using the currently selected list of objects.
        Parameters:
        n - the pool identifier to update.
      • setActionPool

        public void setActionPool​(int a)
        Configures the action pool based on the specified pool type.
        Parameters:
        a - the pool type identifier.
      • onKeyCancel

        public void onKeyCancel()
        Cancels the current action triggered by key events.
      • initKeyMap

        public void initKeyMap()
        Initializes the key mapping by registering a KeyEventPostProcessor.