All Packages Class Hierarchy This Package Previous Next
Class wingsoft.editor.Main
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Window
|
+----java.awt.Frame
|
+----wingsoft.editor.Main
- public class Main
- extends Frame
- implements EditorConst, Constants
The Main class is used to construct WingEditor's main window.
Just like most of editors, the editor window in WingEditor
consists of 5 parts,
* Menu Bar
* Button Bar
* Scrolling Window
* Status Bar
* Footer
-
Main(String)
- Construct an editor window and load the file into
the window.
-
Main(String, Dimension)
- Construct an editor window with specified size and
load the file into
the window.
-
Main(String, int)
- Construct an editor window and load the file into
the window.
-
Main(String, int, Dimension)
- Construct an editor window with specified size
and load the file into
the window.
-
Main(String, int[])
- Construct an editor window with standard size and
load the file into the window.
-
Main(String, int[], Dimension)
- Construct an editor window with specified size and
load the file into
the window.
-
appendMenu(Menu)
- Append a menu to the existing menu bar.
-
appendMenu(Menu[])
- Append a set of menus to the existing menu bar.
-
appendMenuItem(MenuItem, int)
- Append a user-defined MenuItem to an existing Menu.
-
appendMenuItems(MenuItem[], int)
- Append a set of user-defined MenuItems to an existing Menu.
-
bufferChanged()
- Whether the buffer has been modified.
-
closeMain()
- Close this window, if the buffer is not saved yet,
save the buffer.
-
getClipBoard()
- Get the clip board.
-
getCurrentLocation()
- Get the current line where the cursor appears.
-
getEditor(String, boolean)
- This method is to get a Editor Window with the file.
-
getFileName()
- Get the name of the file under editing.
-
getSelectedString()
- Get the selected String.
-
getTextAtLine(int)
- Get the string at a specific line.
-
gotoLocation(int)
- Move the cursor to the line.
-
handleEvent(Event)
- Standard handleEvent.
-
layoutMain()
- Layout the Editor Window.
-
loadFile(String)
- Load the file into the current window.
-
postFooter(String)
- Post a note at this window's footer
-
quitMain()
- Quit this window, if the buffer is not saved yet,
it will be discarded.
-
replaceString(String, String)
- Replace string1 with string2.
-
saveFile(String)
- Save the buffer to the file.
-
setClipBoard(String)
- Set the clip board.
-
setColorLine(int)
- Set a mark at the specified line.
-
setUserButtonBar(UserButton[])
- Create a customerized button bar.
-
setUserButtonBar(UserButton[], boolean)
- Create a customerized button bar.
Main
public Main(String file)
- Construct an editor window and load the file into
the window. The cursor will stop at the first line
of the file.
- Parameters:
- file - the file to be loaded, null for new file
Main
public Main(String file,
Dimension size)
- Construct an editor window with specified size and
load the file into
the window. The cursor will stop at the first line
of the file.
- Parameters:
- file - the file to be loaded initially, null for new file
- size - the window size
Main
public Main(String file,
int offMenu[])
- Construct an editor window with standard size and
load the file into
the window. The cursor will stop at the first line
of the file.
Turn off some menus specified by offMenu on the menu bar.
- Parameters:
- file - the file to be loaded initially, null for new file
- offMenu - the menus being turned off, the menu number should
be less than the EditorConst.TOTAL_MENU.
Main
public Main(String file,
int offMenu[],
Dimension size)
- Construct an editor window with specified size and
load the file into
the window. The cursor will stop at the first line
of the file.
Turn off some menus specified by offMenu on the menu bar.
- Parameters:
- file - the file to be loaded initially, null for new file
- offMenu - the menus being turned off, the menu number should
be less than the EditorConst.TOTAL_MENU.
- size - the window size
Main
public Main(String file,
int line)
- Construct an editor window and load the file into
the window. The cursor will stop at the line
of the file.
- Parameters:
- file - the file to be loaded
- line - the line the cursor will appear
Main
public Main(String file,
int line,
Dimension size)
- Construct an editor window with specified size
and load the file into
the window. The cursor will stop at the line
of the file.
- Parameters:
- file - the file to be loaded
- line - the line the cursor will appear
- size - the window size
layoutMain
public void layoutMain()
- Layout the Editor Window.
This method should be called after UserButtonBar is set,
and userMenus or userMenuItems are set.
appendMenu
public void appendMenu(Menu userMenu)
- Append a menu to the existing menu bar.
- Parameters:
- userMenu - the user-defined menu
appendMenu
public void appendMenu(Menu userMenus[])
- Append a set of menus to the existing menu bar.
- Parameters:
- userMenus - the user-defined menus
appendMenuItem
public void appendMenuItem(MenuItem userMenuItem,
int menuNumber)
- Append a user-defined MenuItem to an existing Menu.
The MenuNumber should be in the range between 0 and
EditorConst.TOTAL_MENU.
- Parameters:
- userMenuItem - the user-defined menu item
- MenuNumber - the existing menu
appendMenuItems
public void appendMenuItems(MenuItem userMenuItems[],
int menuNumber)
- Append a set of user-defined MenuItems to an existing Menu.
The MenuNumber should be in the range between 0 and
EditorConst.TOTAL_MENU.
- Parameters:
- userMenuItems - the user-defined menu items
- MenuNumber - the existing menu
getEditor
protected Main getEditor(String file,
boolean must)
- This method is to get a Editor Window with the file.
If the Editor Window exists, return the Editor Window,
otherwise,
if must is true, create an Editor Window
with the file loaded,
else
return null
- Parameters:
- file - the file
- must - marks whether an editor window will be created if
the window does not exist.
getFileName
public String getFileName()
- Get the name of the file under editing.
saveFile
public void saveFile(String file)
- Save the buffer to the file.
- Parameters:
- file - the file to save to
gotoLocation
public void gotoLocation(int line)
- Move the cursor to the line.
- Parameters:
- line - the line number
getCurrentLocation
public int getCurrentLocation()
- Get the current line where the cursor appears.
setColorLine
public void setColorLine(int line)
- Set a mark at the specified line.
- Parameters:
- line - the line number
getSelectedString
public String getSelectedString()
- Get the selected String.
getClipBoard
public String getClipBoard()
- Get the clip board.
setClipBoard
public void setClipBoard(String string)
- Set the clip board.
- Parameters:
- string - the string to put on clip board.
replaceString
public void replaceString(String string1,
String string2)
- Replace string1 with string2.
- Parameters:
- string1 - the old string
- string2 - the new string
getTextAtLine
public String getTextAtLine(int line)
- Get the string at a specific line.
- Parameters:
- line - the line
loadFile
public void loadFile(String file)
- Load the file into the current window.
- Parameters:
- file - the file
setUserButtonBar
public void setUserButtonBar(UserButton buttons[],
boolean replace)
- Create a customerized button bar.
- Parameters:
- buttons - the user-defined button
that implement UserButton interface.
- replace - true to replace the existing button bar,
false to append to existing button bar.
setUserButtonBar
public void setUserButtonBar(UserButton buttons[])
- Create a customerized button bar.
- Parameters:
- buttons - the user-defined button
that implement UserButton interface.
handleEvent
public boolean handleEvent(Event event)
- Standard handleEvent.
- Overrides:
- handleEvent in class Component
postFooter
public synchronized void postFooter(String s)
- Post a note at this window's footer
bufferChanged
public boolean bufferChanged()
- Whether the buffer has been modified.
closeMain
public void closeMain()
- Close this window, if the buffer is not saved yet,
save the buffer.
quitMain
public void quitMain()
- Quit this window, if the buffer is not saved yet,
it will be discarded.
All Packages Class Hierarchy This Package Previous Next