Package dialog

Class MiniEditor

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Runnable, Accessible, RootPaneContainer, WindowConstants

public class MiniEditor extends JFrame implements Runnable
Class for a very small and simple text editor.
Since:
2004.05.27
See Also:
  • Field Details

  • Constructor Details

    • MiniEditor

      public MiniEditor(int mode)
      Create a simple text editor.
      Parameters:
      mode - the mode flags
      Since:
      2004.05.27 (Christian Borgelt)
    • MiniEditor

      public MiniEditor(Component owner, int mode)
      Create a simple text editor.
      Parameters:
      owner - the frame that is to own the editor
      mode - the mode flags
      Since:
      2007.02.12 (Christian Borgelt)
  • Method Details

    • run

      public void run()
      Create the user interface.

      Following the recommendations in the Java tutorial, the user interface is created in the "run" method, which is invoked from the event queue, in order to avoid problems with threads.

      Specified by:
      run in interface Runnable
      Since:
      2007.06.07 (Christian Borgelt)
    • setMessage

      public void setMessage(String msg)
      Set the message to display in the status line.
      Parameters:
      msg - the message to display in the status line
      Since:
      2007.06.07 (Christian Borgelt)
    • setText

      public void setText(String text)
      Set the text to edit.
      Parameters:
      text - the text to edit
      Since:
      2007.06.07 (Christian Borgelt)
    • loadText

      public boolean loadText(File file)
      Load text from a file.
      Parameters:
      file - the file to load
      Returns:
      whether the file was successfully read
      Since:
      2004.05.27 (Christian Borgelt)
    • saveText

      public boolean saveText(File file)
      Save text to a file.
      Parameters:
      file - the file to save the text to
      Returns:
      whether the file was successfully written
      Since:
      2004.05.27 (Christian Borgelt)
    • main

      public static void main(String[] args)
      Main function for testing basic functionality.
      Parameters:
      args - the command line arguments
      Since:
      2007.06.07 (Christian Borgelt)