我在netbeans中創建文本編輯器,並添加了名爲Copy,Cut &的jMenuItems粘貼到Edit菜單中。如何啓用複製/剪切/粘貼jMenuItem
如何啓用這些按鈕的actionPerformed()後才能執行這些功能
這裏是我的嘗試:
private void CopyActionPerformed(java.awt.event.ActionEvent evt) {
JMenuItem Copy = new JMenuItem(new DefaultEditorKit.CopyAction());
}
private void PasteActionPerformed(java.awt.event.ActionEvent evt) {
JMenuItem Paste = new JMenuItem(new DefaultEditorKit.PasteAction());
}
private void CutActionPerformed(java.awt.event.ActionEvent evt) {
JMenuItem Cut = new JMenuItem(new DefaultEditorKit.CutAction());
}
請學習java命名約定並堅持他們 – kleopatra 2012-03-15 14:52:10