From ed6dfc6cc5fd2ce893c0f1d31869b1e7f4448ad8 Mon Sep 17 00:00:00 2001 From: Jaroslav Beran Date: Sat, 27 Jul 2019 00:27:24 +0200 Subject: [PATCH] Save dictionary --- src/main/java/cz/webstones/words/Main.form | 14 ++++++++++++++ src/main/java/cz/webstones/words/Main.java | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/main/java/cz/webstones/words/Main.form b/src/main/java/cz/webstones/words/Main.form index 18944d4..4999b0b 100644 --- a/src/main/java/cz/webstones/words/Main.form +++ b/src/main/java/cz/webstones/words/Main.form @@ -45,6 +45,20 @@ + + + + + + + + + + + + + + diff --git a/src/main/java/cz/webstones/words/Main.java b/src/main/java/cz/webstones/words/Main.java index 2ab365d..81003f7 100644 --- a/src/main/java/cz/webstones/words/Main.java +++ b/src/main/java/cz/webstones/words/Main.java @@ -351,6 +351,7 @@ private void initComponents() { jMenu3 = new javax.swing.JMenu(); jMenuItem10 = new javax.swing.JMenuItem(); jMenuItem12 = new javax.swing.JMenuItem(); + jMenuItem2 = new javax.swing.JMenuItem(); jMenu1 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem7 = new javax.swing.JMenuItem(); @@ -534,6 +535,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); jMenu3.add(jMenuItem12); + jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); + jMenuItem2.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N + jMenuItem2.setText("Save"); + jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem2ActionPerformed(evt); + } + }); + jMenu3.add(jMenuItem2); + jMenuBar1.add(jMenu3); jMenu1.setText("Word"); @@ -868,6 +879,16 @@ private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F } }//GEN-LAST:event_jMenuItem10ActionPerformed + private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + // Save Dictionary + try { + saveDirectory(); + JOptionPane.showMessageDialog(this, "Dictionary saved.", "Info", JOptionPane.INFORMATION_MESSAGE); + } catch (IOException ex) { + errorDialog.showError("Error: Cannot save dictionary.", ex); + } + }//GEN-LAST:event_jMenuItem2ActionPerformed + /** * @param args the command line arguments */ @@ -928,6 +949,7 @@ public void run() { private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem10; private javax.swing.JMenuItem jMenuItem12; + private javax.swing.JMenuItem jMenuItem2; private javax.swing.JMenuItem jMenuItem3; private javax.swing.JMenuItem jMenuItem4; private javax.swing.JMenuItem jMenuItem5;