public class NetEditorFrame extends javax.swing.JFrame implements NetEditorListener, java.awt.event.ActionListener
All actions are handled by this frame. So you can override actionPerformed() to get the control on a menu item or a button. Ex: overriding the 'load' menu item action
public void actionPerformed(ActionEvent evt) { if( evt.getSource() == getFileMenuItem(NetEditorFrame.FILE_LOAD) ) { ... } else { super.actionPerformed(evt); } }
You can also add or remove menu items or toolbar buttons. Here is an example of code that customize the option menu :
traceMode = NetUtils.createMenuItem("Trace mode",0,0,this); editMode = NetUtils.createMenuItem("Edit mode",0,0,this); getOptionMenu().add(traceMode,0); getOptionMenu().add(editMode,1); getOptionMenu().add(new JSeparator(),2);
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
static int |
EDIT_COPY |
static int |
EDIT_CUT |
static int |
EDIT_DELETE |
static int |
EDIT_PASTE |
static int |
EDIT_REDO |
static int |
EDIT_SELECT_ALL |
static int |
EDIT_SELECT_NONE |
static int |
EDIT_UNDO |
static int |
FILE_EXIT |
static int |
FILE_LOAD |
static int |
FILE_NEW |
static int |
FILE_SAVE |
static int |
FILE_SAVEAS |
static int |
OPTION_FIT |
static int |
OPTION_PREF |
static int |
TOOL_BUBBLE |
static int |
TOOL_LABEL |
static int |
TOOL_LINK |
static int |
TOOL_REDO |
static int |
TOOL_UNDO |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
NetEditorFrame()
Construct a frame for the NetEditor.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt) |
void |
cancelCreate(NetEditor src)
Clear the help label when the creation mode is aborted
|
javax.swing.JButton |
createIconButton(java.lang.String resPath,
java.lang.String preffix,
java.lang.String toolTip,
java.awt.event.ActionListener l)
Create an icon button.
|
void |
exitApp()
Ask to save if the current scheme has unsaved modification before exiting.
|
javax.swing.JMenu |
getEditMenu()
Returns the edit menu.
|
javax.swing.JMenuItem |
getEditMenuItem(int which)
Returns a reference to the specified menu item of the edit menu.
|
javax.swing.JMenu |
getFileMenu()
Returns the file menu.
|
javax.swing.JMenuItem |
getFileMenuItem(int which)
Returns a reference to the specified menu item of the file menu.
|
javax.swing.JLabel |
getHelpLabel()
Returns a reference to the help label
|
javax.swing.JMenu |
getOptionMenu()
Returns the option menu.
|
javax.swing.JMenuItem |
getOptionMenuItem(int which)
Returns a reference to the specified menu item of the option menu.
|
javax.swing.JScrollPane |
getScrollPane()
Return the JScrollPane that contains the NetEditor object
|
javax.swing.JButton |
getToobarButton(int which)
Returns a reference to the specified button of the toolbar.
|
javax.swing.JToolBar |
getToolbar()
Returns the default toolbar
|
void |
linkClicked(NetEditor src,
NetObject obj,
int childIdx,
java.awt.event.MouseEvent e)
Trigerred when the user click on a link if the editor is not editable.
|
static void |
main(java.lang.String[] args)
Main function which launch the default NerEditor .
|
void |
objectClicked(NetEditor src,
NetObject obj,
java.awt.event.MouseEvent e)
Trigerred when the user click on an object only
if the editor is not editable.
|
void |
setAppTitle(java.lang.String appName)
Sets the app name used to build the frame title.
|
void |
setEditor(NetEditor editor)
Sets the NetEditor.
|
void |
sizeChanged(NetEditor src,
java.awt.Dimension d)
Revalidate the inner ScrollPane
|
void |
valueChanged(NetEditor src)
Update the title bar with the filename and the apptitle when
the scheme change .
|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int FILE_NEW
public static final int FILE_LOAD
public static final int FILE_SAVE
public static final int FILE_SAVEAS
public static final int FILE_EXIT
public static final int EDIT_UNDO
public static final int EDIT_REDO
public static final int EDIT_CUT
public static final int EDIT_COPY
public static final int EDIT_PASTE
public static final int EDIT_DELETE
public static final int EDIT_SELECT_ALL
public static final int EDIT_SELECT_NONE
public static final int OPTION_FIT
public static final int OPTION_PREF
public static final int TOOL_BUBBLE
public static final int TOOL_LABEL
public static final int TOOL_LINK
public static final int TOOL_UNDO
public static final int TOOL_REDO
public void setEditor(NetEditor editor)
editor
- NetEditor objectpublic void setAppTitle(java.lang.String appName)
appName
- application namevalueChanged(fr.esrf.tangoatk.widget.util.interlock.NetEditor)
public javax.swing.JMenu getFileMenu()
public javax.swing.JMenuItem getFileMenuItem(int which)
which
- Menu identifierFILE_NEW
,
FILE_LOAD
,
FILE_SAVE
,
FILE_SAVEAS
,
FILE_EXIT
public javax.swing.JMenu getEditMenu()
public javax.swing.JMenuItem getEditMenuItem(int which)
which
- Menu identifierEDIT_UNDO
,
EDIT_REDO
,
EDIT_CUT
,
EDIT_COPY
,
EDIT_PASTE
,
EDIT_DELETE
,
EDIT_SELECT_ALL
,
EDIT_SELECT_NONE
public javax.swing.JMenu getOptionMenu()
public javax.swing.JMenuItem getOptionMenuItem(int which)
which
- Menu identifierOPTION_FIT
,
OPTION_PREF
public javax.swing.JToolBar getToolbar()
public javax.swing.JButton getToobarButton(int which)
which
- Button identifierTOOL_BUBBLE
,
TOOL_LABEL
,
TOOL_LINK
,
TOOL_UNDO
,
TOOL_REDO
public javax.swing.JLabel getHelpLabel()
public javax.swing.JScrollPane getScrollPane()
public void exitApp()
public javax.swing.JButton createIconButton(java.lang.String resPath, java.lang.String preffix, java.lang.String toolTip, java.awt.event.ActionListener l)
resPath
- Resource path (ended with a '/')preffix
- Preffix of gif filestoolTip
- Tooltip textl
- ActionListenerpublic void valueChanged(NetEditor src)
valueChanged
in interface NetEditorListener
src
- NetEditorsetAppTitle(java.lang.String)
public void objectClicked(NetEditor src, NetObject obj, java.awt.event.MouseEvent e)
NetEditorListener
objectClicked
in interface NetEditorListener
src
- NetEditor that has trigerred the event.obj
- Clicked object.e
- Original MouseEventNetEditor.setEditable(boolean)
public void linkClicked(NetEditor src, NetObject obj, int childIdx, java.awt.event.MouseEvent e)
NetEditorListener
linkClicked
in interface NetEditorListener
src
- NetEditor that has trigerred the event.obj
- Clicked object.childIdx
- Child index.e
- Original MouseEventNetEditor.setEditable(boolean)
public void sizeChanged(NetEditor src, java.awt.Dimension d)
sizeChanged
in interface NetEditorListener
src
- NetEditor that has trigerred the event.d
- New dimension (in pixel coordinates)NetEditor.computePreferredSize()
,
NetEditor.loadFile(java.lang.String)
public void cancelCreate(NetEditor src)
cancelCreate
in interface NetEditorListener
src
- NetEditor that has trigerred the event.NetEditor.setEditable(boolean)
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
public static void main(java.lang.String[] args)