From a70fc72c759db67b3be9319e812dfffeb2d68a50 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 21 Jul 2015 15:30:59 +0200 Subject: [PATCH] =?utf8?q?Added=20stuff=20for=20Swing=20client=20Signed-of?= =?utf8?q?f-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../client/gui/AddressbookFrame.form | 102 +++++++++------- .../client/gui/AddressbookFrame.java | 109 +++++++++++------- .../addressbook/client/gui/Bundle.properties | 13 ++- 3 files changed, 138 insertions(+), 86 deletions(-) diff --git a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.form b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.form index 7c1b6888..0fc26727 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.form +++ b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.form @@ -2,9 +2,32 @@
- + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -13,36 +36,61 @@ - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -52,7 +100,7 @@ - + @@ -71,43 +119,13 @@ - + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java index 6b0e8354..bf3e8e91 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java +++ b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java @@ -56,6 +56,9 @@ public class AddressbookFrame extends javax.swing.JFrame implements ClientFrame // Init components initComponents(); + // Has the user entered own data? + //if (client.) + // Set client here this.client = client; } @@ -84,66 +87,92 @@ public class AddressbookFrame extends javax.swing.JFrame implements ClientFrame // //GEN-BEGIN:initComponents private void initComponents() { - statusPane = new javax.swing.JScrollPane(); - statusText = new javax.swing.JTextPane(); - mainMenu = new javax.swing.JMenuBar(); - jMenu1 = new javax.swing.JMenu(); - jMenuItem1 = new javax.swing.JMenuItem(); - jMenu2 = new javax.swing.JMenu(); + enterDownDataDialog = new javax.swing.JDialog(); + menuBar = new javax.swing.JMenuBar(); + mainMenu = new javax.swing.JMenu(); + exitProgram = new javax.swing.JMenuItem(); + addressbookMenu = new javax.swing.JMenu(); + addOwnData = new javax.swing.JMenuItem(); + + enterDownDataDialog.setAlwaysOnTop(true); + + javax.swing.GroupLayout enterDownDataDialogLayout = new javax.swing.GroupLayout(enterDownDataDialog.getContentPane()); + enterDownDataDialog.getContentPane().setLayout(enterDownDataDialogLayout); + enterDownDataDialogLayout.setHorizontalGroup( + enterDownDataDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 400, Short.MAX_VALUE) + ); + enterDownDataDialogLayout.setVerticalGroup( + enterDownDataDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 300, Short.MAX_VALUE) + ); + + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/mxchange/addressbook/client/gui/Bundle"); // NOI18N + enterDownDataDialog.getAccessibleContext().setAccessibleName(bundle.getString("AddressbookFrame.enterDownDataDialog.AccessibleContext.accessibleName")); // NOI18N - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setTitle(AddressbookApplication.printableTitle()); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setName("main"); // NOI18N - statusText.setBackground(new java.awt.Color(240, 240, 240)); - java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/mxchange/addressbook/client/gui/Bundle"); // NOI18N - statusText.setText(bundle.getString("AddressbookFrame.status.text")); // NOI18N - statusText.setName("status"); // NOI18N - statusPane.setViewportView(statusText); - statusText.getAccessibleContext().setAccessibleName(bundle.getString("AddressbookFrame.status.AccessibleContext.accessibleName")); // NOI18N - - jMenu1.setText(bundle.getString("AddressbookFrame.text")); // NOI18N - jMenu1.setFocusable(false); - jMenu1.setName(""); // NOI18N - - jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK)); - jMenuItem1.setText(bundle.getString("AddressbookFrame.jMenuItem1.text")); // NOI18N - jMenuItem1.setToolTipText(bundle.getString("AddressbookFrame.jMenuItem1.toolTipText")); // NOI18N - jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + mainMenu.setText(bundle.getString("AddressbookFrame.text")); // NOI18N + mainMenu.setFocusable(false); + mainMenu.setName(""); // NOI18N + + exitProgram.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK)); + exitProgram.setText(bundle.getString("AddressbookFrame.exitProgram.text")); // NOI18N + exitProgram.setToolTipText(bundle.getString("AddressbookFrame.exitProgram.toolTipText")); // NOI18N + exitProgram.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - jMenuItem1ActionPerformed(evt); + exitProgramActionPerformed(evt); } }); - jMenu1.add(jMenuItem1); + mainMenu.add(exitProgram); - mainMenu.add(jMenu1); + menuBar.add(mainMenu); - jMenu2.setText(bundle.getString("AddressbookFrame.jMenu2.text")); // NOI18N - mainMenu.add(jMenu2); + addressbookMenu.setText(bundle.getString("AddressbookFrame.addressbookMenu.text")); // NOI18N - setJMenuBar(mainMenu); + addOwnData.setText(bundle.getString("AddressbookFrame.addOwn.text")); // NOI18N + addOwnData.setToolTipText(bundle.getString("AddressbookFrame.addOwnData.toolTipText")); // NOI18N + addOwnData.setEnabled(false); + addOwnData.setName("addOwn"); // NOI18N + addOwnData.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + addOwnDataActionPerformed(evt); + } + }); + addressbookMenu.add(addOwnData); + addOwnData.getAccessibleContext().setAccessibleName(bundle.getString("AddressbookFrame.addOwnData.AccessibleContext.accessibleName")); // NOI18N + addOwnData.getAccessibleContext().setAccessibleDescription(bundle.getString("AddressbookFrame.addOwnData.AccessibleContext.accessibleDescription")); // NOI18N + + menuBar.add(addressbookMenu); + + setJMenuBar(menuBar); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(statusPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) + .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addGap(0, 257, Short.MAX_VALUE) - .addComponent(statusPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(0, 279, Short.MAX_VALUE) ); pack(); }// //GEN-END:initComponents - private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + private void exitProgramActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitProgramActionPerformed // Close application instance this.getClient().getApplication().doShutdown(); - }//GEN-LAST:event_jMenuItem1ActionPerformed + }//GEN-LAST:event_exitProgramActionPerformed + + private void addOwnDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addOwnDataActionPerformed + // Asks the user to enter own data + this.getClient().getContactManager().doEnterOwnData(); + }//GEN-LAST:event_addOwnDataActionPerformed /** * Initializes the frame @@ -201,11 +230,11 @@ public class AddressbookFrame extends javax.swing.JFrame implements ClientFrame } // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JMenu jMenu1; - private javax.swing.JMenu jMenu2; - private javax.swing.JMenuItem jMenuItem1; - private javax.swing.JMenuBar mainMenu; - private javax.swing.JScrollPane statusPane; - private javax.swing.JTextPane statusText; + private javax.swing.JMenuItem addOwnData; + private javax.swing.JMenu addressbookMenu; + private javax.swing.JDialog enterDownDataDialog; + private javax.swing.JMenuItem exitProgram; + private javax.swing.JMenu mainMenu; + private javax.swing.JMenuBar menuBar; // End of variables declaration//GEN-END:variables } diff --git a/Addressbook/src/org/mxchange/addressbook/client/gui/Bundle.properties b/Addressbook/src/org/mxchange/addressbook/client/gui/Bundle.properties index f4991446..8142150e 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/gui/Bundle.properties +++ b/Addressbook/src/org/mxchange/addressbook/client/gui/Bundle.properties @@ -1,6 +1,11 @@ -AddressbookFrame.jMenu2.text=Edit -AddressbookFrame.text=File -AddressbookFrame.jMenuItem1.text=Exit program -AddressbookFrame.jMenuItem1.toolTipText=Exits the program cleanly. +AddressbookFrame.text=Main AddressbookFrame.status.AccessibleContext.accessibleName= AddressbookFrame.status.text=Welcome ... +AddressbookFrame.addressbookMenu.text=Addressbook +AddressbookFrame.exitProgram.toolTipText=Exits the program cleanly. +AddressbookFrame.exitProgram.text=Exit program +AddressbookFrame.addOwn.text=Add own address +AddressbookFrame.addOwnData.AccessibleContext.accessibleName=addOwn +AddressbookFrame.addOwnData.AccessibleContext.accessibleDescription= +AddressbookFrame.addOwnData.toolTipText=Allows the user to add own address data +AddressbookFrame.enterDownDataDialog.AccessibleContext.accessibleName=enterOwnDataWarning -- 2.39.5