Skip to content

Commit

Permalink
Save dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
berk76 committed Jul 26, 2019
1 parent d49b20f commit ed6dfc6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/cz/webstones/words/Main.form
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem12ActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem2">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+S"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Segoe UI" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem2ActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="jMenu1">
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/cz/webstones/words/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ed6dfc6

Please sign in to comment.