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.

gui.java 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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 matthias
  10. */
  11. public class gui extends javax.swing.JFrame {
  12. /**
  13. * @return the btnUndo
  14. */
  15. public javax.swing.JButton getBtnUndo()
  16. {
  17. return btnUndo;
  18. }
  19. /**
  20. * @return the contentTable1
  21. */
  22. public view.ContentTable getContentTable1()
  23. {
  24. return contentTable1;
  25. }
  26. /**
  27. * @return the FileChooser
  28. */
  29. public javax.swing.JFileChooser getFileChooser()
  30. {
  31. return FileChooser;
  32. }
  33. /**
  34. * @return the lblFilePath
  35. */
  36. public javax.swing.JLabel getLblFilePath()
  37. {
  38. return lblFilePath;
  39. }
  40. /**
  41. * @return the miNewFile
  42. */
  43. public javax.swing.JMenuItem getMiNewFile()
  44. {
  45. return miNewFile;
  46. }
  47. /**
  48. * @return the miOpen
  49. */
  50. public javax.swing.JMenuItem getMiOpen()
  51. {
  52. return miOpen;
  53. }
  54. /**
  55. * @return the miOpen_popup
  56. */
  57. public javax.swing.JMenuItem getMiOpen_popup()
  58. {
  59. return miOpen_popup;
  60. }
  61. /**
  62. * @return the FileDialog
  63. */
  64. public javax.swing.JDialog getFileDialog()
  65. {
  66. return FileDialog;
  67. }
  68. /**
  69. * @return the btnOpen
  70. */
  71. public javax.swing.JButton getBtnOpen()
  72. {
  73. return btnOpen;
  74. }
  75. /**
  76. * @return the btnSave
  77. */
  78. public javax.swing.JButton getBtnSave()
  79. {
  80. return btnSave;
  81. }
  82. /**
  83. * @return the miSave
  84. */
  85. public javax.swing.JMenuItem getMiSave()
  86. {
  87. return miSave;
  88. }
  89. /**
  90. * @return the miSave_popup
  91. */
  92. public javax.swing.JMenuItem getMiSave_popup()
  93. {
  94. return miSave_popup;
  95. }
  96. /**
  97. * Creates new form NewJFrame
  98. */
  99. public gui() {
  100. initComponents();
  101. }
  102. /**
  103. * This method is called from within the constructor to initialize the form.
  104. * WARNING: Do NOT modify this code. The content of this method is always
  105. * regenerated by the Form Editor.
  106. */
  107. @SuppressWarnings("unchecked")
  108. // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  109. private void initComponents()
  110. {
  111. jPopupMenu1 = new javax.swing.JPopupMenu();
  112. miSave_popup = new javax.swing.JMenuItem();
  113. miOpen_popup = new javax.swing.JMenuItem();
  114. FileDialog = new javax.swing.JDialog();
  115. FileDialogP1 = new javax.swing.JPanel();
  116. FileChooser = new javax.swing.JFileChooser();
  117. jToolBar1 = new javax.swing.JToolBar();
  118. btnOpen = new javax.swing.JButton();
  119. btnSave = new javax.swing.JButton();
  120. btnUndo = new javax.swing.JButton();
  121. lblFilePath = new javax.swing.JLabel();
  122. contentTable1 = new view.ContentTable();
  123. jMenuBar1 = new javax.swing.JMenuBar();
  124. jmFile = new javax.swing.JMenu();
  125. miSave = new javax.swing.JMenuItem();
  126. jmOpenPU = new javax.swing.JMenu();
  127. miNewFile = new javax.swing.JMenuItem();
  128. miOpen = new javax.swing.JMenuItem();
  129. jmEdit = new javax.swing.JMenu();
  130. jPopupMenu1.setComponentPopupMenu(jPopupMenu1);
  131. miSave_popup.setMnemonic('s');
  132. miSave_popup.setText("save");
  133. miSave_popup.setToolTipText("save this file");
  134. jPopupMenu1.add(miSave_popup);
  135. miOpen_popup.setMnemonic('o');
  136. miOpen_popup.setText("open");
  137. miOpen_popup.setToolTipText("open a file");
  138. jPopupMenu1.add(miOpen_popup);
  139. javax.swing.GroupLayout FileDialogP1Layout = new javax.swing.GroupLayout(FileDialogP1);
  140. FileDialogP1.setLayout(FileDialogP1Layout);
  141. FileDialogP1Layout.setHorizontalGroup(
  142. FileDialogP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  143. .addGap(0, 0, Short.MAX_VALUE)
  144. .addGroup(FileDialogP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  145. .addGroup(FileDialogP1Layout.createSequentialGroup()
  146. .addGap(0, 0, Short.MAX_VALUE)
  147. .addComponent(FileChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  148. .addGap(0, 0, Short.MAX_VALUE)))
  149. );
  150. FileDialogP1Layout.setVerticalGroup(
  151. FileDialogP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  152. .addGap(0, 0, Short.MAX_VALUE)
  153. .addGroup(FileDialogP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  154. .addGroup(FileDialogP1Layout.createSequentialGroup()
  155. .addGap(0, 0, Short.MAX_VALUE)
  156. .addComponent(FileChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  157. .addGap(0, 0, Short.MAX_VALUE)))
  158. );
  159. javax.swing.GroupLayout FileDialogLayout = new javax.swing.GroupLayout(FileDialog.getContentPane());
  160. FileDialog.getContentPane().setLayout(FileDialogLayout);
  161. FileDialogLayout.setHorizontalGroup(
  162. FileDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  163. .addGap(0, 400, Short.MAX_VALUE)
  164. .addGroup(FileDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  165. .addGroup(FileDialogLayout.createSequentialGroup()
  166. .addGap(0, 0, Short.MAX_VALUE)
  167. .addComponent(FileDialogP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  168. .addGap(0, 0, Short.MAX_VALUE)))
  169. );
  170. FileDialogLayout.setVerticalGroup(
  171. FileDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  172. .addGap(0, 300, Short.MAX_VALUE)
  173. .addGroup(FileDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  174. .addGroup(FileDialogLayout.createSequentialGroup()
  175. .addGap(0, 0, Short.MAX_VALUE)
  176. .addComponent(FileDialogP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  177. .addGap(0, 0, Short.MAX_VALUE)))
  178. );
  179. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  180. setTitle("Adressverwalter");
  181. setSize(new java.awt.Dimension(600, 600));
  182. jToolBar1.setRollover(true);
  183. btnOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icons/Open24.gif"))); // NOI18N
  184. btnOpen.setMnemonic('O');
  185. btnOpen.setToolTipText("Open a file");
  186. btnOpen.setFocusable(false);
  187. btnOpen.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  188. btnOpen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  189. jToolBar1.add(btnOpen);
  190. btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icons/Save24.gif"))); // NOI18N
  191. btnSave.setMnemonic('S');
  192. btnSave.setToolTipText("Save this file");
  193. btnSave.setFocusable(false);
  194. btnSave.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  195. btnSave.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  196. jToolBar1.add(btnSave);
  197. btnUndo.setText("undo");
  198. btnUndo.setFocusable(false);
  199. btnUndo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  200. btnUndo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  201. jToolBar1.add(btnUndo);
  202. getContentPane().add(jToolBar1, java.awt.BorderLayout.PAGE_START);
  203. lblFilePath.setText("/");
  204. lblFilePath.setToolTipText("File location");
  205. getContentPane().add(lblFilePath, java.awt.BorderLayout.PAGE_END);
  206. contentTable1.setComponentPopupMenu(jPopupMenu1);
  207. getContentPane().add(contentTable1, java.awt.BorderLayout.CENTER);
  208. jmFile.setText("File");
  209. miSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
  210. miSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icons/Save24.gif"))); // NOI18N
  211. miSave.setMnemonic('s');
  212. miSave.setText("Save");
  213. miSave.setToolTipText("Save current file");
  214. jmFile.add(miSave);
  215. jmOpenPU.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/icons/Open24.gif"))); // NOI18N
  216. jmOpenPU.setMnemonic('O');
  217. jmOpenPU.setText("Open");
  218. miNewFile.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
  219. miNewFile.setMnemonic('n');
  220. miNewFile.setText("new");
  221. miNewFile.setToolTipText("create a new file");
  222. jmOpenPU.add(miNewFile);
  223. miOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
  224. miOpen.setMnemonic('o');
  225. miOpen.setText("open");
  226. miOpen.setToolTipText("open a existing file");
  227. jmOpenPU.add(miOpen);
  228. jmFile.add(jmOpenPU);
  229. jMenuBar1.add(jmFile);
  230. jmEdit.setText("Edit");
  231. jMenuBar1.add(jmEdit);
  232. setJMenuBar(jMenuBar1);
  233. setSize(new java.awt.Dimension(564, 425));
  234. setLocationRelativeTo(null);
  235. }// </editor-fold>//GEN-END:initComponents
  236. /**
  237. * @param args the command line arguments
  238. */
  239. public static void main(String args[]) {
  240. /* Set the Nimbus look and feel */
  241. //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  242. /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  243. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  244. */
  245. try {
  246. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  247. if ("Nimbus".equals(info.getName())) {
  248. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  249. break;
  250. }
  251. }
  252. } catch (ClassNotFoundException ex) {
  253. java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  254. } catch (InstantiationException ex) {
  255. java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  256. } catch (IllegalAccessException ex) {
  257. java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  258. } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  259. java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  260. }
  261. //</editor-fold>
  262. //</editor-fold>
  263. /* Create and display the form */
  264. java.awt.EventQueue.invokeLater(new Runnable() {
  265. public void run() {
  266. new gui().setVisible(true);
  267. }
  268. });
  269. }
  270. // Variables declaration - do not modify//GEN-BEGIN:variables
  271. private javax.swing.JFileChooser FileChooser;
  272. private javax.swing.JDialog FileDialog;
  273. private javax.swing.JPanel FileDialogP1;
  274. private javax.swing.JButton btnOpen;
  275. private javax.swing.JButton btnSave;
  276. private javax.swing.JButton btnUndo;
  277. private view.ContentTable contentTable1;
  278. private javax.swing.JMenuBar jMenuBar1;
  279. private javax.swing.JPopupMenu jPopupMenu1;
  280. private javax.swing.JToolBar jToolBar1;
  281. private javax.swing.JMenu jmEdit;
  282. private javax.swing.JMenu jmFile;
  283. private javax.swing.JMenu jmOpenPU;
  284. private javax.swing.JLabel lblFilePath;
  285. private javax.swing.JMenuItem miNewFile;
  286. private javax.swing.JMenuItem miOpen;
  287. private javax.swing.JMenuItem miOpen_popup;
  288. private javax.swing.JMenuItem miSave;
  289. private javax.swing.JMenuItem miSave_popup;
  290. // End of variables declaration//GEN-END:variables
  291. }