home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / Sample.bin / Stylepad.java < prev    next >
Text File  |  1998-11-02  |  38KB  |  929 lines

  1. /*
  2.         A basic implementation of the JFrame class.
  3. */
  4.  
  5. import java.io.*;
  6. import java.awt.*;
  7. import java.util.*;
  8. import java.text.*;
  9. import java.awt.event.*;
  10. import com.sun.java.swing.*;
  11. import com.sun.java.swing.text.*;
  12. import com.sun.java.swing.undo.*;
  13. import com.sun.java.swing.event.*;
  14. import com.symantec.itools.swing.actions.JActionButton;
  15. import com.symantec.itools.swing.icons.ImageIcon;
  16. import com.symantec.itools.swing.actions.JActionMenuItem;
  17. import com.symantec.itools.swing.JToolBarSeparator;
  18.  
  19. public class Stylepad extends com.sun.java.swing.JFrame
  20. {
  21.     String curFile=null;
  22.     String curFileDir=null;
  23.     
  24.     public Stylepad()
  25.     {
  26.         // This code is automatically generated by Visual Cafe when you add
  27.         // components to the visual environment. It instantiates and initializes
  28.         // the components. To modify the code, only use code syntax that matches
  29.         // what Visual Cafe can generate, or Visual Cafe may be unable to back
  30.         // parse your Java file into its visual environment.
  31.         //{{INIT_CONTROLS
  32.         setJMenuBar(JMenuBar1);
  33.         setTitle("Stylepad");
  34.         getContentPane().setLayout(new BorderLayout(0,0));
  35.         setSize(474,377);
  36.         setVisible(false);
  37.         redColoredSquare.setFillColor(java.awt.Color.red);
  38.         //$$ redColoredSquare.move(0,0);
  39.         greenColoredSquare.setFillColor(java.awt.Color.green);
  40.         //$$ greenColoredSquare.move(0,0);
  41.         blueColoredSquare.setFillColor(java.awt.Color.blue);
  42.         //$$ blueColoredSquare.move(0,0);
  43.         try {
  44.             newIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/new.gif"));
  45.         }
  46.         catch (java.net.MalformedURLException error) { }
  47.         //$$ newIcon.move(0,0);
  48.         try {
  49.             openIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/open.gif"));
  50.         }
  51.         catch (java.net.MalformedURLException error) { }
  52.         //$$ openIcon.move(0,0);
  53.         try {
  54.             saveIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/save.gif"));
  55.         }
  56.         catch (java.net.MalformedURLException error) { }
  57.         //$$ saveIcon.move(0,0);
  58.         try {
  59.             cutIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/cut.gif"));
  60.         }
  61.         catch (java.net.MalformedURLException error) { }
  62.         //$$ cutIcon.move(0,0);
  63.         try {
  64.             copyIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/copy.gif"));
  65.         }
  66.         catch (java.net.MalformedURLException error) { }
  67.         //$$ copyIcon.move(0,0);
  68.         try {
  69.             pasteIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/paste.gif"));
  70.         }
  71.         catch (java.net.MalformedURLException error) { }
  72.         //$$ pasteIcon.move(0,0);
  73.         try {
  74.             boldIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/bold.gif"));
  75.         }
  76.         catch (java.net.MalformedURLException error) { }
  77.         //$$ boldIcon.move(0,0);
  78.         try {
  79.             italicIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/italic.gif"));
  80.         }
  81.         catch (java.net.MalformedURLException error) { }
  82.         //$$ italicIcon.move(0,0);
  83.         try {
  84.             underlineIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/underline.gif"));
  85.         }
  86.         catch (java.net.MalformedURLException error) { }
  87.         //$$ underlineIcon.move(0,0);
  88.         try {
  89.             leftIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/left.gif"));
  90.         }
  91.         catch (java.net.MalformedURLException error) { }
  92.         //$$ leftIcon.move(0,0);
  93.         try {
  94.             centerIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/center.gif"));
  95.         }
  96.         catch (java.net.MalformedURLException error) { }
  97.         //$$ centerIcon.move(0,0);
  98.         try {
  99.             rightIcon.setImageLocation(symantec.itools.net.RelativeURL.getURL("images/right.gif"));
  100.         }
  101.         catch (java.net.MalformedURLException error) { }
  102.         //$$ rightIcon.move(0,0);
  103.         newAction.setLongDescription("Create a new document");
  104.         newAction.setSmallIcon(newIcon);
  105.         newAction.setShortDescription("New");
  106.         newAction.setActionName("New");
  107.         //$$ newAction.move(0,0);
  108.         openAction.setLongDescription("Open An Existing Document");
  109.         openAction.setSmallIcon(openIcon);
  110.         openAction.setShortDescription("Open");
  111.         openAction.setActionName("Open");
  112.         //$$ openAction.move(0,0);
  113.         saveAction.setLongDescription("Save the current document");
  114.         saveAction.setSmallIcon(saveIcon);
  115.         saveAction.setShortDescription("Save");
  116.         saveAction.setActionName("Save");
  117.         //$$ saveAction.move(0,0);
  118.         cutAction.setLongDescription("Cut the selected text");
  119.         cutAction.setSmallIcon(cutIcon);
  120.         cutAction.setShortDescription("Cut");
  121.         cutAction.setActionName("Cut");
  122.         //$$ cutAction.move(0,0);
  123.         copyAction.setLongDescription("Copy the selected text");
  124.         copyAction.setSmallIcon(copyIcon);
  125.         copyAction.setShortDescription("Copy");
  126.         copyAction.setActionName("Copy");
  127.         //$$ copyAction.move(0,0);
  128.         pasteAction.setLongDescription("Paste text from the clipboard");
  129.         pasteAction.setSmallIcon(pasteIcon);
  130.         pasteAction.setShortDescription("Paste");
  131.         pasteAction.setActionName("Paste");
  132.         //$$ pasteAction.move(0,0);
  133.         undoAction.setEnabled(false);
  134.         undoAction.setLongDescription("Undo");
  135.         undoAction.setShortDescription("Undo");
  136.         undoAction.setActionName("Undo");
  137.         //$$ undoAction.move(0,0);
  138.         redoAction.setEnabled(false);
  139.         redoAction.setLongDescription("Redo");
  140.         redoAction.setShortDescription("Redo");
  141.         redoAction.setActionName("Redo");
  142.         //$$ redoAction.move(0,0);
  143.         boldAction.setLongDescription("Bold");
  144.         boldAction.setSmallIcon(boldIcon);
  145.         boldAction.setShortDescription("Bold");
  146.         boldAction.setActionName("Bold");
  147.         boldAction.setDefaultValue("Bold");
  148.         //$$ boldAction.move(0,0);
  149.         italicAction.setLongDescription("Italic");
  150.         italicAction.setSmallIcon(italicIcon);
  151.         italicAction.setShortDescription("Italic");
  152.         italicAction.setActionName("Italic");
  153.         italicAction.setDefaultValue("Italic");
  154.         //$$ italicAction.move(0,0);
  155.         underlineAction.setLongDescription("Underline");
  156.         underlineAction.setSmallIcon(underlineIcon);
  157.         underlineAction.setShortDescription("Underline");
  158.         underlineAction.setActionName("Underline");
  159.         underlineAction.setDefaultValue("Underline");
  160.         //$$ underlineAction.move(0,0);
  161.         leftAction.setSmallIcon(leftIcon);
  162.         //$$ leftAction.move(0,0);
  163.         centerAction.setSmallIcon(centerIcon);
  164.         //$$ centerAction.move(0,0);
  165.         rightAction.setSmallIcon(rightIcon);
  166.         //$$ rightAction.move(0,0);
  167.         exitAction.setLongDescription("Exit the application");
  168.         exitAction.setShortDescription("Exit");
  169.         exitAction.setActionName("Exit");
  170.         //$$ exitAction.move(0,0);
  171.         JScrollPane1.setOpaque(true);
  172.         getContentPane().add("Center", JScrollPane1);
  173.         JScrollPane1.setBounds(0,29,474,348);
  174.         JScrollPane1.getViewport().add(editor);
  175.         editor.setBounds(0,0,471,345);
  176.         JToolBar1.setAlignmentY(0.08F);
  177.         getContentPane().add("North", JToolBar1);
  178.         JToolBar1.setBounds(0,0,474,29);
  179.         JActionButton1.setActionCommand("New");
  180.         JActionButton1.setAction(newAction);
  181.         JToolBar1.add(JActionButton1);
  182.         JActionButton1.setBounds(16,4,51,23);
  183.         JActionButton2.setActionCommand("Open");
  184.         JActionButton2.setAction(openAction);
  185.         JToolBar1.add(JActionButton2);
  186.         JActionButton2.setBounds(67,4,57,23);
  187.         JActionButton3.setActionCommand("Save");
  188.         JActionButton3.setAction(saveAction);
  189.         JToolBar1.add(JActionButton3);
  190.         JActionButton3.setBounds(124,4,55,23);
  191.         JToolBar1.add(JToolBarSeparator1);
  192.         JToolBarSeparator1.setBounds(179,2,10,5);
  193.         JActionButton4.setActionCommand("Cut");
  194.         JActionButton4.setAction(cutAction);
  195.         JToolBar1.add(JActionButton4);
  196.         JActionButton4.setBounds(189,4,45,23);
  197.         JActionButton5.setActionCommand("Copy");
  198.         JActionButton5.setAction(copyAction);
  199.         JToolBar1.add(JActionButton5);
  200.         JActionButton5.setBounds(234,4,53,23);
  201.         JActionButton6.setActionCommand("Paste");
  202.         JActionButton6.setAction(pasteAction);
  203.         JToolBar1.add(JActionButton6);
  204.         JActionButton6.setBounds(287,4,59,23);
  205.         JToolBar1.add(JToolBarSeparator2);
  206.         JToolBarSeparator2.setBounds(346,2,10,5);
  207.         JActionButton7.setActionCommand("Bold");
  208.         JActionButton7.setAction(boldAction);
  209.         JToolBar1.add(JActionButton7);
  210.         JActionButton7.setBounds(356,4,51,23);
  211.         JActionButton8.setActionCommand("Italic");
  212.         JActionButton8.setAction(italicAction);
  213.         JToolBar1.add(JActionButton8);
  214.         JActionButton8.setBounds(407,4,53,23);
  215.         JActionButton9.setActionCommand("Underline");
  216.         JActionButton9.setAction(underlineAction);
  217.         JToolBar1.add(JActionButton9);
  218.         JActionButton9.setBounds(460,4,79,23);
  219.         JToolBar1.add(JToolBarSeparator3);
  220.         JToolBarSeparator3.setBounds(539,2,10,5);
  221.         JActionButton10.setAction(leftAction);
  222.         JToolBar1.add(JActionButton10);
  223.         JActionButton10.setBounds(549,4,21,23);
  224.         JActionButton11.setAction(centerAction);
  225.         JToolBar1.add(JActionButton11);
  226.         JActionButton11.setBounds(570,4,21,23);
  227.         JActionButton12.setAction(rightAction);
  228.         JToolBar1.add(JActionButton12);
  229.         JActionButton12.setBounds(591,4,21,23);
  230.         //$$ JMenuBar1.move(0,0);
  231.         fileMenu.setText("File");
  232.         fileMenu.setActionCommand("File");
  233.         fileMenu.setMnemonic((int)'F');
  234.         JMenuBar1.add(fileMenu);
  235.         JActionMenuItem1.setActionCommand("New");
  236.         JActionMenuItem1.setAction(newAction);
  237.         JActionMenuItem1.setAccelerator(com.sun.java.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, Event.CTRL_MASK));
  238.         JActionMenuItem1.setMnemonic((int)'N');
  239.         fileMenu.add(JActionMenuItem1);
  240.         JActionMenuItem2.setActionCommand("Open");
  241.         JActionMenuItem2.setAction(openAction);
  242.         JActionMenuItem2.setAccelerator(com.sun.java.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, Event.CTRL_MASK));
  243.         JActionMenuItem2.setMnemonic((int)'O');
  244.         fileMenu.add(JActionMenuItem2);
  245.         JActionMenuItem3.setActionCommand("Save");
  246.         JActionMenuItem3.setAction(saveAction);
  247.         JActionMenuItem3.setAccelerator(com.sun.java.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, Event.CTRL_MASK));
  248.         JActionMenuItem3.setMnemonic((int)'S');
  249.         fileMenu.add(JActionMenuItem3);
  250.         fileMenu.add(JSeparator1);
  251.         loadWonderland.setText("Load Wonderland");
  252.         loadWonderland.setActionCommand("Load Wonderland");
  253.         loadWonderland.setMnemonic((int)'L');
  254.         fileMenu.add(loadWonderland);
  255.         fileMenu.add(JSeparator5);
  256.         JActionMenuItem7.setActionCommand("Exit");
  257.         JActionMenuItem7.setAction(exitAction);
  258.         JActionMenuItem7.setMnemonic((int)'E');
  259.         fileMenu.add(JActionMenuItem7);
  260.         editMenu.setText("Edit");
  261.         editMenu.setActionCommand("Edit");
  262.         editMenu.setMnemonic((int)'E');
  263.         JMenuBar1.add(editMenu);
  264.         JActionMenuItem4.setActionCommand("Cut");
  265.         JActionMenuItem4.setAction(cutAction);
  266.         JActionMenuItem4.setAccelerator(com.sun.java.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, Event.CTRL_MASK));
  267.         JActionMenuItem4.setMnemonic((int)'U');
  268.         editMenu.add(JActionMenuItem4);
  269.         JActionMenuItem5.setActionCommand("Copy");
  270.         JActionMenuItem5.setAction(copyAction);
  271.         JActionMenuItem5.setAccelerator(com.sun.java.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, Event.CTRL_MASK));
  272.         JActionMenuItem5.setMnemonic((int)'O');
  273.         editMenu.add(JActionMenuItem5);
  274.         JActionMenuItem6.setActionCommand("Paste");
  275.         JActionMenuItem6.setAction(pasteAction);
  276.         JActionMenuItem6.setAccelerator(com.sun.java.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, Event.CTRL_MASK));
  277.         JActionMenuItem6.setMnemonic((int)'P');
  278.         editMenu.add(JActionMenuItem6);
  279.         editMenu.add(JSeparator2);
  280.         JActionMenuItem8.setActionCommand("Undo");
  281.         JActionMenuItem8.setAction(undoAction);
  282.         JActionMenuItem8.setAccelerator(com.sun.java.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, Event.CTRL_MASK));
  283.         editMenu.add(JActionMenuItem8);
  284.         JActionMenuItem9.setActionCommand("Redo");
  285.         JActionMenuItem9.setAction(redoAction);
  286.         JActionMenuItem9.setAccelerator(com.sun.java.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, Event.SHIFT_MASK|Event.CTRL_MASK));
  287.         editMenu.add(JActionMenuItem9);
  288.         colorMenu.setText("Color");
  289.         colorMenu.setActionCommand("Color");
  290.         colorMenu.setMnemonic((int)'C');
  291.         JMenuBar1.add(colorMenu);
  292.         redMenu.setIcon(redColoredSquare);
  293.         redMenu.setHorizontalTextPosition(com.sun.java.swing.SwingConstants.RIGHT);
  294.         redMenu.setText("Red");
  295.         redMenu.setActionCommand("jmenuItem");
  296.         colorMenu.add(redMenu);
  297.         greenMenu.setIcon(greenColoredSquare);
  298.         greenMenu.setHorizontalTextPosition(com.sun.java.swing.SwingConstants.RIGHT);
  299.         greenMenu.setText("Green");
  300.         greenMenu.setActionCommand("Green");
  301.         colorMenu.add(greenMenu);
  302.         blueMenu.setIcon(blueColoredSquare);
  303.         blueMenu.setHorizontalTextPosition(com.sun.java.swing.SwingConstants.RIGHT);
  304.         blueMenu.setText("Blue");
  305.         blueMenu.setActionCommand("Blue");
  306.         colorMenu.add(blueMenu);
  307.         fontMenu.setText("Font");
  308.         fontMenu.setActionCommand("Font");
  309.         fontMenu.setMnemonic((int)'O');
  310.         JMenuBar1.add(fontMenu);
  311.         dialogFtMenu.setText("Dialog");
  312.         dialogFtMenu.setActionCommand("Dialog");
  313.         fontMenu.add(dialogFtMenu);
  314.         helveticaFtMenu.setText("Helvetica");
  315.         helveticaFtMenu.setActionCommand("Helvetica");
  316.         fontMenu.add(helveticaFtMenu);
  317.         timesFtMenu.setText("Times New Roman");
  318.         timesFtMenu.setActionCommand("Times New Roman");
  319.         fontMenu.add(timesFtMenu);
  320.         courierFtMenu.setText("Courier");
  321.         courierFtMenu.setActionCommand("Courier");
  322.         fontMenu.add(courierFtMenu);
  323.         fontMenu.add(JSeparator3);
  324.         ftSize8Menu.setText("8");
  325.         ftSize8Menu.setActionCommand("8");
  326.         fontMenu.add(ftSize8Menu);
  327.         ftSize12Menu.setText("12");
  328.         ftSize12Menu.setActionCommand("12");
  329.         fontMenu.add(ftSize12Menu);
  330.         ftSize14Menu.setText("14");
  331.         ftSize14Menu.setActionCommand("14");
  332.         fontMenu.add(ftSize14Menu);
  333.         ftSize18Menu.setText("18");
  334.         ftSize18Menu.setActionCommand("18");
  335.         fontMenu.add(ftSize18Menu);
  336.         ftSize24Menu.setText("24");
  337.         ftSize24Menu.setActionCommand("24");
  338.         fontMenu.add(ftSize24Menu);
  339.         fontMenu.add(JSeparator4);
  340.         JActionMenuItem10.setActionCommand("Bold");
  341.         JActionMenuItem10.setAction(boldAction);
  342.         fontMenu.add(JActionMenuItem10);
  343.         JActionMenuItem11.setActionCommand("Italic");
  344.         JActionMenuItem11.setAction(italicAction);
  345.         fontMenu.add(JActionMenuItem11);
  346.         JActionMenuItem12.setActionCommand("Underline");
  347.         JActionMenuItem12.setAction(underlineAction);
  348.         fontMenu.add(JActionMenuItem12);
  349.         //}}
  350.         
  351.         editor.getDocument().addUndoableEditListener(undoHandler);
  352.  
  353.         //remove labels from toolbars, and add tooltips
  354.         JActionButton1.setText("");
  355.         JActionButton1.setToolTipText((String)JActionButton1.getAction().getValue(Action.LONG_DESCRIPTION));
  356.  
  357.         JActionButton2.setText("");
  358.         JActionButton2.setToolTipText((String)JActionButton2.getAction().getValue(Action.LONG_DESCRIPTION));
  359.  
  360.         JActionButton3.setText("");
  361.         JActionButton3.setToolTipText((String)JActionButton3.getAction().getValue(Action.LONG_DESCRIPTION));
  362.  
  363.         JActionButton4.setText("");
  364.         JActionButton4.setToolTipText((String)JActionButton4.getAction().getValue(Action.LONG_DESCRIPTION));
  365.  
  366.         JActionButton5.setText("");
  367.         JActionButton5.setToolTipText((String)JActionButton5.getAction().getValue(Action.LONG_DESCRIPTION));
  368.  
  369.         JActionButton6.setText("");
  370.         JActionButton6.setToolTipText((String)JActionButton6.getAction().getValue(Action.LONG_DESCRIPTION));
  371.  
  372.         JActionButton7.setText("");
  373.         JActionButton7.setToolTipText((String)JActionButton7.getAction().getValue(Action.LONG_DESCRIPTION));
  374.  
  375.         JActionButton8.setText("");
  376.         JActionButton8.setToolTipText((String)JActionButton8.getAction().getValue(Action.LONG_DESCRIPTION));
  377.  
  378.         JActionButton9.setText("");
  379.         JActionButton9.setToolTipText((String)JActionButton9.getAction().getValue(Action.LONG_DESCRIPTION));
  380.  
  381.         JActionButton10.setText("");
  382.         JActionButton10.setToolTipText((String)JActionButton10.getAction().getValue(Action.LONG_DESCRIPTION));
  383.  
  384.         JActionButton11.setText("");
  385.         JActionButton11.setToolTipText((String)JActionButton11.getAction().getValue(Action.LONG_DESCRIPTION));
  386.  
  387.         JActionButton12.setText("");
  388.         JActionButton12.setToolTipText((String)JActionButton12.getAction().getValue(Action.LONG_DESCRIPTION));
  389.         
  390.         //{{INIT_MENUS
  391.         //}}
  392.     
  393.         //{{REGISTER_LISTENERS
  394.         SymWindow aSymWindow = new SymWindow();
  395.         this.addWindowListener(aSymWindow);
  396.         SymAction lSymAction = new SymAction();
  397.         exitAction.addActionListener(lSymAction);
  398.         newAction.addActionListener(lSymAction);
  399.         openAction.addActionListener(lSymAction);
  400.         saveAction.addActionListener(lSymAction);
  401.         cutAction.addActionListener(lSymAction);
  402.         copyAction.addActionListener(lSymAction);
  403.         pasteAction.addActionListener(lSymAction);
  404.         undoAction.addActionListener(lSymAction);
  405.         redoAction.addActionListener(lSymAction);
  406.         boldAction.addActionListener(lSymAction);
  407.         italicAction.addActionListener(lSymAction);
  408.         underlineAction.addActionListener(lSymAction);
  409.         leftAction.addActionListener(lSymAction);
  410.         centerAction.addActionListener(lSymAction);
  411.         rightAction.addActionListener(lSymAction);
  412.         redMenu.addActionListener(lSymAction);
  413.         greenMenu.addActionListener(lSymAction);
  414.         blueMenu.addActionListener(lSymAction);
  415.         dialogFtMenu.addActionListener(lSymAction);
  416.         helveticaFtMenu.addActionListener(lSymAction);
  417.         timesFtMenu.addActionListener(lSymAction);
  418.         courierFtMenu.addActionListener(lSymAction);
  419.         ftSize8Menu.addActionListener(lSymAction);
  420.         ftSize12Menu.addActionListener(lSymAction);
  421.         ftSize14Menu.addActionListener(lSymAction);
  422.         ftSize18Menu.addActionListener(lSymAction);
  423.         ftSize24Menu.addActionListener(lSymAction);
  424.         loadWonderland.addActionListener(lSymAction);
  425.         //}}        
  426.     }
  427.     
  428.     void updateUndoStatus()
  429.     {
  430.         undoAction.setEnabled(undo.canUndo());
  431.         undoAction.setActionName(undo.getUndoPresentationName());
  432.         redoAction.setEnabled(undo.canRedo());
  433.         redoAction.setActionName(undo.getRedoPresentationName());
  434.     }
  435.     class UndoHandler implements UndoableEditListener {
  436.  
  437.     /**
  438.      * Messaged when the Document has created an edit, the edit is
  439.      * added to <code>undo</code>, an instance of UndoManager.
  440.      */
  441.         public void undoableEditHappened(UndoableEditEvent e) 
  442.         {
  443.             undo.addEdit(e.getEdit());
  444.             updateUndoStatus();
  445.         }
  446.     }
  447.  
  448.  
  449.     UndoableEditListener undoHandler = new UndoHandler();
  450.     UndoManager undo = new UndoManager();
  451.  
  452.     static public void main(String args[])
  453.     {
  454.         Stylepad sp = new Stylepad();
  455.         sp.setLocation(50,50);
  456.         sp.setVisible(true);
  457.     }
  458.  
  459.     //{{DECLARE_CONTROLS
  460.     ColoredSquare redColoredSquare = new ColoredSquare();
  461.     ColoredSquare greenColoredSquare = new ColoredSquare();
  462.     ColoredSquare blueColoredSquare = new ColoredSquare();
  463.     com.symantec.itools.swing.icons.ImageIcon newIcon = new com.symantec.itools.swing.icons.ImageIcon();
  464.     com.symantec.itools.swing.icons.ImageIcon openIcon = new com.symantec.itools.swing.icons.ImageIcon();
  465.     com.symantec.itools.swing.icons.ImageIcon saveIcon = new com.symantec.itools.swing.icons.ImageIcon();
  466.     com.symantec.itools.swing.icons.ImageIcon cutIcon = new com.symantec.itools.swing.icons.ImageIcon();
  467.     com.symantec.itools.swing.icons.ImageIcon copyIcon = new com.symantec.itools.swing.icons.ImageIcon();
  468.     com.symantec.itools.swing.icons.ImageIcon pasteIcon = new com.symantec.itools.swing.icons.ImageIcon();
  469.     com.symantec.itools.swing.icons.ImageIcon boldIcon = new com.symantec.itools.swing.icons.ImageIcon();
  470.     com.symantec.itools.swing.icons.ImageIcon italicIcon = new com.symantec.itools.swing.icons.ImageIcon();
  471.     com.symantec.itools.swing.icons.ImageIcon underlineIcon = new com.symantec.itools.swing.icons.ImageIcon();
  472.     com.symantec.itools.swing.icons.ImageIcon leftIcon = new com.symantec.itools.swing.icons.ImageIcon();
  473.     com.symantec.itools.swing.icons.ImageIcon centerIcon = new com.symantec.itools.swing.icons.ImageIcon();
  474.     com.symantec.itools.swing.icons.ImageIcon rightIcon = new com.symantec.itools.swing.icons.ImageIcon();
  475.     BasicAction newAction = new BasicAction();
  476.     BasicAction openAction = new BasicAction();
  477.     BasicAction saveAction = new BasicAction();
  478.     BasicAction cutAction = new BasicAction();
  479.     BasicAction copyAction = new BasicAction();
  480.     BasicAction pasteAction = new BasicAction();
  481.     BasicAction undoAction = new BasicAction();
  482.     BasicAction redoAction = new BasicAction();
  483.     BasicAction boldAction = new BasicAction();
  484.     BasicAction italicAction = new BasicAction();
  485.     BasicAction underlineAction = new BasicAction();
  486.     BasicAction leftAction = new BasicAction();
  487.     BasicAction centerAction = new BasicAction();
  488.     BasicAction rightAction = new BasicAction();
  489.     BasicAction exitAction = new BasicAction();
  490.     com.sun.java.swing.JScrollPane JScrollPane1 = new com.sun.java.swing.JScrollPane();
  491.     com.sun.java.swing.JTextPane editor = new com.sun.java.swing.JTextPane();
  492.     com.sun.java.swing.JToolBar JToolBar1 = new com.sun.java.swing.JToolBar();
  493.     com.symantec.itools.swing.actions.JActionButton JActionButton1 = new com.symantec.itools.swing.actions.JActionButton();
  494.     com.symantec.itools.swing.actions.JActionButton JActionButton2 = new com.symantec.itools.swing.actions.JActionButton();
  495.     com.symantec.itools.swing.actions.JActionButton JActionButton3 = new com.symantec.itools.swing.actions.JActionButton();
  496.     com.symantec.itools.swing.JToolBarSeparator JToolBarSeparator1 = new com.symantec.itools.swing.JToolBarSeparator();
  497.     com.symantec.itools.swing.actions.JActionButton JActionButton4 = new com.symantec.itools.swing.actions.JActionButton();
  498.     com.symantec.itools.swing.actions.JActionButton JActionButton5 = new com.symantec.itools.swing.actions.JActionButton();
  499.     com.symantec.itools.swing.actions.JActionButton JActionButton6 = new com.symantec.itools.swing.actions.JActionButton();
  500.     com.symantec.itools.swing.JToolBarSeparator JToolBarSeparator2 = new com.symantec.itools.swing.JToolBarSeparator();
  501.     com.symantec.itools.swing.actions.JActionButton JActionButton7 = new com.symantec.itools.swing.actions.JActionButton();
  502.     com.symantec.itools.swing.actions.JActionButton JActionButton8 = new com.symantec.itools.swing.actions.JActionButton();
  503.     com.symantec.itools.swing.actions.JActionButton JActionButton9 = new com.symantec.itools.swing.actions.JActionButton();
  504.     com.symantec.itools.swing.JToolBarSeparator JToolBarSeparator3 = new com.symantec.itools.swing.JToolBarSeparator();
  505.     com.symantec.itools.swing.actions.JActionButton JActionButton10 = new com.symantec.itools.swing.actions.JActionButton();
  506.     com.symantec.itools.swing.actions.JActionButton JActionButton11 = new com.symantec.itools.swing.actions.JActionButton();
  507.     com.symantec.itools.swing.actions.JActionButton JActionButton12 = new com.symantec.itools.swing.actions.JActionButton();
  508.     com.sun.java.swing.JMenuBar JMenuBar1 = new com.sun.java.swing.JMenuBar();
  509.     com.sun.java.swing.JMenu fileMenu = new com.sun.java.swing.JMenu();
  510.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem1 = new com.symantec.itools.swing.actions.JActionMenuItem();
  511.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem2 = new com.symantec.itools.swing.actions.JActionMenuItem();
  512.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem3 = new com.symantec.itools.swing.actions.JActionMenuItem();
  513.     com.sun.java.swing.JSeparator JSeparator1 = new com.sun.java.swing.JSeparator();
  514.     com.sun.java.swing.JMenuItem loadWonderland = new com.sun.java.swing.JMenuItem();
  515.     com.sun.java.swing.JSeparator JSeparator5 = new com.sun.java.swing.JSeparator();
  516.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem7 = new com.symantec.itools.swing.actions.JActionMenuItem();
  517.     com.sun.java.swing.JMenu editMenu = new com.sun.java.swing.JMenu();
  518.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem4 = new com.symantec.itools.swing.actions.JActionMenuItem();
  519.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem5 = new com.symantec.itools.swing.actions.JActionMenuItem();
  520.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem6 = new com.symantec.itools.swing.actions.JActionMenuItem();
  521.     com.sun.java.swing.JSeparator JSeparator2 = new com.sun.java.swing.JSeparator();
  522.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem8 = new com.symantec.itools.swing.actions.JActionMenuItem();
  523.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem9 = new com.symantec.itools.swing.actions.JActionMenuItem();
  524.     com.sun.java.swing.JMenu colorMenu = new com.sun.java.swing.JMenu();
  525.     com.sun.java.swing.JMenuItem redMenu = new com.sun.java.swing.JMenuItem();
  526.     com.sun.java.swing.JMenuItem greenMenu = new com.sun.java.swing.JMenuItem();
  527.     com.sun.java.swing.JMenuItem blueMenu = new com.sun.java.swing.JMenuItem();
  528.     com.sun.java.swing.JMenu fontMenu = new com.sun.java.swing.JMenu();
  529.     com.sun.java.swing.JMenuItem dialogFtMenu = new com.sun.java.swing.JMenuItem();
  530.     com.sun.java.swing.JMenuItem helveticaFtMenu = new com.sun.java.swing.JMenuItem();
  531.     com.sun.java.swing.JMenuItem timesFtMenu = new com.sun.java.swing.JMenuItem();
  532.     com.sun.java.swing.JMenuItem courierFtMenu = new com.sun.java.swing.JMenuItem();
  533.     com.sun.java.swing.JSeparator JSeparator3 = new com.sun.java.swing.JSeparator();
  534.     com.sun.java.swing.JMenuItem ftSize8Menu = new com.sun.java.swing.JMenuItem();
  535.     com.sun.java.swing.JMenuItem ftSize12Menu = new com.sun.java.swing.JMenuItem();
  536.     com.sun.java.swing.JMenuItem ftSize14Menu = new com.sun.java.swing.JMenuItem();
  537.     com.sun.java.swing.JMenuItem ftSize18Menu = new com.sun.java.swing.JMenuItem();
  538.     com.sun.java.swing.JMenuItem ftSize24Menu = new com.sun.java.swing.JMenuItem();
  539.     com.sun.java.swing.JSeparator JSeparator4 = new com.sun.java.swing.JSeparator();
  540.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem10 = new com.symantec.itools.swing.actions.JActionMenuItem();
  541.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem11 = new com.symantec.itools.swing.actions.JActionMenuItem();
  542.     com.symantec.itools.swing.actions.JActionMenuItem JActionMenuItem12 = new com.symantec.itools.swing.actions.JActionMenuItem();
  543.     //}}
  544.  
  545.     //{{DECLARE_MENUS
  546.     //}}
  547.  
  548.     class SymWindow extends java.awt.event.WindowAdapter
  549.     {
  550.         public void windowClosing(java.awt.event.WindowEvent event)
  551.         {
  552.             Object object = event.getSource();
  553.             if (object == Stylepad.this)
  554.                 notepad_windowClosing(event);
  555.         }
  556.     }
  557.  
  558.     void notepad_windowClosing(java.awt.event.WindowEvent event)
  559.     {
  560.         exitAction.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,"exit"));
  561.     }
  562.  
  563.     class SymAction implements java.awt.event.ActionListener
  564.     {
  565.         public void actionPerformed(java.awt.event.ActionEvent event)
  566.         {
  567.             Object object = event.getSource();
  568.             if (object == exitAction)
  569.                 exitAction_actionPerformed(event);
  570.             else if (object == newAction)
  571.                 newAction_actionPerformed(event);
  572.             else if (object == openAction)
  573.                 openAction_actionPerformed(event);
  574.             else if (object == saveAction)
  575.                 saveAction_actionPerformed(event);
  576.             else if (object == cutAction)
  577.                 cutAction_actionPerformed(event);
  578.             else if (object == copyAction)
  579.                 copyAction_actionPerformed(event);
  580.             else if (object == pasteAction)
  581.                 pasteAction_actionPerformed(event);
  582.             else if (object == undoAction)
  583.                 undoAction_actionPerformed(event);
  584.             else if (object == redoAction)
  585.                 redoAction_actionPerformed(event);
  586.             else if (object == boldAction)
  587.                 boldAction_actionPerformed(event);
  588.             else if (object == italicAction)
  589.                 italicAction_actionPerformed(event);
  590.             else if (object == underlineAction)
  591.                 underlineAction_actionPerformed(event);
  592.             else if (object == leftAction)
  593.                 leftAction_actionPerformed(event);
  594.             else if (object == centerAction)
  595.                 centerAction_actionPerformed(event);
  596.             else if (object == rightAction)
  597.                 rightAction_actionPerformed(event);
  598.             else if (object == redMenu)
  599.                 redMenu_actionPerformed(event);
  600.             else if (object == greenMenu)
  601.                 greenMenu_actionPerformed(event);
  602.             else if (object == blueMenu)
  603.                 blueMenu_actionPerformed(event);
  604.             else if (object == dialogFtMenu)
  605.                 dialogFtMenu_actionPerformed(event);
  606.             else if (object == helveticaFtMenu)
  607.                 helveticaFtMenu_actionPerformed(event);
  608.             else if (object == timesFtMenu)
  609.                 timesFtMenu_actionPerformed(event);
  610.             else if (object == courierFtMenu)
  611.                 courierFtMenu_actionPerformed(event);
  612.             else if (object == ftSize8Menu)
  613.                 ftSize8Menu_actionPerformed(event);
  614.             else if (object == ftSize12Menu)
  615.                 ftSize12Menu_actionPerformed(event);
  616.             else if (object == ftSize14Menu)
  617.                 ftSize14Menu_actionPerformed(event);
  618.             else if (object == ftSize18Menu)
  619.                 ftSize18Menu_actionPerformed(event);
  620.             else if (object == ftSize24Menu)
  621.                 ftSize24Menu_actionPerformed(event);
  622.             else if (object == loadWonderland)
  623.                 loadWonderland_actionPerformed(event);
  624.         }
  625.     }
  626.  
  627.     void exitAction_actionPerformed(java.awt.event.ActionEvent event)
  628.     {
  629.         System.exit(0);
  630.     }
  631.  
  632.     void newAction_actionPerformed(java.awt.event.ActionEvent event)
  633.     {
  634.         Document oldDoc = editor.getDocument();
  635.         if(oldDoc != null)
  636.         {
  637.             oldDoc.removeUndoableEditListener(undoHandler);
  638.         }
  639.         editor.setDocument(new DefaultStyledDocument());
  640.         editor.getDocument().addUndoableEditListener(undoHandler);
  641.         undo.discardAllEdits();
  642.         updateUndoStatus();
  643.         setTitle("Untitled");
  644.         curFile=null;
  645.         curFileDir=null;
  646.     }
  647.  
  648.     void openAction_actionPerformed(java.awt.event.ActionEvent event)
  649.     {
  650.         try
  651.         {
  652.             FileDialog fd = new FileDialog(this);
  653.             fd.setMode(FileDialog.LOAD);
  654.             fd.setVisible(true);
  655.             
  656.             String theFile = fd.getFile();
  657.             String theFileDir = fd.getDirectory();
  658.             if ( (theFile == null) || (theFile.equals("")))
  659.             {
  660.                 //no selected file so abort
  661.                 return;
  662.             }
  663.             
  664.             File f=new File(theFileDir, theFile);
  665.             if(!f.exists())
  666.             {   //file not there, abort
  667.                 return;
  668.             }
  669.             Document oldDoc = editor.getDocument();
  670.             if(oldDoc != null)
  671.             {
  672.                 oldDoc.removeUndoableEditListener(undoHandler);
  673.             }
  674.             setTitle(theFile);
  675.             
  676.             FileInputStream fin = new FileInputStream(f);
  677.             ObjectInputStream in=new ObjectInputStream(fin);
  678.             editor.setDocument((Document)in.readObject());
  679.  
  680.             in.close();
  681.             fin.close();
  682.             
  683.             editor.getDocument().addUndoableEditListener(undoHandler);
  684.             undo.discardAllEdits();
  685.             updateUndoStatus();
  686.  
  687.             curFile = theFile;
  688.             curFileDir = theFileDir;
  689.             setTitle(curFile);
  690.         }
  691.         catch(Exception e)
  692.         {
  693.             e.printStackTrace();
  694.         }
  695.     }
  696.  
  697.     void saveAction_actionPerformed(java.awt.event.ActionEvent event)
  698.     {
  699.         try
  700.         {
  701.             String text = editor.getText();
  702.             if (curFile==null)
  703.             {
  704.                 FileDialog fd = new FileDialog(this);
  705.                 fd.setMode(FileDialog.SAVE);
  706.                 fd.setVisible(true);
  707.                 String theFile=fd.getFile();
  708.                 String theFileDir=fd.getDirectory();
  709.                 if ( (theFile == null) || (theFile.equals("")))
  710.                 {
  711.                     //no selected file so abort
  712.                     return;
  713.                 }
  714.                 curFile=theFile;
  715.                 curFileDir=theFileDir;
  716.             }
  717.             
  718.             File f = new File(curFileDir, curFile);
  719.             FileOutputStream out = new FileOutputStream(f);
  720.             ObjectOutputStream ostrm = new ObjectOutputStream(out);
  721.             ostrm.writeObject(editor.getDocument());
  722.             ostrm.close();
  723.             out.close();
  724.             setTitle(curFile);
  725.         }
  726.         catch(Exception e)
  727.         {
  728.             e.printStackTrace();
  729.         }
  730.     }
  731.  
  732.     void cutAction_actionPerformed(java.awt.event.ActionEvent event)
  733.     {
  734.         editor.cut();
  735.     }
  736.  
  737.     void copyAction_actionPerformed(java.awt.event.ActionEvent event)
  738.     {
  739.         editor.copy();
  740.     }
  741.  
  742.     void pasteAction_actionPerformed(java.awt.event.ActionEvent event)
  743.     {
  744.         editor.paste();
  745.     }
  746.  
  747.     void undoAction_actionPerformed(java.awt.event.ActionEvent event)
  748.     {
  749.         try
  750.         {
  751.             undo.undo();
  752.         }
  753.         catch (Exception e)
  754.         {
  755.             e.printStackTrace();
  756.         }
  757.         updateUndoStatus();
  758.     }
  759.  
  760.     void redoAction_actionPerformed(java.awt.event.ActionEvent event)
  761.     {
  762.         try
  763.         {
  764.             undo.redo();
  765.         }
  766.         catch (Exception e)
  767.         {
  768.             e.printStackTrace();
  769.         }
  770.         updateUndoStatus();
  771.     }
  772.  
  773.     void boldAction_actionPerformed(java.awt.event.ActionEvent event)
  774.     {
  775.         StyledEditorKit sek= (StyledEditorKit)editor.getEditorKit();
  776.         MutableAttributeSet attr = sek.getInputAttributes();
  777.         boolean bold = (StyleConstants.isBold(attr)) ? false : true;
  778.         StyleConstants.setBold(attr, bold);
  779.         editor.setCharacterAttributes(attr, false);
  780.     }
  781.  
  782.     void italicAction_actionPerformed(java.awt.event.ActionEvent event)
  783.     {
  784.         StyledEditorKit sek= (StyledEditorKit)editor.getEditorKit();
  785.         MutableAttributeSet attr = sek.getInputAttributes();
  786.         boolean italic = (StyleConstants.isItalic(attr)) ? false : true;
  787.         StyleConstants.setItalic(attr, italic);
  788.         editor.setCharacterAttributes(attr, false);
  789.     }
  790.  
  791.     void underlineAction_actionPerformed(java.awt.event.ActionEvent event)
  792.     {
  793.         StyledEditorKit sek= (StyledEditorKit)editor.getEditorKit();
  794.         MutableAttributeSet attr = sek.getInputAttributes();
  795.         boolean underline = (StyleConstants.isUnderline(attr)) ? false : true;
  796.         StyleConstants.setUnderline(attr, underline);
  797.         editor.setCharacterAttributes(attr, false);
  798.     }
  799.  
  800.     void leftAction_actionPerformed(java.awt.event.ActionEvent event)
  801.     {
  802.         MutableAttributeSet attr = new SimpleAttributeSet();
  803.         StyleConstants.setAlignment(attr, StyleConstants.ALIGN_LEFT);
  804.  
  805.         int p0 = editor.getSelectionStart();
  806.         int p1 = editor.getSelectionEnd();
  807.  
  808.         StyledDocument doc = (StyledDocument)editor.getDocument();
  809.         doc.setParagraphAttributes(p0, p1 - p0, attr, true);
  810.  
  811.     }
  812.  
  813.     void centerAction_actionPerformed(java.awt.event.ActionEvent event)
  814.     {
  815.         MutableAttributeSet attr = new SimpleAttributeSet();
  816.         StyleConstants.setAlignment(attr, StyleConstants.ALIGN_CENTER);
  817.  
  818.         int p0 = editor.getSelectionStart();
  819.         int p1 = editor.getSelectionEnd();
  820.  
  821.         StyledDocument doc = (StyledDocument)editor.getDocument();
  822.         doc.setParagraphAttributes(p0, p1 - p0, attr, true);
  823.     }
  824.  
  825.     void rightAction_actionPerformed(java.awt.event.ActionEvent event)
  826.     {
  827.         MutableAttributeSet attr = new SimpleAttributeSet();
  828.         StyleConstants.setAlignment(attr, StyleConstants.ALIGN_RIGHT);
  829.  
  830.         int p0 = editor.getSelectionStart();
  831.         int p1 = editor.getSelectionEnd();
  832.  
  833.         StyledDocument doc = (StyledDocument)editor.getDocument();
  834.         doc.setParagraphAttributes(p0, p1 - p0, attr, true);
  835.     }
  836.  
  837.     void redMenu_actionPerformed(java.awt.event.ActionEvent event)
  838.     {
  839.         MutableAttributeSet attr = new SimpleAttributeSet();
  840.         StyleConstants.setForeground(attr, Color.red);
  841.         editor.setCharacterAttributes(attr, false);
  842.     }
  843.  
  844.     void greenMenu_actionPerformed(java.awt.event.ActionEvent event)
  845.     {
  846.         MutableAttributeSet attr = new SimpleAttributeSet();
  847.         StyleConstants.setForeground(attr, Color.green);
  848.         editor.setCharacterAttributes(attr, false);
  849.     }
  850.  
  851.     void blueMenu_actionPerformed(java.awt.event.ActionEvent event)
  852.     {
  853.         MutableAttributeSet attr = new SimpleAttributeSet();
  854.         StyleConstants.setForeground(attr, Color.blue);
  855.         editor.setCharacterAttributes(attr, false);
  856.     }
  857.  
  858.     void dialogFtMenu_actionPerformed(java.awt.event.ActionEvent event)
  859.     {
  860.         MutableAttributeSet attr = new SimpleAttributeSet();
  861.         StyleConstants.setFontFamily(attr, "Dialog");
  862.         editor.setCharacterAttributes(attr, false);
  863.     }
  864.  
  865.     void helveticaFtMenu_actionPerformed(java.awt.event.ActionEvent event)
  866.     {
  867.         MutableAttributeSet attr = new SimpleAttributeSet();
  868.         StyleConstants.setFontFamily(attr, "Helvetica");
  869.         editor.setCharacterAttributes(attr, false);
  870.     }
  871.  
  872.     void timesFtMenu_actionPerformed(java.awt.event.ActionEvent event)
  873.     {
  874.         MutableAttributeSet attr = new SimpleAttributeSet();
  875.         StyleConstants.setFontFamily(attr, "TimesRoman");
  876.         editor.setCharacterAttributes(attr, false);
  877.     }
  878.  
  879.     void courierFtMenu_actionPerformed(java.awt.event.ActionEvent event)
  880.     {
  881.         MutableAttributeSet attr = new SimpleAttributeSet();
  882.         StyleConstants.setFontFamily(attr, "Courier");
  883.         editor.setCharacterAttributes(attr, false);
  884.     }
  885.  
  886.     void ftSize8Menu_actionPerformed(java.awt.event.ActionEvent event)
  887.     {
  888.         MutableAttributeSet attr = new SimpleAttributeSet();
  889.         StyleConstants.setFontSize(attr, 8);
  890.         editor.setCharacterAttributes(attr, false);
  891.     }
  892.  
  893.     void ftSize12Menu_actionPerformed(java.awt.event.ActionEvent event)
  894.     {
  895.         MutableAttributeSet attr = new SimpleAttributeSet();
  896.         StyleConstants.setFontSize(attr, 12);
  897.         editor.setCharacterAttributes(attr, false);
  898.     }
  899.  
  900.     void ftSize14Menu_actionPerformed(java.awt.event.ActionEvent event)
  901.     {
  902.         MutableAttributeSet attr = new SimpleAttributeSet();
  903.         StyleConstants.setFontSize(attr, 14);
  904.         editor.setCharacterAttributes(attr, false);
  905.     }
  906.  
  907.     void ftSize18Menu_actionPerformed(java.awt.event.ActionEvent event)
  908.     {
  909.         MutableAttributeSet attr = new SimpleAttributeSet();
  910.         StyleConstants.setFontSize(attr, 18);
  911.         editor.setCharacterAttributes(attr, false);
  912.     }
  913.  
  914.     void ftSize24Menu_actionPerformed(java.awt.event.ActionEvent event)
  915.     {
  916.         MutableAttributeSet attr = new SimpleAttributeSet();
  917.         StyleConstants.setFontSize(attr, 24);
  918.         editor.setCharacterAttributes(attr, false);
  919.     }
  920.  
  921.     void loadWonderland_actionPerformed(java.awt.event.ActionEvent event)
  922.     {
  923.         StyleContext sc = new StyleContext();
  924.         DefaultStyledDocument doc = new DefaultStyledDocument(sc);
  925.         Wonderland wonder = new Wonderland(doc,sc);
  926.         wonder.loadDocument();
  927.         editor.setDocument(doc);
  928.     }
  929. }