jplot
Class SimpleEditor

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jplot.SimpleEditor
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
- public class SimpleEditor
- extends javax.swing.JPanel
The class shows a frame which enables to look at and eventually edit
a file, any type of file. Build in a JPanel, so someone can reuse
the editor in another class.
| Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Fields inherited from class java.awt.Container |
|
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
textArea
private javax.swing.JEditorPane textArea
file
private java.io.File file
frame
private javax.swing.JFrame frame
text
private java.lang.String text
fonts
private javax.swing.JComboBox fonts
sizes
private javax.swing.JComboBox sizes
size
private int size
style
private int style
currentFont
private java.awt.Font currentFont
currentColor
private java.awt.Color currentColor
b_bold
private SmallToggleButton b_bold
b_italic
private SmallToggleButton b_italic
scrollpane
private javax.swing.JScrollPane scrollpane
textChanged
private boolean textChanged
thisPanel
private javax.swing.JPanel thisPanel
parent
private javax.swing.JPanel parent
findPanel
private SimpleEditor.FindPanel findPanel
isEditable
private boolean isEditable
panelSize
private java.awt.Dimension panelSize
g
private final javax.swing.text.DefaultHighlighter.DefaultHighlightPainter g
SimpleEditor
public SimpleEditor(javax.swing.JPanel parent,
java.lang.String title,
boolean isEditable,
int width,
int height)
- Principal constructor,
builds the panel which includes the report as text.
SimpleEditor
public SimpleEditor(javax.swing.JPanel parent,
java.lang.String title,
boolean isEditable)
- Constructor, builds a simple editor/viewer with default dimensions.
addButton
private void addButton(javax.swing.JToolBar toolbar,
javax.swing.Action action,
java.lang.String tip)
- Add a button of type SmallButton to the toolbar.
Done here to bypass a bug in jdk 1.4 which resets the
border of a button to some default value when added to the
toolbar.
getImageIcon
private javax.swing.ImageIcon getImageIcon(javax.swing.JPanel parent,
java.lang.String name)
makeMenuBar
javax.swing.JMenuBar makeMenuBar()
- Builds the menubar.
setSelectedFont
private void setSelectedFont()
fileToString
private void fileToString()
clear
public void clear()
- Clears the current canvas
refresh
public void refresh(java.io.File f)
- Refreshes the text, updates with the content of
the current outputfile.
refresh
public void refresh(java.lang.String s)
- Refreshes the text, updates with the content of
the current viewer/editor.
save
public void save()
- Saves the text after an edit to the current file.
saveAs
public void saveAs()
- Saves the text after an edit to a new file.
openFile
public void openFile()
- Saves the text after an edit to a new file.
dispose
public void dispose()
- Disposes the frame. Prefer hide(), but then, show doesn't
work with my current jdk (it pops the frame up iconified).
printText
private void printText()
printFile
private void printFile()
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Description copied from class:
javax.swing.JComponent
- Get the component's preferred size. If the JComponent.preferredSize>
JComponent.preferredSize 55
property has been explicitly set, it is returned. If the JComponent.preferredSize>JComponent.preferredSize 55 property has not been set but the JComponent.ui>JComponent.ui 55 property
has been, the result of ComponentUI.getPreferredSize(javax.swing.JComponent)>ComponentUI.getPreferredSize(javax.swing.JComponent) 55 is
returned. If neither property has been set, the result of Container.getPreferredSize()>Container.getPreferredSize() 55 is returned.
show
public void show(int x,
int y,
java.io.File f)
- Pops up a frame with the report printed in it.
show
public void show(int x,
int y,
java.lang.String t)
- Pops up a frame with the report printed in it.
find
private void find()