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
-
A_COPY
-
-
A_CUT
-
-
A_FIND
-
-
A_GOTO
-
-
A_OPEN
-
-
A_PASTE
-
-
A_PRINT
-
-
A_SAVE
-
-
A_SAVE_AS
-
-
A_UNDO
-
-
I_AUTO_INDENT
-
-
I_INCREMENTAL_LOAD
-
-
I_SHOW_MATCH
-
-
I_SOFT_TAB
-
-
I_WORD_WRAP
-
-
L_CLOSE
-
-
L_CLOSE_CONFIRM
-
-
L_EDIT
-
-
L_EXIT
-
-
L_EXIT_CONFIRM
-
-
L_FILE
-
-
L_FONT
-
-
L_FONT_COLOR
-
-
L_FONT_NAME
-
-
L_FONT_SIZE
-
-
L_FONT_STYLE
-
-
L_HELP
-
-
L_KFC_ADDRESS
-
-
L_KFC_ADDRESS2
-
-
L_KFC_AUTHOR
-
-
L_KFC_URL
-
-
L_NEW_WIN
-
-
L_OPEN_CONFIRM
-
-
L_READ_ENCODING
-
-
L_VERSION
-
-
L_VIEW
-
-
L_WRITE_ENCODING
-
-
P_AUTO_INDENT
-
-
P_FILE
-
-
P_INCREMENTAL_LOAD
-
-
P_READ_ENCODING
-
-
P_SHOW_MATCH
-
-
P_SOFT_TAB
-
-
P_SUB_COMPS
-
-
P_WORD_WRAP
-
-
P_WRITE_ENCODING
-
-
TextEditor()
- Constructs a new text area with tool bar.
-
TextEditor(boolean)
- Constructs a new text area with tool bar.
-
TextEditor(int, int)
- Constructs a new text area with tool bar, with the specified number
of rows and columns.
-
TextEditor(int, int, boolean)
- Constructs a new text area with tool bar, with the specified number
of rows and columns.
-
TextEditor(int, int, boolean, ActionListener, ActionListener, ActionListener)
- Constructs a new text area with tool bar, with the specified number
of rows and columns.
-
actionPerformed(ActionEvent)
- Invoked when an action occurs.
-
addPropertyChangeListener(PropertyChangeListener)
- Add a PropertyChangeListener to the listener list.
-
addTextListener(TextListener)
- Adds the specified text event listener to recieve text events from
this text component.
-
addTextPositionListener(TextPositionListener)
- Adds the specified text position event listener to recieve text
position events from this text component.
-
disableSubComps()
- Disables sub components.
-
enableSubComps()
- Enables sub components.
-
getEditMenu()
- Returns the edit menu for this editor, or
null
.
-
getFormatMenu()
- Returns the format menu for this editor, or
null
.
-
getIcon(String)
- Returns the icon for the spcified name.
-
getInsertMenu()
- Returns the insert menu for this editor, or
null
.
-
getReadEncoding()
- Returns the encoding name for reading.
-
getToolLabel(String)
- Returns the tool label for the spcified name.
-
getToolTip(String)
- Returns the tool tip for the spcified name.
-
getViewMenu()
- Returns the view menu for this editor, or
null
.
-
getWriteEncoding()
- Returns the encoding name for writing.
-
isIncrementalLoad()
- Checks if the loading is done incrementally.
-
isTextChanged()
- Checks if the text is changed.
-
isWordWrap()
- Checks if this editor wraps the line at word boundary.
-
itemStateChanged(ItemEvent)
- Invoked when an item's state has been changed.
-
load(BufferedReader)
- Loads the contents of the specified reader incrementally into
this component
-
main(String[])
- Executes the examples.
-
open_file()
- Opens the new file.
-
open_file(File)
- Opens the specified file.
-
print_file()
- Prints the file.
-
removePropertyChangeListener(PropertyChangeListener)
- Remove a PropertyChangeListener from the listener list.
-
removeTextListener(TextListener)
- Removes the specified text event listener so that it no longer
receives text events from this textcomponent
-
removeTextPositionListener(TextPositionListener)
- Removes the specified text position event listener so that it no
longer receives text position events from this text component
-
save(Writer)
- Saves the contents of this component into the specified writer.
-
save_file()
- Saves the text into the current file.
-
save_file_as()
- Saves the text into the selected file.
-
save_file_as(File)
- Saves the text into the specified file.
-
setAutoIndentEnabled(boolean)
- Enables the auto indent.
-
setIncrementalLoad(boolean)
- Enables or disables the incremental loading.
-
setReadEncoding(String)
- Sets the encoding name for reading to be the specified name.
-
setRichText(RichText)
- Sets the rich text of this text component.
-
setShowMatchEnabled(boolean)
- Enables the show match.
-
setSoftTab(boolean)
- Enables the soft tab.
-
setText(String)
- Sets the string that is presented by this text component to be the
specified string.
-
setTEXT(Text)
- Sets the text of this text component.
-
setTextChanged(boolean)
- Sets the text is changed or not.
-
setWordWrap(boolean)
- Enables the word wrap.
-
setWriteEncoding(String)
- Sets the encoding name for writing to be the specified name.
-
textPositionChanged(TextPositionEvent)
- Invoked when the position of the text has changed.
-
textValueChanged(TextEvent)
- Invoked when the value of the text has changed.
L_KFC_URL
public static final String L_KFC_URL
L_KFC_AUTHOR
public static final String L_KFC_AUTHOR
L_KFC_ADDRESS
public static final String L_KFC_ADDRESS
L_KFC_ADDRESS2
public static final String L_KFC_ADDRESS2
L_FILE
public static final String L_FILE
L_NEW_WIN
public static final String L_NEW_WIN
L_CLOSE
public static final String L_CLOSE
L_EXIT
public static final String L_EXIT
L_EDIT
public static final String L_EDIT
L_VIEW
public static final String L_VIEW
L_HELP
public static final String L_HELP
L_VERSION
public static final String L_VERSION
L_FONT
public static final String L_FONT
L_FONT_NAME
public static final String L_FONT_NAME
L_FONT_STYLE
public static final String L_FONT_STYLE
L_FONT_SIZE
public static final String L_FONT_SIZE
L_FONT_COLOR
public static final String L_FONT_COLOR
L_READ_ENCODING
public static final String L_READ_ENCODING
L_WRITE_ENCODING
public static final String L_WRITE_ENCODING
L_OPEN_CONFIRM
public static final String L_OPEN_CONFIRM
L_CLOSE_CONFIRM
public static final String L_CLOSE_CONFIRM
L_EXIT_CONFIRM
public static final String L_EXIT_CONFIRM
A_OPEN
public static final String A_OPEN
A_SAVE
public static final String A_SAVE
A_SAVE_AS
public static final String A_SAVE_AS
A_PRINT
public static final String A_PRINT
A_COPY
public static final String A_COPY
A_CUT
public static final String A_CUT
A_PASTE
public static final String A_PASTE
A_UNDO
public static final String A_UNDO
A_FIND
public static final String A_FIND
A_GOTO
public static final String A_GOTO
I_WORD_WRAP
public static final String I_WORD_WRAP
I_SOFT_TAB
public static final String I_SOFT_TAB
I_AUTO_INDENT
public static final String I_AUTO_INDENT
I_SHOW_MATCH
public static final String I_SHOW_MATCH
I_INCREMENTAL_LOAD
public static final String I_INCREMENTAL_LOAD
P_WORD_WRAP
public static final String P_WORD_WRAP
P_SOFT_TAB
public static final String P_SOFT_TAB
P_AUTO_INDENT
public static final String P_AUTO_INDENT
P_SHOW_MATCH
public static final String P_SHOW_MATCH
P_READ_ENCODING
public static final String P_READ_ENCODING
P_WRITE_ENCODING
public static final String P_WRITE_ENCODING
P_INCREMENTAL_LOAD
public static final String P_INCREMENTAL_LOAD
P_FILE
public static final String P_FILE
P_SUB_COMPS
public static final String P_SUB_COMPS
TextEditor
public TextEditor()
- Constructs a new text area with tool bar.
This text area is created with vertical scroll bar.
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.
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.
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.
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.
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
setTEXT
public void setTEXT(Text text)
- Sets the text of this text component.
- Overrides:
- setTEXT in class TextComponent
setRichText
public void setRichText(RichText rtext)
- Sets the rich text of this text component.
- Overrides:
- setRichText in class TextComponent
textValueChanged
public void textValueChanged(TextEvent e)
- Invoked when the value of the text has changed.
- Overrides:
- textValueChanged in class TextComponent
- See Also:
- TextListener
isTextChanged
public boolean isTextChanged()
- Checks if the text is changed.
setTextChanged
public void setTextChanged(boolean b)
- Sets the text is changed or not.
getEditMenu
public Menu getEditMenu()
- Returns the edit menu for this editor, or
null
.
- Overrides:
- getEditMenu in class TextComponent
getViewMenu
public Menu getViewMenu()
- Returns the view menu for this editor, or
null
.
getInsertMenu
public Menu getInsertMenu()
- Returns the insert menu for this editor, or
null
.
getFormatMenu
public Menu getFormatMenu()
- Returns the format menu for this editor, or
null
.
getToolTip
public String getToolTip(String name)
- Returns the tool tip for the spcified name.
getToolLabel
public String getToolLabel(String name)
- Returns the tool label for the spcified name.
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'.
isWordWrap
public boolean isWordWrap()
- Checks if this editor wraps the line at word boundary.
setWordWrap
public void setWordWrap(boolean wordWrap)
- Enables the word wrap.
setSoftTab
public void setSoftTab(boolean b)
- Enables the soft tab.
setAutoIndentEnabled
public void setAutoIndentEnabled(boolean autoIndent)
- Enables the auto indent.
- Overrides:
- setAutoIndentEnabled in class TextComponent
setShowMatchEnabled
public void setShowMatchEnabled(boolean showMatch)
- Enables the show match.
- Overrides:
- setShowMatchEnabled in class TextComponent
getReadEncoding
public String getReadEncoding()
- Returns the encoding name for reading.
setReadEncoding
public void setReadEncoding(String enc)
- Sets the encoding name for reading to be the specified name.
getWriteEncoding
public String getWriteEncoding()
- Returns the encoding name for writing.
setWriteEncoding
public void setWriteEncoding(String enc)
- Sets the encoding name for writing to be the specified name.
isIncrementalLoad
public boolean isIncrementalLoad()
- Checks if the loading is done incrementally.
setIncrementalLoad
public void setIncrementalLoad(boolean b)
- Enables or disables the incremental loading.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Add a PropertyChangeListener to the listener list.
- Parameters:
- listener - The PropertyChangeListener to be added.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Remove a PropertyChangeListener from the listener list.
- Parameters:
- listener - The PropertyChangeListener to be removed
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
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
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
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
textPositionChanged
public void textPositionChanged(TextPositionEvent te)
- Invoked when the position of the text has changed.
- Overrides:
- textPositionChanged in class TextComponent
- See Also:
- TextPositionListener
disableSubComps
public synchronized void disableSubComps()
- Disables sub components.
- See Also:
- enableSubComps
enableSubComps
public synchronized void enableSubComps()
- Enables sub components.
- See Also:
- disableSubComps
actionPerformed
public void actionPerformed(ActionEvent e)
- Invoked when an action occurs.
- See Also:
- ActionListener
itemStateChanged
public void itemStateChanged(ItemEvent e)
- Invoked when an item's state has been changed.
- See Also:
- ItemListener
open_file
public void open_file()
- Opens the new file.
open_file
public void open_file(File file)
- Opens the specified file.
save_file
public void save_file()
- Saves the text into the current file.
save_file_as
public void save_file_as()
- Saves the text into the selected file.
save_file_as
public void save_file_as(File file)
- Saves the text into the specified file.
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.
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.
print_file
public void print_file()
- Prints the file.
main
public static void main(String args[])
- Executes the examples.
All Packages Class Hierarchy This Package Previous Next Index