001: /*
002: * $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/CopyCutPasteDeleteActions.java,v 1.1 2005/04/20 22:20:25 paulby Exp $
003: *
004: * Sun Public License Notice
005: *
006: * The contents of this file are subject to the Sun Public License Version
007: * 1.0 (the "License"). You may not use this file except in compliance with
008: * the License. A copy of the License is available at http://www.sun.com/
009: *
010: * The Original Code is the Java 3D(tm) Scene Graph Editor.
011: * The Initial Developer of the Original Code is Paul Byrne.
012: * Portions created by Paul Byrne are Copyright (C) 2002.
013: * All Rights Reserved.
014: *
015: * Contributor(s): Paul Byrne.
016: *
017: **/
018: package org.jdesktop.j3dedit;
019:
020: import org.jdesktop.j3dedit.actions.CutAction;
021: import org.jdesktop.j3dedit.actions.CopyAction;
022: import org.jdesktop.j3dedit.actions.PasteAction;
023: import org.jdesktop.j3dedit.actions.DeleteAction;
024:
025: /**
026: * Class to create the Copy Cut Paste and Delete actions
027: *
028: * @author Paul Byrne
029: * @version $Id: CopyCutPasteDeleteActions.java,v 1.1 2005/04/20 22:20:25 paulby Exp $
030: */
031: public class CopyCutPasteDeleteActions {
032:
033: /** Creates new form CutPasteCopyDeleteGUI */
034: public CopyCutPasteDeleteActions() {
035: initComponents();
036: setupActions();
037: }
038:
039: /**
040: * Returns the toolbar containing the Copy Cut Paste and Delete
041: * buttons
042: */
043: public javax.swing.JToolBar getToolBar() {
044: return copyCutPasteDeleteToolbar;
045: }
046:
047: /**
048: * Hack to convince the IDE that this is a JPanel
049: */
050: private void add(javax.swing.JToolBar tb) {
051: }
052:
053: /**
054: * Create the actions for the GUI. The action constructor registers
055: * the action with ActionManager
056: */
057: private void setupActions() {
058: CutAction cutAction;
059: CopyAction copyAction;
060: PasteAction pasteAction;
061: DeleteAction deleteAction;
062:
063: cutAction = new CutAction(cutM.getText(), cutB.getIcon());
064: cutAction.putValue(CutAction.SHORT_DESCRIPTION, cutB
065: .getToolTipText());
066: cutAction.putValue(CutAction.ACCELERATOR_KEY, cutM
067: .getAccelerator());
068: cutAction.putValue(CutAction.MNEMONIC_KEY, new Integer(cutB
069: .getMnemonic()));
070: cutM.setAction(cutAction);
071: cutB.setAction(cutAction);
072: cutB.setText(null);
073: cutAction.setEnabled(false);
074:
075: copyAction = new CopyAction(copyM.getText(), copyB.getIcon());
076: copyAction.putValue(copyAction.SHORT_DESCRIPTION, copyB
077: .getToolTipText());
078: copyAction.putValue(copyAction.ACCELERATOR_KEY, copyM
079: .getAccelerator());
080: copyAction.putValue(copyAction.MNEMONIC_KEY, new Integer(copyB
081: .getMnemonic()));
082: copyM.setAction(copyAction);
083: copyB.setAction(copyAction);
084: copyB.setText(null);
085: copyAction.setEnabled(false);
086:
087: pasteAction = new PasteAction(pasteM.getText(), pasteB
088: .getIcon());
089: pasteAction.putValue(pasteAction.SHORT_DESCRIPTION, pasteB
090: .getToolTipText());
091: pasteAction.putValue(pasteAction.ACCELERATOR_KEY, pasteM
092: .getAccelerator());
093: pasteAction.putValue(pasteAction.MNEMONIC_KEY, new Integer(
094: pasteB.getMnemonic()));
095: pasteM.setAction(pasteAction);
096: pasteB.setAction(pasteAction);
097: pasteB.setText(null);
098: pasteAction.setEnabled(false);
099:
100: deleteAction = new DeleteAction(deleteM.getText(), deleteB
101: .getIcon());
102: deleteAction.putValue(deleteAction.SHORT_DESCRIPTION, deleteB
103: .getToolTipText());
104: deleteAction.putValue(deleteAction.ACCELERATOR_KEY, deleteM
105: .getAccelerator());
106: deleteAction.putValue(deleteAction.MNEMONIC_KEY, new Integer(
107: deleteB.getMnemonic()));
108: deleteM.setAction(deleteAction);
109: deleteB.setAction(deleteAction);
110: deleteB.setText(null);
111: deleteAction.setEnabled(false);
112: }
113:
114: /** This method is called from within the constructor to
115: * initialize the form.
116: * WARNING: Do NOT modify this code. The content of this method is
117: * always regenerated by the Form Editor.
118: */
119: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
120: private void initComponents() {
121: jPopupMenu1 = new javax.swing.JPopupMenu();
122: cutM = new javax.swing.JMenuItem();
123: copyM = new javax.swing.JMenuItem();
124: pasteM = new javax.swing.JMenuItem();
125: deleteM = new javax.swing.JMenuItem();
126: copyCutPasteDeleteToolbar = new javax.swing.JToolBar();
127: copyB = new javax.swing.JButton();
128: cutB = new javax.swing.JButton();
129: deleteB = new javax.swing.JButton();
130: pasteB = new javax.swing.JButton();
131:
132: cutM.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
133: java.awt.event.KeyEvent.VK_C,
134: java.awt.event.InputEvent.CTRL_MASK));
135: cutM.setMnemonic('T');
136: cutM.setLabel("Cut");
137: cutM.setEnabled(false);
138: jPopupMenu1.add(cutM);
139:
140: copyM.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
141: java.awt.event.KeyEvent.VK_C,
142: java.awt.event.InputEvent.CTRL_MASK));
143: copyM.setMnemonic('c');
144: copyM.setLabel("Copy");
145: copyM.setEnabled(false);
146: jPopupMenu1.add(copyM);
147:
148: pasteM.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
149: java.awt.event.KeyEvent.VK_V,
150: java.awt.event.InputEvent.CTRL_MASK));
151: pasteM.setMnemonic('P');
152: pasteM.setLabel("Paste");
153: pasteM.setEnabled(false);
154: jPopupMenu1.add(pasteM);
155:
156: deleteM.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
157: java.awt.event.KeyEvent.VK_DELETE,
158: java.awt.event.InputEvent.CTRL_MASK));
159: deleteM.setMnemonic('D');
160: deleteM.setLabel("Delete");
161: deleteM.setEnabled(false);
162: jPopupMenu1.add(deleteM);
163:
164: copyB
165: .setIcon(new javax.swing.ImageIcon(
166: getClass()
167: .getResource(
168: "/org/jdesktop/j3dedit/scenegrapheditor/resources/JavaLookAndFeel/toolbarButtonGraphics/general/Copy16.gif")));
169: copyB.setToolTipText("Copy");
170: copyB.setEnabled(false);
171: copyB.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
172: copyB.setMaximumSize(new java.awt.Dimension(28, 28));
173: copyB.setMinimumSize(new java.awt.Dimension(30, 30));
174: copyB.setPreferredSize(new java.awt.Dimension(28, 28));
175: copyCutPasteDeleteToolbar.add(copyB);
176:
177: cutB
178: .setIcon(new javax.swing.ImageIcon(
179: getClass()
180: .getResource(
181: "/org/jdesktop/j3dedit/scenegrapheditor/resources/JavaLookAndFeel/toolbarButtonGraphics/general/Cut16.gif")));
182: cutB.setToolTipText("Cut");
183: cutB.setEnabled(false);
184: cutB.setMaximumSize(new java.awt.Dimension(28, 28));
185: cutB.setMinimumSize(new java.awt.Dimension(28, 28));
186: cutB.setPreferredSize(new java.awt.Dimension(28, 28));
187: copyCutPasteDeleteToolbar.add(cutB);
188:
189: deleteB
190: .setIcon(new javax.swing.ImageIcon(
191: getClass()
192: .getResource(
193: "/org/jdesktop/j3dedit/scenegrapheditor/resources/JavaLookAndFeel/toolbarButtonGraphics/general/Delete16.gif")));
194: deleteB.setToolTipText("Delete");
195: deleteB.setMaximumSize(new java.awt.Dimension(28, 28));
196: deleteB.setMinimumSize(new java.awt.Dimension(28, 28));
197: deleteB.setPreferredSize(new java.awt.Dimension(28, 28));
198: deleteB.setEnabled(false);
199: copyCutPasteDeleteToolbar.add(deleteB);
200:
201: pasteB
202: .setIcon(new javax.swing.ImageIcon(
203: getClass()
204: .getResource(
205: "/org/jdesktop/j3dedit/scenegrapheditor/resources/JavaLookAndFeel/toolbarButtonGraphics/general/Paste16.gif")));
206: pasteB.setToolTipText("Paste");
207: pasteB.setMaximumSize(new java.awt.Dimension(28, 28));
208: pasteB.setMinimumSize(new java.awt.Dimension(28, 28));
209: pasteB.setPreferredSize(new java.awt.Dimension(28, 28));
210: pasteB.setEnabled(false);
211: copyCutPasteDeleteToolbar.add(pasteB);
212:
213: add(copyCutPasteDeleteToolbar);
214:
215: }
216:
217: // </editor-fold>//GEN-END:initComponents
218:
219: // Variables declaration - do not modify//GEN-BEGIN:variables
220: private javax.swing.JButton copyB;
221: private javax.swing.JToolBar copyCutPasteDeleteToolbar;
222: private javax.swing.JMenuItem copyM;
223: private javax.swing.JButton cutB;
224: private javax.swing.JMenuItem cutM;
225: private javax.swing.JButton deleteB;
226: private javax.swing.JMenuItem deleteM;
227: private javax.swing.JPopupMenu jPopupMenu1;
228: private javax.swing.JButton pasteB;
229: private javax.swing.JMenuItem pasteM;
230: // End of variables declaration//GEN-END:variables
231:
232: }
|