public class CodeEditor extends TextEditor
CodeEditor object is a multi-line area that displays text.
It is suited for coding and it supports the syntax coloring of
C, C++, and Java.
It is created with tool bar.jp.kyasu.awt.util.JavaSyntaxColoringModel;,
直列化された形式| 修飾子とタイプ | フィールドと説明 |
|---|---|
static java.util.Vector |
CPPSuffixes |
static java.util.Vector |
CSuffixes |
static java.lang.String |
I_SYNTAX_COLOR |
static java.util.Vector |
JavaSuffixes |
static java.lang.String |
L_LANG_MODE |
static java.lang.String |
P_LANG_MODE |
static java.lang.String |
P_SYNTAX_COLOR |
protected ToggleButton |
syntaxColorButton |
A_COPY, A_CUT, A_FIND, A_GOTO, A_OPEN, A_PASTE, A_PRINT, A_SAVE, A_SAVE_AS, A_UNDO, caretDisableComps, change, checkboxMenuMap, I_AUTO_INDENT, I_INCREMENTAL_LOAD, I_SHOW_MATCH, I_SOFT_TAB, I_WORD_WRAP, INC_LINE_COUNT, incrementalLoad, 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, readEncoding, savedTextCursor, subComps, subCompStates, textChanged, writeEncoding, writeTargetCHAR_WRAP, columns, DEFAULT_HORIZONTAL_STYLE, DEFAULT_VERTICAL_STYLE, editController, editModel, editView, NO_WRAP, NOT_EDITABLE_BACKGROUND, NOT_EDITABLE_FOREGROUND, NOT_EDITABLE_SELECTION_BACKGROUND, NOT_EDITABLE_SELECTION_FOREGROUND, rows, savedBackgroundColor, savedForegroundColor, savedSelectionBackgroundColor, savedSelectionForegroundColor, SCROLLBARS_BOTH, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE, SCROLLBARS_VERTICAL_ONLY, textListener, textListenerK, textPositionListeners, WORD_WRAPfocusTraversable| コンストラクタと説明 |
|---|
CodeEditor()
Constructs a new code text area with tool bar.
|
CodeEditor(boolean showToolBar)
Constructs a new code text area with tool bar.
|
CodeEditor(int rows,
int columns)
Constructs a new code text area with tool bar, with the specified
number of rows and columns.
|
CodeEditor(int rows,
int columns,
boolean showToolBar)
Constructs a new code text area with tool bar, with the specified
number of rows and columns.
|
CodeEditor(int rows,
int columns,
boolean showToolBar,
java.awt.event.ActionListener openActionListener,
java.awt.event.ActionListener saveActionListener,
java.awt.event.ActionListener printActionListener)
Constructs a new code text area with tool bar, with the specified
number of rows and columns.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
protected TextEditModel |
createDefaultTextEditModel() |
protected java.awt.Menu |
createLangModeMenu() |
protected java.awt.Component[] |
createSyntaxColorComponents() |
protected java.awt.Component |
createTextComponent(TextEditModel model,
int rows,
int columns) |
protected ToolBar |
createToolBar(boolean showToolBar,
java.awt.event.ActionListener openActionListener,
java.awt.event.ActionListener saveActionListener,
java.awt.event.ActionListener printActionListener)
Creates a tool bar.
|
protected java.awt.Menu |
createViewMenu() |
protected JavaSyntaxColoringModel |
getCodeModel() |
java.awt.Color |
getCommentColor()
Returns the font color for the comment tokens.
|
java.awt.Color |
getConstantColor()
Returns the font color for the constant tokens.
|
java.awt.Color |
getKeywordColor()
Returns the font color for the keyword tokens.
|
java.lang.String |
getLangMode()
Returns the language mode that is one of "Java", "C", and "C++".
|
java.awt.Color |
getNormalColor()
Returns the font color for the normal tokens.
|
boolean |
isCMode()
Checks if this component colors the syntax of the C language.
|
boolean |
isCPPMode()
Checks if this component colors the syntax of the C++ language.
|
boolean |
isJavaMode()
Checks if this component colors the syntax of the Java language.
|
boolean |
isSyntaxColoringEnabled()
Tests if the syntax coloring is enabled.
|
void |
itemStateChanged(java.awt.event.ItemEvent e)
Invoked when an item's state has been changed.
|
static void |
main(java.lang.String[] args)
Executes the examples.
|
void |
setCMode()
Makes this component colors the syntax of the C language.
|
void |
setCommentColor(java.awt.Color color)
Sets the font color for the comment tokens.
|
void |
setConstantColor(java.awt.Color color)
Sets the font color for the constant tokens.
|
void |
setCPPMode()
Makes this component colors the syntax of the C++ language.
|
void |
setFont(java.awt.Font font)
Sets the font of this component.
|
void |
setJavaMode()
Makes this component colors the syntax of the Java language.
|
void |
setKeywordColor(java.awt.Color color)
Sets the font color for the keyword tokens.
|
void |
setNormalColor(java.awt.Color color)
Sets the font color for the normal tokens.
|
void |
setSyntaxColoringEnabled(boolean b)
Enables or disables the syntax coloring.
|
protected void |
setWriteTarget(java.io.File file) |
actionPerformed, addCaretDisableComp, addCaretDisableItem, addPropertyChangeListener, addSubComp, addTextListener, addTextPositionListener, appendAnyway, createCheckboxMenuItem, createEditComponents, createEditMenu, createFileComponents, createFindComponents, createFontMenu, createFormatMenu, createIconButton, createIconToggleButton, createInsertMenu, createMenuItem, createPrintComponents, createReadCharSetMenu, createTextComponent, createWriteCharSetMenu, disableSubComps, enableSubComps, getEditMenu, getFileFromLoadDialog, getFileFromSaveDialog, getFormatMenu, getIcon, getInsertMenu, getReadEncoding, getToolLabel, getToolTip, getViewMenu, getWriteEncoding, initComponent, isIncrementalLoad, isTextChanged, isWordWrap, load, open_file, open_file, print_file, print_file, removePropertyChangeListener, removeTextListener, removeTextPositionListener, save_file_as, save_file_as, save_file, save, setAutoIndentEnabled, setIncrementalLoad, setReadEncoding, setRichText, setShowMatchEnabled, setSoftTab, setText, setTEXT, setTextChanged, setWordWrap, setWriteEncoding, textPositionChanged, textValueChanged, warnaddKeyAction, append, append, append, appendText, backward_character, backward_word, beep, beginning_of_file, beginning_of_line, clearSoftTab, clearUndo, copy_clipboard, createTextComponent, createTextComponent, cut_clipboard, delete_next_character, delete_next_word, delete_previous_character, delete_previous_word, delete_selection, delete_to_end_of_line, delete_to_start_of_line, deselect_all, end_of_file, end_of_line, find_word, forward_character, forward_word, getCaretColor, getCaretPosition, getColumns, getController, getCurrentTextStyle, getEventSource, getKeyAction, getKeyBinding, getKeymap, getLineWrap, getLocationOfText, getMinimumSize, getMinimumSize, getModel, getParagraphStyleAt, getParagraphStyleCount, getParagraphStyles, getParagraphStyles, getPopupMenu, getPreferredSize, getPreferredSize, getRichText, getRows, getScrollbarThickness, getScrollbarVisibility, getSelectedText, getSelectedTEXT, getSelectionBackground, getSelectionEnd, getSelectionForeground, getSelectionStart, getSoftTab, getText, getTEXT, getText, getTextCaret, getTextStyleAt, getTextStyleCount, getTextStyles, getTextStyles, getView, goto_line, insert_character, insert_string, insert, insert, insert, insertText, isAutoIndentEnabled, isClickable, isClickToFocus, isEditable, isMouseFocus, isShowMatchEnabled, isSoftTab, kill_next_character, kill_next_word, kill_previous_character, kill_previous_word, kill_selection, kill_to_end_of_line, kill_to_start_of_line, minimumSize, modifyRangeParagraphStyle, modifyRangeParagraphStyle, modifyRangeTextStyle, modifyRangeTextStyle, modifySelectionParagraphStyle, modifySelectionParagraphStyle, modifySelectionTextStyle, modifySelectionTextStyle, newbreak, newline_and_indent, newline, next_line, next_page, paragraphStyles, paragraphStyles, paste_clipboard, performKeyAction, performKeyAction, preferredSize, previous_line, previous_page, print, print, print, print, print, processEvent, redraw_display, removeKeyAction, removeKeyActionNamed, replaceRange, replaceRange, replaceRange, replaceSelection, replaceSelection, replaceSelection, replaceText, select_all, select_line, select_word, select, select, select, selectAll, selectionIsCaret, setBackground, setCaretColor, setCaretPosition, setCaretPosition, setClickable, setClickToFocus, setColumns, setCursor, setEditable, setEditable, setEnabled, setForeground, setKeymap, setLineWrap, setLocationOfText, setMouseFocus, setPopupMenu, setRangeParagraphStyle, setRangeParagraphStyle, setRangeTextStyle, setRangeTextStyle, setRows, setScrollbarThickness, setSelectionBackground, setSelectionEnd, setSelectionForeground, setSelectionParagraphStyle, setSelectionParagraphStyle, setSelectionStart, setSelectionTextStyle, setSelectionTextStyle, setSoftTab, setTextCaret, tab, textStyles, textStyles, undo, unkilladdFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, delegateFocusEvent, delegateKeyEvent, delegateMouseEvent, focusGained, focusLost, getToolTipText, getToolTipVisual, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, setToolTipText, setToolTipText, setToolTipVisualaddNotify, bounds, disable, doLayout, enable, enable, getBounds, getFrame, getInsets, getLocation, getSize, hide, insets, isDirectNotification, isFocusTraversable, layout, location, minimumSize, postOldEvent, preferredSize, repaintNow, requestFocus, reshape, setBounds, setFocusTraversable, setVisible, show, show, size, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMousePosition, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, list, list, locate, paint, paintComponents, paramString, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseWheelListener, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprotected ToggleButton syntaxColorButton
public static final java.lang.String I_SYNTAX_COLOR
public static final java.lang.String L_LANG_MODE
public static final java.lang.String P_LANG_MODE
public static final java.lang.String P_SYNTAX_COLOR
public static final java.util.Vector JavaSuffixes
public static final java.util.Vector CSuffixes
public static final java.util.Vector CPPSuffixes
public CodeEditor()
public CodeEditor(boolean showToolBar)
showToolBar is true, then shows the tool bar initially;
otherwise hides.
This code text area is created with vertical scroll bar.showToolBar - if true, then shows the tool bar initially;
otherwise hides.public CodeEditor(int rows,
int columns)
rows - the number of rowscolumns - the number of columns.public CodeEditor(int rows,
int columns,
boolean showToolBar)
showToolBar is true,
then shows the tool bar initially; otherwise hidden.
This code text area is created with vertical scroll bar.rows - the number of rowscolumns - the number of columns.showToolBar - if true, then shows the tool bar initially;
otherwise hides.public CodeEditor(int rows,
int columns,
boolean showToolBar,
java.awt.event.ActionListener openActionListener,
java.awt.event.ActionListener saveActionListener,
java.awt.event.ActionListener printActionListener)
showToolBar is true,
then shows the tool bar initially; otherwise hidden.
This code text area is created with vertical scroll bar.rows - the number of rowscolumns - 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.protected TextEditModel createDefaultTextEditModel()
createDefaultTextEditModel クラス内 TextEditorprotected java.awt.Component createTextComponent(TextEditModel model, int rows, int columns)
createTextComponent クラス内 TextEditorprotected JavaSyntaxColoringModel getCodeModel()
public void setFont(java.awt.Font font)
setFont クラス内 TextComponentpublic java.lang.String getLangMode()
isJavaMode(),
isCMode(),
isCPPMode()public boolean isJavaMode()
setJavaMode()public void setJavaMode()
isJavaMode()public boolean isCMode()
setCMode()public void setCMode()
isCMode()public boolean isCPPMode()
setCPPMode()public void setCPPMode()
isCPPMode()public boolean isSyntaxColoringEnabled()
public void setSyntaxColoringEnabled(boolean b)
public java.awt.Color getNormalColor()
public void setNormalColor(java.awt.Color color)
public java.awt.Color getKeywordColor()
public void setKeywordColor(java.awt.Color color)
public java.awt.Color getConstantColor()
public void setConstantColor(java.awt.Color color)
public java.awt.Color getCommentColor()
public void setCommentColor(java.awt.Color color)
public void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged インタフェース内 java.awt.event.ItemListeneritemStateChanged クラス内 TextEditorItemListenerprotected ToolBar createToolBar(boolean showToolBar, java.awt.event.ActionListener openActionListener, java.awt.event.ActionListener saveActionListener, java.awt.event.ActionListener printActionListener)
createToolBar クラス内 TextEditorshowToolBar - 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.protected java.awt.Component[] createSyntaxColorComponents()
protected java.awt.Menu createViewMenu()
createViewMenu クラス内 TextEditorprotected java.awt.Menu createLangModeMenu()
protected void setWriteTarget(java.io.File file)
setWriteTarget クラス内 TextEditorpublic static void main(java.lang.String[] args)