Drawing Frame: a frame that contains a drawing panel. @author Wolfgang Christian @created July 16, 2004 @version 1.1
| 59 | * @version 1.1 |
| 60 | */ |
| 61 | public class DrawingFrame extends OSPFrame implements ClipboardOwner { |
| 62 | // protected static String resourcesPath = |
| 63 | // "/org/opensourcephysics/resources/display/"; |
| 64 | // protected static String defaultToolsFileName = "drawing_tools.xml"; |
| 65 | protected JMenu fileMenu, editMenu; |
| 66 | protected JMenuItem copyItem, pasteItem, replaceItem; |
| 67 | protected DrawingPanel drawingPanel; |
| 68 | protected final static int MENU_SHORTCUT_KEY_MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); |
| 69 | protected Window customInspector; // optional custom inspector for this frame |
| 70 | protected Tool reply; |
| 71 | |
| 72 | /** |
| 73 | * DrawingFrame constructor that creates a default DrawingPanel. |
| 74 | * |
| 75 | * The default DrawingPanel is an InteractivePanel. |
| 76 | */ |
| 77 | public DrawingFrame() { |
| 78 | this(DisplayRes.getString("DrawingFrame.DefaultTitle"), new InteractivePanel()); //$NON-NLS-1$ |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * DrawingFrame constructor specifying the DrawingPanel that will be placed in |
| 83 | * the center of the content pane. |
| 84 | * |
| 85 | * @param drawingPanel |
| 86 | */ |
| 87 | public DrawingFrame(DrawingPanel drawingPanel) { |
| 88 | this(DisplayRes.getString("DrawingFrame.DefaultTitle"), drawingPanel); //$NON-NLS-1$ |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * DrawingFrame constructor specifying the title and the DrawingPanel that will |
| 93 | * be placed in the center of the content pane. |
| 94 | * |
| 95 | * @param title |
| 96 | * @param _drawingPanel |
| 97 | */ |
| 98 | public DrawingFrame(String title, DrawingPanel _drawingPanel) { |
| 99 | super(title); |
| 100 | // forces dependence on the DatasetTool class; |
| 101 | // add or remove the next line if you do not want the DatasetTool in your jar |
| 102 | // org.opensourcephysics.tools.DataTool.loadClass = true; |
| 103 | drawingPanel = _drawingPanel; |
| 104 | if (drawingPanel != null) { |
| 105 | getContentPane().add(drawingPanel, BorderLayout.CENTER); |
| 106 | } |
| 107 | getContentPane().add(buttonPanel, BorderLayout.SOUTH); // buttons are added using addButton method. |
| 108 | pack(); |
| 109 | if (!OSPRuntime.appletMode) { |
| 110 | createMenuBar(); |
| 111 | } |
| 112 | // responds to data from the Data Tool |
| 113 | reply = new Tool() { |
| 114 | @Override |
| 115 | public void send(Job job, Tool noReply) { |
| 116 | drawingPanel.receiveToolReply(job); |
| 117 | drawingPanel.repaint(); |
| 118 | } |
nothing calls this directly
no outgoing calls
no test coverage detected