You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MainWindow.java 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package view;
  7. /**
  8. *
  9. * @author PC
  10. */
  11. public class MainWindow extends javax.swing.JFrame {
  12. /**
  13. * @return the jpopEintragHinzufuegen
  14. */
  15. public javax.swing.JMenuItem getJpopEintragHinzufuegen() {
  16. return jpopEintragHinzufuegen;
  17. }
  18. /**
  19. * @return the jpopEintragLoeschen
  20. */
  21. public javax.swing.JMenuItem getJpopEintragLoeschen() {
  22. return jpopEintragLoeschen;
  23. }
  24. /**
  25. * Creates new form MainFrame
  26. */
  27. public MainWindow() {
  28. initComponents();
  29. }
  30. /**
  31. * This method is called from within the constructor to initialize the form.
  32. * WARNING: Do NOT modify this code. The content of this method is always
  33. * regenerated by the Form Editor.
  34. */
  35. @SuppressWarnings("unchecked")
  36. // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  37. private void initComponents() {
  38. jpopMenu = new javax.swing.JPopupMenu();
  39. jpopEintragHinzufuegen = new javax.swing.JMenuItem();
  40. jpopEintragLoeschen = new javax.swing.JMenuItem();
  41. jFileChooser = new javax.swing.JFileChooser();
  42. jpmainpanel = new javax.swing.JPanel();
  43. jtbmaintoolbar = new javax.swing.JToolBar();
  44. jbOpen = new javax.swing.JButton();
  45. jbSave = new javax.swing.JButton();
  46. statusbar = new javax.swing.JLabel();
  47. jSPAdressPane = new javax.swing.JScrollPane();
  48. jTableAdressen = new javax.swing.JTable();
  49. jMainMenu = new javax.swing.JMenuBar();
  50. jmFile = new javax.swing.JMenu();
  51. FileOpen = new javax.swing.JMenuItem();
  52. FileSave = new javax.swing.JMenuItem();
  53. jMenu2 = new javax.swing.JMenu();
  54. miUndo = new javax.swing.JMenuItem();
  55. jpopEintragHinzufuegen.setText("Eintrag hinzufügen");
  56. jpopMenu.add(jpopEintragHinzufuegen);
  57. jpopEintragLoeschen.setText("Eintrag löschen");
  58. jpopEintragLoeschen.addActionListener(new java.awt.event.ActionListener() {
  59. public void actionPerformed(java.awt.event.ActionEvent evt) {
  60. jpopEintragLoeschenActionPerformed(evt);
  61. }
  62. });
  63. jpopMenu.add(jpopEintragLoeschen);
  64. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  65. jpmainpanel.setLayout(new java.awt.BorderLayout());
  66. jtbmaintoolbar.setRollover(true);
  67. jbOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icons/Open16.gif"))); // NOI18N
  68. jbOpen.setToolTipText("Open a file");
  69. jbOpen.setFocusable(false);
  70. jbOpen.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  71. jbOpen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  72. jbOpen.addActionListener(new java.awt.event.ActionListener() {
  73. public void actionPerformed(java.awt.event.ActionEvent evt) {
  74. jbOpenActionPerformed(evt);
  75. }
  76. });
  77. jtbmaintoolbar.add(jbOpen);
  78. jbSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icons/Save16.gif"))); // NOI18N
  79. jbSave.setToolTipText("Save a file");
  80. jbSave.setFocusable(false);
  81. jbSave.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  82. jbSave.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  83. jtbmaintoolbar.add(jbSave);
  84. jpmainpanel.add(jtbmaintoolbar, java.awt.BorderLayout.PAGE_START);
  85. statusbar.setText(" ");
  86. jpmainpanel.add(statusbar, java.awt.BorderLayout.PAGE_END);
  87. jTableAdressen.setModel(new javax.swing.table.DefaultTableModel(
  88. new Object [][] {
  89. {null, null, null},
  90. {null, null, null},
  91. {null, null, null},
  92. {null, null, null}
  93. },
  94. new String [] {
  95. "Telefonnummer", "Adresse", "Name"
  96. }
  97. ));
  98. jTableAdressen.setComponentPopupMenu(jpopMenu);
  99. jSPAdressPane.setViewportView(jTableAdressen);
  100. jpmainpanel.add(jSPAdressPane, java.awt.BorderLayout.CENTER);
  101. jmFile.setMnemonic('f');
  102. jmFile.setText("File");
  103. jmFile.setToolTipText("General File Menu");
  104. FileOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_DOWN_MASK));
  105. FileOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icons/Open16.gif"))); // NOI18N
  106. FileOpen.setMnemonic('o');
  107. FileOpen.setText("Open");
  108. FileOpen.setToolTipText("Open a selected File");
  109. jmFile.add(FileOpen);
  110. FileSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_DOWN_MASK));
  111. FileSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icons/Save16.gif"))); // NOI18N
  112. FileSave.setText("Save");
  113. FileSave.setToolTipText("Save a file");
  114. jmFile.add(FileSave);
  115. jMainMenu.add(jmFile);
  116. jMenu2.setText("Edit");
  117. miUndo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, java.awt.event.InputEvent.CTRL_DOWN_MASK));
  118. miUndo.setText("Undo");
  119. miUndo.addActionListener(new java.awt.event.ActionListener() {
  120. public void actionPerformed(java.awt.event.ActionEvent evt) {
  121. miUndoActionPerformed(evt);
  122. }
  123. });
  124. jMenu2.add(miUndo);
  125. jMainMenu.add(jMenu2);
  126. setJMenuBar(jMainMenu);
  127. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  128. getContentPane().setLayout(layout);
  129. layout.setHorizontalGroup(
  130. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  131. .addComponent(jpmainpanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  132. );
  133. layout.setVerticalGroup(
  134. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  135. .addComponent(jpmainpanel, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
  136. );
  137. pack();
  138. }// </editor-fold>//GEN-END:initComponents
  139. private void jpopEintragLoeschenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jpopEintragLoeschenActionPerformed
  140. // TODO add your handling code here:
  141. }//GEN-LAST:event_jpopEintragLoeschenActionPerformed
  142. private void jbOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbOpenActionPerformed
  143. // TODO add your handling code here:
  144. }//GEN-LAST:event_jbOpenActionPerformed
  145. private void miUndoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miUndoActionPerformed
  146. // TODO add your handling code here:
  147. }//GEN-LAST:event_miUndoActionPerformed
  148. /**
  149. * @param args the command line arguments
  150. */
  151. public static void main(String args[]) {
  152. /* Set the Nimbus look and feel */
  153. //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  154. /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  155. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  156. */
  157. try {
  158. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  159. if ("Nimbus".equals(info.getName())) {
  160. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  161. break;
  162. }
  163. }
  164. } catch (ClassNotFoundException ex) {
  165. java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  166. } catch (InstantiationException ex) {
  167. java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  168. } catch (IllegalAccessException ex) {
  169. java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  170. } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  171. java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  172. }
  173. //</editor-fold>
  174. //</editor-fold>
  175. /* Create and display the form */
  176. java.awt.EventQueue.invokeLater(new Runnable() {
  177. public void run() {
  178. new MainWindow().setVisible(true);
  179. }
  180. });
  181. }
  182. // Variables declaration - do not modify//GEN-BEGIN:variables
  183. private javax.swing.JMenuItem FileOpen;
  184. private javax.swing.JMenuItem FileSave;
  185. private javax.swing.JFileChooser jFileChooser;
  186. private javax.swing.JMenuBar jMainMenu;
  187. private javax.swing.JMenu jMenu2;
  188. private javax.swing.JScrollPane jSPAdressPane;
  189. private javax.swing.JTable jTableAdressen;
  190. private javax.swing.JButton jbOpen;
  191. private javax.swing.JButton jbSave;
  192. private javax.swing.JMenu jmFile;
  193. private javax.swing.JPanel jpmainpanel;
  194. private javax.swing.JMenuItem jpopEintragHinzufuegen;
  195. private javax.swing.JMenuItem jpopEintragLoeschen;
  196. private javax.swing.JPopupMenu jpopMenu;
  197. private javax.swing.JToolBar jtbmaintoolbar;
  198. private javax.swing.JMenuItem miUndo;
  199. private javax.swing.JLabel statusbar;
  200. // End of variables declaration//GEN-END:variables
  201. /**
  202. * @return the FileOpen
  203. */
  204. public javax.swing.JMenuItem getFileOpen() {
  205. return FileOpen;
  206. }
  207. /**
  208. * @return the FileSave
  209. */
  210. public javax.swing.JMenuItem getFileSave() {
  211. return FileSave;
  212. }
  213. /**
  214. * @return the jbOpen
  215. */
  216. public javax.swing.JButton getJbOpen() {
  217. return jbOpen;
  218. }
  219. /**
  220. * @return the jbSave
  221. */
  222. public javax.swing.JButton getJbSave() {
  223. return jbSave;
  224. }
  225. /**
  226. * @return the jFileChooser1
  227. */
  228. public javax.swing.JFileChooser getjFileChooser() {
  229. return jFileChooser;
  230. }
  231. /**
  232. * @return the statusbar
  233. */
  234. public javax.swing.JLabel getStatusbar() {
  235. return statusbar;
  236. }
  237. /**
  238. * @return the jTableAdressen
  239. */
  240. public javax.swing.JTable getjTableAdressen() {
  241. return jTableAdressen;
  242. }
  243. /**
  244. * @param jTableAdressen the jTableAdressen to set
  245. */
  246. public void setjTableAdressen(javax.swing.JTable jTableAdressen) {
  247. this.jTableAdressen = jTableAdressen;
  248. }
  249. }