All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jp.kyasu.editor.TextEditor

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----jp.kyasu.awt.KContainer
                           |
                           +----jp.kyasu.awt.EventProxyContainer
                                   |
                                   +----jp.kyasu.awt.TextComponent
                                           |
                                           +----jp.kyasu.editor.TextEditor

public class TextEditor
extends TextComponent
implements ActionListener, ItemListener
A TextEditor object is a multi-line area that displays text. It can be set to allow editing or read-only modes. It is created with tool bar.

Version:
19 Jun 1998
Author:
Kazuki YASUMATSU

Variable Index

 o A_COPY
 o A_CUT
 o A_FIND
 o A_GOTO
 o A_OPEN
 o A_PASTE
 o A_PRINT
 o A_SAVE
 o A_SAVE_AS
 o A_UNDO
 o I_AUTO_INDENT
 o I_INCREMENTAL_LOAD
 o I_SHOW_MATCH
 o I_SOFT_TAB
 o I_WORD_WRAP
 o L_CLOSE
 o L_CLOSE_CONFIRM
 o L_EDIT
 o L_EXIT
 o L_EXIT_CONFIRM
 o L_FILE
 o L_FONT
 o L_FONT_COLOR
 o L_FONT_NAME
 o L_FONT_SIZE
 o L_FONT_STYLE
 o L_HELP
 o L_KFC_ADDRESS
 o L_KFC_ADDRESS2
 o L_KFC_AUTHOR
 o L_KFC_URL
 o L_NEW_WIN
 o L_OPEN_CONFIRM
 o L_READ_ENCODING
 o L_VERSION
 o L_VIEW
 o L_WRITE_ENCODING
 o P_AUTO_INDENT
 o P_FILE
 o P_INCREMENTAL_LOAD
 o P_READ_ENCODING
 o P_SHOW_MATCH
 o P_SOFT_TAB
 o P_SUB_COMPS
 o P_WORD_WRAP
 o P_WRITE_ENCODING

Constructor Index

 o TextEditor()
Constructs a new text area with tool bar.
 o TextEditor(boolean)
Constructs a new text area with tool bar.
 o TextEditor(int, int)
Constructs a new text area with tool bar, with the specified number of rows and columns.
 o TextEditor(int, int, boolean)
Constructs a new text area with tool bar, with the specified number of rows and columns.
 o TextEditor(int, int, boolean, ActionListener, ActionListener, ActionListener)
Constructs a new text area with tool bar, with the specified number of rows and columns.

Method Index

 o actionPerformed(ActionEvent)
Invoked when an action occurs.
 o addPropertyChangeListener(PropertyChangeListener)
Add a PropertyChangeListener to the listener list.
 o addTextListener(TextListener)
Adds the specified text event listener to recieve text events from this text component.
 o addTextPositionListener(TextPositionListener)
Adds the specified text position event listener to recieve text position events from this text component.
 o disableSubComps()
Disables sub components.
 o enableSubComps()
Enables sub components.
 o getEditMenu()
Returns the edit menu for this editor, or null.
 o getFormatMenu()
Returns the format menu for this editor, or null.
 o getIcon(String)
Returns the icon for the spcified name.
 o getInsertMenu()
Returns the insert menu for this editor, or null.
 o getReadEncoding()
Returns the encoding name for reading.
 o getToolLabel(String)
Returns the tool label for the spcified name.
 o getToolTip(String)
Returns the tool tip for the spcified name.
 o getViewMenu()
Returns the view menu for this editor, or null.
 o getWriteEncoding()
Returns the encoding name for writing.
 o isIncrementalLoad()
Checks if the loading is done incrementally.
 o isTextChanged()
Checks if the text is changed.
 o isWordWrap()
Checks if this editor wraps the line at word boundary.
 o itemStateChanged(ItemEvent)
Invoked when an item's state has been changed.
 o load(BufferedReader)
Loads the contents of the specified reader incrementally into this component
 o main(String[])
Executes the examples.
 o open_file()
Opens the new file.
 o open_file(File)
Opens the specified file.
 o print_file()
Prints the file.
 o removePropertyChangeListener(PropertyChangeListener)
Remove a PropertyChangeListener from the listener list.
 o removeTextListener(TextListener)
Removes the specified text event listener so that it no longer receives text events from this textcomponent
 o removeTextPositionListener(TextPositionListener)
Removes the specified text position event listener so that it no longer receives text position events from this text component
 o save(Writer)
Saves the contents of this component into the specified writer.
 o save_file()
Saves the text into the current file.
 o save_file_as()
Saves the text into the selected file.
 o save_file_as(File)
Saves the text into the specified file.
 o setAutoIndentEnabled(boolean)
Enables the auto indent.
 o setIncrementalLoad(boolean)
Enables or disables the incremental loading.
 o setReadEncoding(String)
Sets the encoding name for reading to be the specified name.
 o setRichText(RichText)
Sets the rich text of this text component.
 o setShowMatchEnabled(boolean)
Enables the show match.
 o setSoftTab(boolean)
Enables the soft tab.
 o setText(String)
Sets the string that is presented by this text component to be the specified string.
 o setTEXT(Text)
Sets the text of this text component.
 o setTextChanged(boolean)
Sets the text is changed or not.
 o setWordWrap(boolean)
Enables the word wrap.
 o setWriteEncoding(String)
Sets the encoding name for writing to be the specified name.
 o textPositionChanged(TextPositionEvent)
Invoked when the position of the text has changed.
 o textValueChanged(TextEvent)
Invoked when the value of the text has changed.

Variables

 o L_KFC_URL
 public static final String L_KFC_URL
 o L_KFC_AUTHOR
 public static final String L_KFC_AUTHOR
 o L_KFC_ADDRESS
 public static final String L_KFC_ADDRESS
 o L_KFC_ADDRESS2
 public static final String L_KFC_ADDRESS2
 o L_FILE
 public static final String L_FILE
 o L_NEW_WIN
 public static final String L_NEW_WIN
 o L_CLOSE
 public static final String L_CLOSE
 o L_EXIT
 public static final String L_EXIT
 o L_EDIT
 public static final String L_EDIT
 o L_VIEW
 public static final String L_VIEW
 o L_HELP
 public static final String L_HELP
 o L_VERSION
 public static final String L_VERSION
 o L_FONT
 public static final String L_FONT
 o L_FONT_NAME
 public static final String L_FONT_NAME
 o L_FONT_STYLE
 public static final String L_FONT_STYLE
 o L_FONT_SIZE
 public static final String L_FONT_SIZE
 o L_FONT_COLOR
 public static final String L_FONT_COLOR
 o L_READ_ENCODING
 public static final String L_READ_ENCODING
 o L_WRITE_ENCODING
 public static final String L_WRITE_ENCODING
 o L_OPEN_CONFIRM
 public static final String L_OPEN_CONFIRM
 o L_CLOSE_CONFIRM
 public static final String L_CLOSE_CONFIRM
 o L_EXIT_CONFIRM
 public static final String L_EXIT_CONFIRM
 o A_OPEN
 public static final String A_OPEN
 o A_SAVE
 public static final String A_SAVE
 o A_SAVE_AS
 public static final String A_SAVE_AS
 o A_PRINT
 public static final String A_PRINT
 o A_COPY
 public static final String A_COPY
 o A_CUT
 public static final String A_CUT
 o A_PASTE
 public static final String A_PASTE
 o A_UNDO
 public static final String A_UNDO
 o A_FIND
 public static final String A_FIND
 o A_GOTO
 public static final String A_GOTO
 o I_WORD_WRAP
 public static final String I_WORD_WRAP
 o I_SOFT_TAB
 public static final String I_SOFT_TAB
 o I_AUTO_INDENT
 public static final String I_AUTO_INDENT
 o I_SHOW_MATCH
 public static final String I_SHOW_MATCH
 o I_INCREMENTAL_LOAD
 public static final String I_INCREMENTAL_LOAD
 o P_WORD_WRAP
 public static final String P_WORD_WRAP
 o P_SOFT_TAB
 public static final String P_SOFT_TAB
 o P_AUTO_INDENT
 public static final String P_AUTO_INDENT
 o P_SHOW_MATCH
 public static final String P_SHOW_MATCH
 o P_READ_ENCODING
 public static final String P_READ_ENCODING
 o P_WRITE_ENCODING
 public static final String P_WRITE_ENCODING
 o P_INCREMENTAL_LOAD
 public static final String P_INCREMENTAL_LOAD
 o P_FILE
 public static final String P_FILE
 o P_SUB_COMPS
 public static final String P_SUB_COMPS

Constructors

 o TextEditor
 public TextEditor()
Constructs a new text area with tool bar. This text area is created with vertical scroll bar.

 o TextEditor
 public TextEditor(boolean showToolBar)
Constructs a new text area with tool bar. If showToolBar is true, then shows the tool bar initially; otherwise hides. This text area is created with vertical scroll bar.

Parameters:
showToolBar - if true, then shows the tool bar initially; otherwise hides.
 o TextEditor
 public TextEditor(int rows,
                   int columns)
Constructs a new text area with tool bar, with the specified number of rows and columns. This text area is created with vertical scroll bar.

Parameters:
rows - the number of rows
columns - the number of columns.
 o TextEditor
 public TextEditor(int rows,
                   int columns,
                   boolean showToolBar)
Constructs a new text area with tool bar, with the specified number of rows and columns. If showToolBar is true, then shows the tool bar initially; otherwise hidden. This text area is created with vertical scroll bar.

Parameters:
rows - the number of rows
columns - the number of columns.
showToolBar - if true, then shows the tool bar initially; otherwise hides.
 o TextEditor
 public TextEditor(int rows,
                   int columns,
                   boolean showToolBar,
                   ActionListener openActionListener,
                   ActionListener saveActionListener,
                   ActionListener printActionListener)
Constructs a new text area with tool bar, with the specified number of rows and columns. If showToolBar is true, then shows the tool bar initially; otherwise hidden. This text area is created with vertical scroll bar.

Parameters:
rows - the number of rows
columns - the number of columns.
showToolBar - if true, then shows the tool bar initially; otherwise hides.
openActionListener - the action listener that receives action events from the open button in tool bar.
saveActionListener - the action listener that receives action events from the save button in tool bar.
printActionListener - the action listener that receives action events from the print button in tool bar.

Methods

 o setText
 public void setText(String str)
Sets the string that is presented by this text component to be the specified string.

Overrides:
setText in class TextComponent
 o setTEXT
 public void setTEXT(Text text)
Sets the text of this text component.

Overrides:
setTEXT in class TextComponent
 o setRichText
 public void setRichText(RichText rtext)
Sets the rich text of this text component.

Overrides:
setRichText in class TextComponent
 o textValueChanged
 public void textValueChanged(TextEvent e)
Invoked when the value of the text has changed.

Overrides:
textValueChanged in class TextComponent
See Also:
TextListener
 o isTextChanged
 public boolean isTextChanged()
Checks if the text is changed.

 o setTextChanged
 public void setTextChanged(boolean b)
Sets the text is changed or not.

 o getEditMenu
 public Menu getEditMenu()
Returns the edit menu for this editor, or null.

Overrides:
getEditMenu in class TextComponent
 o getViewMenu
 public Menu getViewMenu()
Returns the view menu for this editor, or null.

 o getInsertMenu
 public Menu getInsertMenu()
Returns the insert menu for this editor, or null.

 o getFormatMenu
 public Menu getFormatMenu()
Returns the format menu for this editor, or null.

 o getToolTip
 public String getToolTip(String name)
Returns the tool tip for the spcified name.

 o getToolLabel
 public String getToolLabel(String name)
Returns the tool label for the spcified name.

 o getIcon
 public VImage getIcon(String name)
Returns the icon for the spcified name.

Available icons are: 'anchor', 'backward', 'bold', 'center', 'color', 'copy', 'cut', 'decindent', 'find', 'forward', 'goto', 'hr', 'image', 'incindent', 'italic', 'java', 'large', 'left', 'link', 'list', 'new', 'olist', 'open', 'paste', 'preview', 'print', 'redo', 'reload', 'right', 'save', 'scolor', 'small', 'stop', 'table', 'underline', 'undo', and 'unlist'.

 o isWordWrap
 public boolean isWordWrap()
Checks if this editor wraps the line at word boundary.

 o setWordWrap
 public void setWordWrap(boolean wordWrap)
Enables the word wrap.

 o setSoftTab
 public void setSoftTab(boolean b)
Enables the soft tab.

 o setAutoIndentEnabled
 public void setAutoIndentEnabled(boolean autoIndent)
Enables the auto indent.

Overrides:
setAutoIndentEnabled in class TextComponent
 o setShowMatchEnabled
 public void setShowMatchEnabled(boolean showMatch)
Enables the show match.

Overrides:
setShowMatchEnabled in class TextComponent
 o getReadEncoding
 public String getReadEncoding()
Returns the encoding name for reading.

 o setReadEncoding
 public void setReadEncoding(String enc)
Sets the encoding name for reading to be the specified name.

 o getWriteEncoding
 public String getWriteEncoding()
Returns the encoding name for writing.

 o setWriteEncoding
 public void setWriteEncoding(String enc)
Sets the encoding name for writing to be the specified name.

 o isIncrementalLoad
 public boolean isIncrementalLoad()
Checks if the loading is done incrementally.

 o setIncrementalLoad
 public void setIncrementalLoad(boolean b)
Enables or disables the incremental loading.

 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.

Parameters:
listener - The PropertyChangeListener to be added.
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.

Parameters:
listener - The PropertyChangeListener to be removed
 o addTextListener
 public synchronized void addTextListener(TextListener l)
Adds the specified text event listener to recieve text events from this text component.

Parameters:
l - the text event listener.
Overrides:
addTextListener in class TextComponent
 o removeTextListener
 public synchronized void removeTextListener(TextListener l)
Removes the specified text event listener so that it no longer receives text events from this textcomponent

Parameters:
l - the text event listener.
Overrides:
removeTextListener in class TextComponent
 o addTextPositionListener
 public synchronized void addTextPositionListener(TextPositionListener l)
Adds the specified text position event listener to recieve text position events from this text component.

Parameters:
l - the text position event listener.
Overrides:
addTextPositionListener in class TextComponent
 o removeTextPositionListener
 public synchronized void removeTextPositionListener(TextPositionListener l)
Removes the specified text position event listener so that it no longer receives text position events from this text component

Parameters:
l - the text position event listener.
Overrides:
removeTextPositionListener in class TextComponent
 o textPositionChanged
 public void textPositionChanged(TextPositionEvent te)
Invoked when the position of the text has changed.

Overrides:
textPositionChanged in class TextComponent
See Also:
TextPositionListener
 o disableSubComps
 public synchronized void disableSubComps()
Disables sub components.

See Also:
enableSubComps
 o enableSubComps
 public synchronized void enableSubComps()
Enables sub components.

See Also:
disableSubComps
 o actionPerformed
 public void actionPerformed(ActionEvent e)
Invoked when an action occurs.

See Also:
ActionListener
 o itemStateChanged
 public void itemStateChanged(ItemEvent e)
Invoked when an item's state has been changed.

See Also:
ItemListener
 o open_file
 public void open_file()
Opens the new file.

 o open_file
 public void open_file(File file)
Opens the specified file.

 o save_file
 public void save_file()
Saves the text into the current file.

 o save_file_as
 public void save_file_as()
Saves the text into the selected file.

 o save_file_as
 public void save_file_as(File file)
Saves the text into the specified file.

 o load
 public boolean load(BufferedReader reader)
Loads the contents of the specified reader incrementally into this component

Parameters:
reader - the buffered reader to be loaded.
Returns:
true if the loading was succeeded.
 o save
 public boolean save(Writer writer)
Saves the contents of this component into the specified writer.

Parameters:
writer - the writer to save into.
Returns:
true if the saving was succeeded.
 o print_file
 public void print_file()
Prints the file.

 o main
 public static void main(String args[])
Executes the examples.


All Packages  Class Hierarchy  This Package  Previous  Next  Index