2 * Copyright (C) 2015 Roland Haeder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.addressbook.client.gui;
19 import java.awt.BorderLayout;
20 import java.awt.GridLayout;
21 import java.awt.event.ActionEvent;
22 import java.awt.event.ActionListener;
23 import java.awt.event.MouseAdapter;
24 import java.awt.event.MouseEvent;
25 import java.awt.event.WindowAdapter;
26 import java.awt.event.WindowEvent;
27 import java.io.IOException;
28 import java.lang.reflect.InvocationTargetException;
29 import java.sql.SQLException;
30 import java.text.MessageFormat;
31 import javax.swing.BorderFactory;
32 import javax.swing.BoxLayout;
33 import javax.swing.DefaultComboBoxModel;
34 import javax.swing.JButton;
35 import javax.swing.JComboBox;
36 import javax.swing.JDialog;
37 import javax.swing.JFormattedTextField;
38 import javax.swing.JFrame;
39 import javax.swing.JLabel;
40 import javax.swing.JMenu;
41 import javax.swing.JMenuBar;
42 import javax.swing.JMenuItem;
43 import javax.swing.JPanel;
44 import javax.swing.JScrollPane;
45 import javax.swing.JTable;
46 import javax.swing.JTextArea;
47 import javax.swing.JTextField;
48 import javax.swing.border.TitledBorder;
49 import javax.swing.table.TableModel;
50 import org.mxchange.addressbook.BaseAddressbookSystem;
51 import org.mxchange.addressbook.application.AddressbookApplication;
52 import org.mxchange.addressbook.facade.contact.ContactFacade;
53 import org.mxchange.jcontacts.contact.Contact;
54 import org.mxchange.jcontacts.contact.gender.Gender;
55 import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
56 import org.mxchange.jcore.application.Application;
57 import org.mxchange.jcore.client.Client;
58 import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
59 import org.mxchange.jcore.facade.Facade;
60 import org.mxchange.jcoreswing.client.gui.ClientFrame;
61 import org.mxchange.jcoreswing.model.swing.contact.ContactTableModel;
64 * A Swing frame for addressbook.
66 * @author Roland Haeder
68 public class AddressbookFrame extends BaseAddressbookSystem implements ClientFrame {
73 private static ClientFrame self;
76 * Singelton getter for this frame instance.
78 * @param client Client instance
79 * @return Returns a singelton instance of this frame
81 public static final ClientFrame getSelfInstance (final Client client) {
83 if (!(self instanceof ClientFrame)) {
84 // Create new instance
85 self = new AddressbookFrame(client);
93 * Dialog box "add contact"
95 private JDialog addContact;
98 * Frame instance for "add own data"
100 private JMenuItem addOwnItem;
103 * Instance to table model
105 private TableModel dataModel;
110 private JTable dataTable;
113 * Frame instance for "edit own data"
115 private JMenuItem editOwnItem;
120 private final JFrame frame;
123 * Whether this frame has been initialized
125 private boolean initialized;
128 * Status label needs to be updated
130 private JLabel statusLabel;
133 * Creates an instance of this frame with a client instance
137 private AddressbookFrame (final Client client) {
139 this.getLogger().logTrace(MessageFormat.format("client={0}: CALLED!", client)); //NOI18N
141 // Set frame instance
142 this.frame = new JFrame();
143 this.frame.setTitle(this.generateFrameTitle("main")); //NOI18N
146 this.setClient(client);
149 this.getLogger().logTrace("EXIT!"); //NOI18N
153 public Contact doEnterOwnData () {
155 this.getLogger().logTrace("CALLED!"); //NOI18N
157 // Is the "add contact" window visible?
158 if (this.addContact.isVisible()) {
159 // Something bad happened
160 throw new IllegalStateException("Window addContact is already visible."); //NOI18N
163 // Disable main window
164 this.frame.setEnabled(false);
166 // Make other window visible
167 this.addContact.setVisible(true);
170 this.getLogger().logTrace("Returning null : EXIT!"); //NOI18N
172 // Return value is not supported
177 * Shutdown this frame
180 public void doShutdown () {
182 this.getLogger().logTrace("CALLED!"); //NOI18N
184 // First only show shutdown status
185 this.updateStatus("shutdown"); //NOI18N
188 this.getLogger().logTrace("EXIT!"); //NOI18N
192 * Enables main window (frame)
195 public void enableMainWindow () {
197 this.getLogger().logTrace("CALLED!"); //NOI18N
200 this.frame.setEnabled(true);
202 // Request focus for this window
203 this.frame.requestFocus();
206 this.getLogger().logTrace("EXIT!"); //NOI18N
210 public Application getApplication () {
211 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
215 public Client getClient () {
216 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
220 public Facade getFacade () {
221 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
225 public String getMessageStringFromKey (String key) {
226 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
230 * Setups the frame, do not set isInitialized here
232 * @param client Client instance
235 public void setupFrame (final Client client) throws IOException {
237 this.getLogger().logTrace(MessageFormat.format("client={0}: CALLED!", client)); //NOI18N
239 // Has the user entered own data?
240 if (((ContactFacade) this.getClient().getFacade()).isOwnContactAdded()) {
242 this.getLogger().logDebug("Disabling menus: isOwnContactAdded()=false"); //NOI18N
244 // Not entered yet, so disable "add" menu
245 this.addOwnItem.setEnabled(false);
248 this.editOwnItem.setEnabled(false);
251 // Make the frame visible
252 this.frame.setVisible(true);
255 this.updateStatus("done"); //NOI18N
258 this.getLogger().logTrace("EXIT!"); //NOI18N
262 * Initalizes this frame. Having initComponents() exposed (publicly
263 * accessible) means that any other object can initialize components which
266 * @throws org.mxchange.jcore.exceptions.FrameAlreadyInitializedException If
267 * this method has been called twice
270 public void init () throws FrameAlreadyInitializedException {
272 this.getLogger().logTrace("CALLED!"); //NOI18N
274 // Has this frame been initialized?
275 if (this.isInitialized()) {
277 throw new FrameAlreadyInitializedException();
281 this.initComponents();
284 this.initialized = true;
287 this.getLogger().logTrace("EXIT!"); //NOI18N
291 * Returns field isInitialized. This flag indicates whether this frame has
292 * been initialized or not.
294 * @return Field isInitialized
297 public final boolean isInitialized () {
298 return this.initialized;
302 public void logException (final Throwable exception) {
303 // Yes, I know, ugly.
304 super.logException(exception);
308 * Shuts down the application.
311 public void shutdownApplication () {
313 this.getLogger().logTrace("CALLED!"); //NOI18N
315 // To do this, the frame must be initialized
316 if (!this.isInitialized()) {
317 // Not initalized, so bad call
318 this.getLogger().logFatal("Bad call of shutdownApplication(). Please report this."); //NOI18N
322 // Call shutdown method
324 this.getClient().getApplication().doShutdown();
325 } catch (final SQLException | IOException ex) {
327 this.abortProgramWithException(ex);
331 this.getLogger().logTrace("EXIT!"); //NOI18N
335 * Adds a new menu item with given key to menu instance
337 * @param menu Menu instance to add item to
338 * @param key Message key part
339 * @param listener Listener instance
341 private void addMenuItem (final JMenu menu, final String key, final ActionListener listener) {
343 this.getLogger().logTrace(MessageFormat.format("menu={0},key={1},listener={2} - CALLED!", menu, key, listener)); //NOI18N
346 JMenuItem item = this.initMenuItemWithTooltip(key);
349 item.addActionListener(listener);
355 this.getLogger().logTrace("EXIT!"); //NOI18N
359 * Adds a JTextField with label and tool tip to given panel
361 * @param panel Panel instance to add text field
362 * @param key Part of message key from resource bundle
363 * @param fieldLength Length of text field
365 private void addTextFieldWithLabelToPanel (final JPanel panel, final String key, final int fieldLength) {
367 this.getLogger().logTrace(MessageFormat.format("panel={0},key={1},fieldLength={2} - CALLED!", panel, key, fieldLength)); //NOI18N
369 // Init label for given key
370 JLabel label = new JLabel(this.getBundle().getString(String.format("AddressbookFrame.%s.text", key))); //NOI18N
372 // And input box wih tool tip
373 JTextField field = new JTextField(fieldLength);
374 field.setToolTipText(this.getBundle().getString(String.format("AddressbookFrame.%s.toolTipText", key))); //NOI18N
381 this.getLogger().logTrace("EXIT!"); //NOI18N
385 * Generates a title for borders
387 * @param key Key part to look for
388 * @return Human-readable title
390 private String generateBorderTitle (final String key) {
391 // Call bundle instance
392 return this.getBundle().getString(String.format("AddressbookFrame.border.%s.title.text", key)); //NOI18N
396 * Generates a title for all frames based on given sub title key. If null is
397 * given, the sub title is not generated.
399 * @param subKey Key for sub title resource
400 * @return A full application title
402 private String generateFrameTitle (final String subKey) {
404 String title = AddressbookApplication.printableTitle();
407 if (subKey != null) {
409 title = String.format("%s - %s", title, this.getBundle().getString(String.format("AddressbookFrame.%s.title.text", subKey))); //NOI18N
417 * Initializes "add" and "cancel" buttons
419 private void initAddCancelButtons () {
421 this.getLogger().logTrace("CALLED!"); //NOI18N
424 JPanel panel = new JPanel();
425 panel.setLayout(new GridLayout(1, 2, 10, 10));
427 // Generate "add" button
428 JButton addButton = new JButton(this.getBundle().getString("AddressbookFrame.button.addAddress.text"));
431 addButton.addActionListener(new AddActionListener(this.addContact, this));
433 // Add button to panel
434 panel.add(addButton);
436 // Generate "cancel" button
437 JButton cancelButton = new JButton(this.getBundle().getString("AddressbookFrame.button.cancel.text"));
440 cancelButton.addActionListener(new CancelActionListener(this.addContact, this));
442 // Add button to panel
443 panel.add(cancelButton);
445 // Add panel to main panel
446 this.addContact.add(panel);
449 this.getLogger().logTrace("EXIT!"); //NOI18N
453 * Initializes "add contact" dialog
455 private void initAddContactDialog () {
457 this.getLogger().logTrace("CALLED!"); //NOI18N
459 // Instance dialog and set title
460 this.addContact = new JDialog();
461 this.addContact.setTitle(this.generateFrameTitle("dialog.addContact")); //NOI18N
464 this.addContact.setLayout(new GridLayout(0, 1, 2, 2));
466 // Only hide it on close and make it appear in middle of screen
467 this.addContact.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
468 this.addContact.setLocationRelativeTo(this.frame);
470 // Set always on top and auto-focus
471 this.addContact.setAlwaysOnTop(true);
472 this.addContact.setAutoRequestFocus(true);
475 this.addContact.setSize(500, 500);
477 // And it is not resizeable
478 this.addContact.setResizable(false);
481 * Add listener which asks for confirmation, if data has been entered
482 * but not saved yet. The user may appriciate this ... ;-)
486 this.addContact.addWindowListener(new WindowAdapter() {
488 * Invoked when a window has been closed.
491 public void windowClosed (final WindowEvent e) {
492 // Enable main window again
493 AddressbookFrame.getSelfInstance(null).enableMainWindow();
497 * Invoked when a window is in the process of being closed. The
498 * close operation can be overridden at this point.
501 public void windowClosing (final WindowEvent e) {
502 e.getWindow().dispose();
508 initNameDataPanel(this.addContact);
510 // 2) "address" panel
511 initAddressDataPanel(this.addContact);
514 initOtherDataPanel(this.addContact);
516 // 4) "Add" and "Cancel" buttons, combined they are unique for this dialog
517 initAddCancelButtons();
519 // x)Only for developing:
522 */ this.addContact.setVisible(true);
525 this.getLogger().logTrace("EXIT!"); //NOI18N
529 * Initializes address panel
531 * @param dialog A JDialog instance to this components to
533 private void initAddressDataPanel (final JDialog dialog) {
535 this.getLogger().logTrace("CALLED!"); //NOI18N
537 // Panel "address" input boxes
538 JPanel addressPanel = new JPanel();
539 addressPanel.setLayout(new GridLayout(0, 4, 3, 3));
541 // Set border to titled version
542 addressPanel.setBorder(new TitledBorder(this.generateBorderTitle("address"))); //NOI18N
544 // Add text field for street
545 this.addTextFieldWithLabelToPanel(addressPanel, "street", 20); //NOI18N
548 JLabel numberLabel = new JLabel(this.getBundle().getString("AddressbookFrame.number.text"));
550 // And text field, but only accept numbers
551 JFormattedTextField number = new JFormattedTextField();
552 number.setToolTipText(this.getBundle().getString("AddressbookFrame.number.toolTipText"));
554 // Add both to street panel
555 addressPanel.add(numberLabel);
556 addressPanel.add(number);
558 // Label for ZIP code, again numbers only
559 JLabel zipLabel = new JLabel(this.getBundle().getString("AddressbookFrame.zip.text"));
561 // Init text field with label
562 JFormattedTextField zip = new JFormattedTextField();
563 zip.setToolTipText(this.getBundle().getString("AddressbookFrame.zip.toolTipText"));
565 // Add both to street panel
566 addressPanel.add(zipLabel);
567 addressPanel.add(zip);
569 // Add text field for city name
570 this.addTextFieldWithLabelToPanel(addressPanel, "city", 20); //NOI18N
572 // Add panel to dialog
573 dialog.add(addressPanel);
576 this.getLogger().logTrace("EXIT!"); //NOI18N
580 * Initialize components
582 private void initComponents () {
584 this.getLogger().logTrace("CALLED!"); //NOI18N
586 // Set default close operation
587 this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
589 // Register shutdown listener
590 this.frame.addWindowListener(new WindowAdapter() {
592 * Invoked when a window has been closed.
595 public void windowClosed (final WindowEvent e) {
596 // Shutdown application cleanly
597 self.shutdownApplication();
601 * Invoked when a window is in the process of being closed. The
602 * close operation can be overridden at this point.
605 public void windowClosing (final WindowEvent e) {
606 // Also shutdown cleanly here
607 self.shutdownApplication();
611 // Setup layout manager
612 this.frame.setLayout(new BorderLayout(2, 2));
615 this.frame.setSize(700, 400);
617 // Center window in middle of screen, instead of top-left corner
618 this.frame.setLocationRelativeTo(null);
621 this.initMenuSystem();
627 this.initStatusPanel();
629 // Init other windows
630 this.initOtherDialogs();
633 this.getLogger().logTrace("EXIT!"); //NOI18N
637 * Initializes a menu item instance with tool tip
639 * @param key Message key part
640 * @return A finished JMenuItem instance
642 private JMenuItem initMenuItemWithTooltip (final String key) {
644 this.getLogger().logTrace(MessageFormat.format("key={0} - CALLED!", key)); //NOI18N
646 JMenuItem item = new JMenuItem(this.getBundle().getString(String.format("AddressbookFrame.menuItem.%s.text", key))); //NOI18N
647 item.setToolTipText(this.getBundle().getString(String.format("AddressbookFrame.menuItem.%s.toolTipText", key))); //NOI18N
650 this.getLogger().logTrace(MessageFormat.format("item={0} - EXIT!", item)); //NOI18N
657 * Initializes the menu system
659 private void initMenuSystem () {
661 this.getLogger().logTrace("CALLED!"); //NOI18N
663 // Init menu bar, menu and item instances
664 JMenuBar menuBar = new JMenuBar();
670 menu = new JMenu(this.getBundle().getString("AddressbookFrame.menu.file.text"));
673 // 1.x) Exit program (should be last)
674 this.addMenuItem(menu, "exitProgram", new ActionListener() { //NOI18N
676 * If the user has performed this action
678 * @param e An instance of an ActionEvent class
681 public void actionPerformed (final ActionEvent e) {
682 self.shutdownApplication();
686 // Add menu -> menu bar
690 // 2) Addressbook menu
691 menu = new JMenu(this.getBundle().getString("AddressbookFrame.menu.addressbook.text"));
694 this.addOwnItem = this.initMenuItemWithTooltip("addOwnData"); //NOI18N
696 // Add listener to exit menu
697 this.addOwnItem.addActionListener(new ActionListener() {
699 * If the user has performed this action
701 * @param e An instance of an ActionEvent class
704 public void actionPerformed (final ActionEvent e) {
706 ((ContactFacade) self.getClient().getFacade()).doEnterOwnData();
707 } catch (final ContactAlreadyAddedException ex) {
708 // Already added, log away
709 // TODO maybe output message here?
710 self.logException(ex);
711 } catch (final IOException ex) {
712 // Somethind bad happened here
713 // TODO Output error message here?
719 menu.add(this.addOwnItem);
721 // 2.2) Edit own data
722 this.editOwnItem = this.initMenuItemWithTooltip("editOwnData"); //NOI18N
724 // Add listener to exit menu
725 this.editOwnItem.addActionListener(new ActionListener() {
727 * If the user has performed this action
729 * @param e An instance of an ActionEvent class
732 public void actionPerformed (final ActionEvent e) {
734 ((ContactFacade) self.getClient().getFacade()).doChangeOwnData();
735 } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
736 self.logException(ex);
742 menu.add(this.editOwnItem);
745 // 1) Add new contact
746 this.addMenuItem(menu, "addNewContact", new ActionListener() { //NOI18N
748 * If the user has performed this action
750 * @param e An instance of an ActionEvent class
753 public void actionPerformed (final ActionEvent e) {
754 ((ContactFacade) self.getClient().getFacade()).doAddOtherAddress();
758 // Add menu -> menu bar
761 // Add menu bar -> frame
762 this.frame.add(menuBar, BorderLayout.NORTH);
765 this.getLogger().logTrace("EXIT!"); //NOI18N
769 * Initializes name panel
771 * @param dialog A JDialog instance to this components to
773 private void initNameDataPanel (final JDialog dialog) {
775 this.getLogger().logTrace(MessageFormat.format("dialog={0} - CALLED!", dialog)); //NOI18N
777 // Panel "name" input boxes
778 JPanel namePanel = new JPanel();
779 namePanel.setLayout(new GridLayout(0, 2, 3, 3));
781 // Set border to titled version
782 namePanel.setBorder(new TitledBorder(this.generateBorderTitle("name"))); //NOI18N
785 JLabel gLabel = new JLabel(this.getBundle().getString("AddressbookFrame.gender.text"));
788 Gender[] genders = Gender.values();
790 // Init gender combo box with tool tip
791 JComboBox<Gender> gender = new JComboBox<>(new DefaultComboBoxModel<>(genders));
792 gender.setToolTipText(this.getBundle().getString("AddressbookFrame.gender.toolTipText"));
794 // Add both to gender panel
795 namePanel.add(gLabel);
796 namePanel.add(gender);
798 // Add text field for surname
799 this.addTextFieldWithLabelToPanel(namePanel, "surname", 20); //NOI18N
801 // Add text field for family name
802 this.addTextFieldWithLabelToPanel(namePanel, "familyName", 20); //NOI18N
804 // Finally add panel to dialog
805 dialog.add(namePanel);
808 this.getLogger().logTrace("EXIT!"); //NOI18N
812 * Initializes "other" data panel
814 * @param dialog A JDialog instance to this components to TODO Fill this
817 private void initOtherDataPanel (final JDialog dialog) {
819 this.getLogger().logTrace(MessageFormat.format("dialog={0} - CALLED!", dialog)); //NOI18N
821 // Panel "other" input boxes
822 JPanel otherPanel = new JPanel();
823 otherPanel.setLayout(new GridLayout(0, 2, 3, 3));
824 otherPanel.setBorder(new TitledBorder(this.generateBorderTitle("other"))); //NOI18N
826 // Add text field for email address
827 this.addTextFieldWithLabelToPanel(otherPanel, "emailAddress", 20); //NOI18N
829 // Add text field for phone number
830 this.addTextFieldWithLabelToPanel(otherPanel, "phoneNumber", 20); //NOI18N
832 // Add text field for cellphone number
833 this.addTextFieldWithLabelToPanel(otherPanel, "cellphoneNumber", 20); //NOI18N
835 // Add text field for fax number
836 this.addTextFieldWithLabelToPanel(otherPanel, "faxNumber", 20); //NOI18N
839 JLabel commentLabel = new JLabel(this.getBundle().getString("AddressbookFrame.comment.text"));
841 // Init text area with tool tip
842 JTextArea comment = new JTextArea(5, 20);
843 comment.setToolTipText(this.getBundle().getString("AddressbookFrame.comment.toolTipText"));
846 otherPanel.add(commentLabel);
847 otherPanel.add(comment);
849 // Finally add panel to dialog
850 dialog.add(otherPanel);
853 this.getLogger().logTrace("EXIT!"); //NOI18N
857 * Initialize other dialogs (e.g. "Add contact")
859 private void initOtherDialogs () {
861 this.getLogger().logTrace("CALLED!"); //NOI18N
863 // Init other windows:
865 initAddContactDialog();
868 this.getLogger().logTrace("EXIT!"); //NOI18N
872 * Initializes status panel
874 private void initStatusPanel () {
876 this.getLogger().logTrace("CALLED!"); //NOI18N
878 // Init status label (which needs to be updated
879 this.statusLabel = new JLabel();
880 this.updateStatus("initializing"); //NOI18N
882 // Init status bar in south
883 JPanel panel = new JPanel();
884 panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
885 panel.add(this.statusLabel);
886 panel.setBorder(BorderFactory.createEtchedBorder());
888 // Add panel to frame
889 this.frame.add(panel, BorderLayout.SOUTH);
892 this.getLogger().logTrace("EXIT!"); //NOI18N
896 * Initializes the table which will show all contacts
898 private void initTable () {
900 this.getLogger().logTrace("CALLED!"); //NOI18N
902 // Instance table model
903 this.dataModel = new ContactTableModel(this.getClient().getFacade());
906 this.dataTable = new JTable(this.dataModel);
908 // Add mouse listener
909 this.dataTable.addMouseListener(new MouseAdapter() {
911 * If the user peformed a click on a cell
913 * @param e Mouse event instance
916 public void mouseClicked (final MouseEvent e) {
917 throw new UnsupportedOperationException("Unfinished."); //NOI18N
921 // Instance scroll pane
922 JScrollPane scroller = new JScrollPane();
924 // Add table to scroll pane
925 scroller.setViewportView(this.dataTable);
926 scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
927 scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
930 this.frame.add(scroller, BorderLayout.CENTER);
933 this.getLogger().logTrace("EXIT!"); //NOI18N
937 * Updates status to given type
939 * @param type Status type
941 private void updateStatus (final String type) {
943 this.getLogger().logTrace(MessageFormat.format("type={0} - CALLED!", type)); //NOI18N
945 // Set status message
946 this.statusLabel.setText(this.getBundle().getString(String.format("AddressbookFrame.statusLabel.%s.text", type))); //NOI18N
949 this.getLogger().logTrace("EXIT!"); //NOI18N
953 * Class for "add address" button
955 private static class AddActionListener extends BaseAddressbookSystem implements ActionListener {
960 private final JDialog dialog;
963 * Frame (not JFrame) instance
965 private final ClientFrame frame;
968 * Constructor for action listener
970 * @param dialog Dialog instance to call back
971 * @param frame Frame instance (not JFrame)
973 protected AddActionListener (final JDialog dialog, final ClientFrame frame) {
974 // Set dialog and frame here
975 this.dialog = dialog;
980 * If the action has been performed
982 * @param e The performed action event
985 public void actionPerformed (final ActionEvent e) {
986 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
991 * Class for "cancel address" button
993 private static class CancelActionListener extends BaseAddressbookSystem implements ActionListener {
998 private final JDialog dialog;
1001 * Frame (not JFrame) instance
1003 private final ClientFrame frame;
1006 * Constructor for action listener
1008 * @param dialog Dialog instance to call back
1009 * @param frame Frame instance (not JFrame)
1011 protected CancelActionListener (final JDialog dialog, final ClientFrame frame) {
1012 // Set dialog and frame here
1013 this.dialog = dialog;
1018 * If the action has been performed
1020 * @param e The performed action event
1023 public void actionPerformed (final ActionEvent e) {
1024 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.