Browse Source

2 - The real one

master
jechowma68968 5 years ago
parent
commit
adc65f3636

+ 0
- 120
src/Model/AdressverwaltungModel.java View File

@@ -1,120 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package adressverwaltung.model;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
*
* @author le
*/
public class AdressverwaltungModel extends AbstractTableModel
{
private ArrayList<ArrayList<String>> daten;
private ArrayList<String> adressEintraegeDaten;
private ArrayList<String> adressEintraegeNamen;
public AdressverwaltungModel()
{
adressEintraegeDaten = new ArrayList<>();
adressEintraegeNamen = new ArrayList<>();
daten = new ArrayList<>();
adressEintraegeNamen.add("Name");
adressEintraegeDaten.add("Lehner");
adressEintraegeNamen.add("Telefon");
adressEintraegeDaten.add("122345");
daten.add(adressEintraegeDaten);
}

@Override
public int getRowCount()
{
return daten.size();
}

@Override
public int getColumnCount()
{
return adressEintraegeDaten.size();
}

@Override
public Object getValueAt(int row, int col)
{
return daten.get(row).get(col);
}
@Override
public void setValueAt(Object value, int row, int col)
{
daten.get(row).set(col, (String)value);
}
@Override
public boolean isCellEditable(int row, int col)
{
return true;
}
@Override
public String getColumnName(int col)
{
return adressEintraegeNamen.get(col);
}
public void eintragHinzufuegen()
{
adressEintraegeDaten = new ArrayList<>();
adressEintraegeNamen.forEach(s -> adressEintraegeDaten.add(s));
daten.add(adressEintraegeDaten);
this.fireTableDataChanged();
}
public void eintragLoeschen(int row)
{
daten.remove(row);
this.fireTableDataChanged();
}
public void spalteHinzufuegen(String name)
{
adressEintraegeNamen.add(name);
}
public void datenSpeichern(File datei) throws FileNotFoundException, IOException
{
FileOutputStream fos = new FileOutputStream(datei);
BufferedOutputStream bos = new BufferedOutputStream(fos);
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(daten);
oos.writeObject(adressEintraegeNamen);
oos.flush();
oos.close();
}
public void datenLesen(File datei) throws FileNotFoundException, IOException, ClassNotFoundException
{
FileInputStream fis = new FileInputStream(datei);
BufferedInputStream bis = new BufferedInputStream(fis);
ObjectInputStream ois = new ObjectInputStream(bis);
daten = (ArrayList<ArrayList<String>>)ois.readObject();
adressEintraegeNamen = (ArrayList<String>)ois.readObject();
adressEintraegeDaten = daten.get(daten.size()-1);
ois.close();
this.fireTableDataChanged();
}
}

+ 19
- 2
src/controller/Controller.java View File

@@ -6,10 +6,13 @@

package controller;

import adressverwaltung.model.AdressverwaltungModel;
import controller.commands.CommandAddRow;
import controller.commands.CommandDeleteRow;
import controller.commands.CommandOpen;
import controller.commands.CommandSave;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import model.AdressverwaltungModel;
import prfourgui.View.AdressbuchView;

/**
@@ -32,16 +35,30 @@ public class Controller implements ActionListener
*/
public void registerEvents(){
view.getMnuOpen().addActionListener(this);
view.getToolAdd().addActionListener(this);
view.getToolRemove().addActionListener(this);
view.getMnuSave().addActionListener(this);
view.getAdressTable2().getDeleteItem().addActionListener(this);
view.getToolUndo().addActionListener(this);
}
public void registerCommands(){
invoker.addCommand(view.getMnuOpen(), new CommandOpen(view, model));
invoker.addCommand(view.getToolAdd(), new CommandAddRow(view, model));
invoker.addCommand(view.getToolRemove(), new CommandDeleteRow(view, model));
invoker.addCommand(view.getMnuSave(), new CommandSave(view, model));
invoker.addCommand(view.getAdressTable2().getDeleteItem(), new CommandDeleteRow(view, model));
}
@Override
public void actionPerformed(ActionEvent ae)
{
Object key = ae.getSource();
invoker.executeCommand(key);
if (key == view.getToolUndo()){
invoker.undo(key);
}
else{
invoker.executeCommand(key);
}
}
}

+ 0
- 45
src/controller/ControllerOeffnen.java View File

@@ -1,45 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JFileChooser;
import prfourgui.View.AdressbuchView;

/**
*
* @author baumannan68085
*/
public class ControllerOeffnen implements ActionListener
{
private AdressbuchView view;
public ControllerOeffnen(AdressbuchView view)
{
this.view = view;
}
public void registerEvents(){
view.getMnuOpen().addActionListener(this);
}

@Override
public void actionPerformed(ActionEvent ae)
{
JFileChooser fc = view.getjFileChooser1();
int wahl = fc.showOpenDialog(view);
if(wahl == JFileChooser.APPROVE_OPTION){
File datei = fc.getSelectedFile();
String dateiname = datei.getAbsolutePath();
view.getTxtStatus().setText("Dateipfad:" + dateiname);
}
}
}

+ 11
- 0
src/controller/Invoker.java View File

@@ -7,6 +7,7 @@
package controller;

import java.util.HashMap;
import java.util.Stack;

/**
*
@@ -15,10 +16,12 @@ import java.util.HashMap;
public class Invoker
{
private HashMap<Object, Interface> commands;
private Stack commandHistory;
public Invoker()
{
commands = new HashMap<>();
commandHistory = new Stack();
}
/**
@@ -31,6 +34,14 @@ public class Invoker
}
public void executeCommand(Object key){
commandHistory.push(key);
commands.get(key).execute();
}
public void undo(Object key){
if (commandHistory.isEmpty()){
return;
}
commands.get(commandHistory.pop()).undo();
}
}

+ 38
- 0
src/controller/commands/CommandAddRow.java View File

@@ -0,0 +1,38 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package controller.commands;

import model.AdressverwaltungModel;
import controller.Interface;
import prfourgui.View.AdressbuchView;

/**
*
* @author jechowma68968
*/
public class CommandAddRow implements Interface
{
private final AdressbuchView view;
private final AdressverwaltungModel model;
public CommandAddRow(AdressbuchView view, AdressverwaltungModel model)
{
this.view = view;
this.model = model;
}

@Override
public void execute()
{
model.eintragHinzufuegen();
}

@Override
public void undo()
{
}
}

+ 59
- 0
src/controller/commands/CommandDeleteRow.java View File

@@ -0,0 +1,59 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package controller.commands;

import model.AdressverwaltungModel;
import controller.Interface;
import java.util.Stack;
import javax.swing.JOptionPane;
import prfourgui.CommandDeleteRowDataContainer;
import prfourgui.View.AdressbuchView;

/**
*
* @author jechowma68968
*/
public class CommandDeleteRow implements Interface
{
private final AdressbuchView view;
private final AdressverwaltungModel model;
private final Stack<CommandDeleteRowDataContainer> deleteHistory;
public CommandDeleteRow(AdressbuchView view, AdressverwaltungModel model)
{
this.view = view;
this.model = model;
this.deleteHistory = new Stack();
}

@Override
public void execute()
{
int rowCount = view.getAdressTable2().getTblAdressbuch().getSelectedRowCount();
if (rowCount != 1){
JOptionPane.showMessageDialog(view, "Genau eine Zeile auswählen zum löschen.", "Ein Satz mit x, das war wohl nox...", JOptionPane.INFORMATION_MESSAGE);
}
else{
int row = view.getAdressTable2().getTblAdressbuch().getSelectedRow();
deleteHistory.push(new CommandDeleteRowDataContainer(model.getValueAt(row, 0).toString(), model.getValueAt(row, 1).toString()));
model.eintragLoeschen(row);
}
}

@Override
public void undo()
{
CommandDeleteRowDataContainer c = deleteHistory.pop();
model.eintragHinzufuegen();
System.out.println(c.name);
System.out.println(c.telephone);
System.out.println(model.getRowCount());
model.setValueAt(c.name, model.getRowCount()-1, 0);
model.setValueAt(c.telephone, model.getRowCount()-1, 1);
}
}

+ 4
- 1
src/controller/commands/CommandOpen.java View File

@@ -6,12 +6,13 @@

package controller.commands;

import adressverwaltung.model.AdressverwaltungModel;
import model.AdressverwaltungModel;
import controller.Interface;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.swing.JFileChooser;
import prfourgui.Constants;
import prfourgui.View.AdressbuchView;

/**
@@ -32,8 +33,10 @@ public class CommandOpen implements Interface
@Override
public void execute()
{
String default_file = model.getPref(Constants.PREF_KEY_DIR);
File datei;
JFileChooser fc = view.getjFileChooser1();
fc.setCurrentDirectory(new File(default_file));
int wahl = fc.showOpenDialog(view);
if(wahl == JFileChooser.APPROVE_OPTION){
datei = fc.getSelectedFile();

+ 61
- 0
src/controller/commands/CommandSave.java View File

@@ -0,0 +1,61 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package controller.commands;

import model.AdressverwaltungModel;
import controller.Interface;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.swing.JFileChooser;
import prfourgui.Constants;
import prfourgui.View.AdressbuchView;

/**
*
* @author jechowma68968
*/
public class CommandSave implements Interface
{
private final AdressbuchView view;
private final AdressverwaltungModel model;
public CommandSave(AdressbuchView view, AdressverwaltungModel model)
{
this.view = view;
this.model = model;
}

@Override
public void execute()
{
File datei;
JFileChooser fc = view.getjFileChooser1();
int wahl = fc.showOpenDialog(view);
if(wahl == JFileChooser.APPROVE_OPTION){
datei = fc.getSelectedFile();
String dateiname = datei.getAbsolutePath();
model.setPref(Constants.PREF_KEY_DIR, dateiname);
view.getTxtStatus().setText("Dateipfad:" + dateiname);
try{
model.datenSpeichern(datei);
}
catch(FileNotFoundException e){
System.out.println("File not Found Error");
}
catch(IOException e){
System.out.println("Reading Error");
}
}
}

@Override
public void undo()
{
}
}

+ 20
- 0
src/prfourgui/CommandDeleteRowDataContainer.java View File

@@ -0,0 +1,20 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prfourgui;
/**
*
* @author marku
*/
public class CommandDeleteRowDataContainer {
public String name;
public String telephone;
public CommandDeleteRowDataContainer(String name, String telephone){
this.name = name;
this.telephone = telephone;
}
}

+ 14
- 0
src/prfourgui/Constants.java View File

@@ -0,0 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prfourgui;
/**
*
* @author marku
*/
public class Constants{
public static final String PREF_KEY_DIR = "PREF_KEY_DIR";
}

+ 1
- 1
src/prfourgui/Start.java View File

@@ -6,7 +6,7 @@

package prfourgui;

import adressverwaltung.model.AdressverwaltungModel;
import model.AdressverwaltungModel;
import controller.Controller;
import prfourgui.View.AdressbuchView;


+ 3
- 3
src/prfourgui/View/AdressTable.form View File

@@ -2,13 +2,13 @@

<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Container class="javax.swing.JPopupMenu" name="jPopupMenu1">
<Container class="javax.swing.JPopupMenu" name="popupMenu">

<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem1">
<MenuItem class="javax.swing.JMenuItem" name="deleteItem">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/prfourgui/Icons/Delete24.gif"/>
@@ -76,7 +76,7 @@
</TableColumnModel>
</Property>
<Property name="componentPopupMenu" type="javax.swing.JPopupMenu" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="jPopupMenu1"/>
<ComponentRef name="popupMenu"/>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>

+ 38
- 34
src/prfourgui/View/AdressTable.java View File

@@ -41,45 +41,49 @@ public class AdressTable extends javax.swing.JPanel
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents()
{
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

popupMenu = new javax.swing.JPopupMenu();
deleteItem = new javax.swing.JMenuItem();
jScrollPane1 = new javax.swing.JScrollPane();
tblAdressbuch = new javax.swing.JTable();

jPopupMenu1 = new javax.swing.JPopupMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jScrollPane1 = new javax.swing.JScrollPane();
tblAdressbuch = new javax.swing.JTable();
deleteItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/Delete24.gif"))); // NOI18N
deleteItem.setText("Remove");
popupMenu.add(deleteItem);

jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/Delete24.gif"))); // NOI18N
jMenuItem1.setText("Remove");
jPopupMenu1.add(jMenuItem1);
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));

setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));
tblAdressbuch.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Name", "Telefon", "Mobil", "E-Mail"
}
));
tblAdressbuch.setComponentPopupMenu(popupMenu);
jScrollPane1.setViewportView(tblAdressbuch);

tblAdressbuch.setModel(new javax.swing.table.DefaultTableModel(
new Object [][]
{
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String []
{
"Name", "Telefon", "Mobil", "E-Mail"
}
));
tblAdressbuch.setComponentPopupMenu(jPopupMenu1);
jScrollPane1.setViewportView(tblAdressbuch);
add(jScrollPane1);
}// </editor-fold>//GEN-END:initComponents

add(jScrollPane1);
}// </editor-fold>//GEN-END:initComponents

// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem deleteItem;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JPopupMenu popupMenu;
private javax.swing.JTable tblAdressbuch;
// End of variables declaration//GEN-END:variables

// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JPopupMenu jPopupMenu1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tblAdressbuch;
// End of variables declaration//GEN-END:variables
/**
* @return the deleteItem
*/
public javax.swing.JMenuItem getDeleteItem() {
return deleteItem;
}
}

+ 1
- 0
src/prfourgui/View/AdressbuchView.form View File

@@ -109,6 +109,7 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/prfourgui/Icons/Undo24.gif"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Undo"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>

+ 102
- 90
src/prfourgui/View/AdressbuchView.java View File

@@ -12,6 +12,20 @@ package prfourgui.View;
public class AdressbuchView extends javax.swing.JFrame
{

/**
* @return the toolUndo
*/
public javax.swing.JButton getToolUndo() {
return toolUndo;
}

/**
* @param toolUndo the toolUndo to set
*/
public void setToolUndo(javax.swing.JButton toolUndo) {
this.toolUndo = toolUndo;
}

/**
* Creates new form AdressbuchView
*/
@@ -26,87 +40,85 @@ public class AdressbuchView extends javax.swing.JFrame
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents()
{
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

jFileChooser1 = new javax.swing.JFileChooser();
toolBar = new javax.swing.JToolBar();
toolAdd = new javax.swing.JButton();
toolRemove = new javax.swing.JButton();
toolUndo = new javax.swing.JButton();
adressTable2 = new prfourgui.View.AdressTable();
pnStatus = new javax.swing.JScrollPane();
txtStatus = new javax.swing.JTextArea();
mnuMain = new javax.swing.JMenuBar();
mnuDatei = new javax.swing.JMenu();
mnuOpen = new javax.swing.JMenuItem();
mnuSave = new javax.swing.JMenuItem();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

toolBar.setRollover(true);

toolAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/New24.gif"))); // NOI18N
toolAdd.setMnemonic('A');
toolAdd.setToolTipText("Add Address");
toolAdd.setFocusable(false);
toolAdd.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
toolAdd.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
toolBar.add(toolAdd);

toolRemove.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/Delete24.gif"))); // NOI18N
toolRemove.setMnemonic('R');
toolRemove.setToolTipText("Remove Address");
toolRemove.setFocusable(false);
toolRemove.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
toolRemove.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
toolBar.add(toolRemove);

toolUndo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/Undo24.gif"))); // NOI18N
toolUndo.setFocusable(false);
toolUndo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
toolUndo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
toolBar.add(toolUndo);

getContentPane().add(toolBar, java.awt.BorderLayout.NORTH);
getContentPane().add(adressTable2, java.awt.BorderLayout.CENTER);

txtStatus.setColumns(20);
txtStatus.setRows(5);
pnStatus.setViewportView(txtStatus);

getContentPane().add(pnStatus, java.awt.BorderLayout.PAGE_END);

mnuDatei.setMnemonic('D');
mnuDatei.setText("Datei");

mnuOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
mnuOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/Open24.gif"))); // NOI18N
mnuOpen.setMnemonic('O');
mnuOpen.setText("Open");
mnuOpen.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
mnuOpenActionPerformed(evt);
}
});
mnuDatei.add(mnuOpen);
jFileChooser1 = new javax.swing.JFileChooser();
toolBar = new javax.swing.JToolBar();
toolAdd = new javax.swing.JButton();
toolRemove = new javax.swing.JButton();
toolUndo = new javax.swing.JButton();
adressTable2 = new prfourgui.View.AdressTable();
pnStatus = new javax.swing.JScrollPane();
txtStatus = new javax.swing.JTextArea();
mnuMain = new javax.swing.JMenuBar();
mnuDatei = new javax.swing.JMenu();
mnuOpen = new javax.swing.JMenuItem();
mnuSave = new javax.swing.JMenuItem();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

toolBar.setRollover(true);

toolAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/New24.gif"))); // NOI18N
toolAdd.setMnemonic('A');
toolAdd.setToolTipText("Add Address");
toolAdd.setFocusable(false);
toolAdd.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
toolAdd.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
toolBar.add(toolAdd);

toolRemove.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/Delete24.gif"))); // NOI18N
toolRemove.setMnemonic('R');
toolRemove.setToolTipText("Remove Address");
toolRemove.setFocusable(false);
toolRemove.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
toolRemove.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
toolBar.add(toolRemove);

toolUndo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/Undo24.gif"))); // NOI18N
toolUndo.setToolTipText("Undo");
toolUndo.setFocusable(false);
toolUndo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
toolUndo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
toolBar.add(toolUndo);

getContentPane().add(toolBar, java.awt.BorderLayout.NORTH);
getContentPane().add(adressTable2, java.awt.BorderLayout.CENTER);

txtStatus.setColumns(20);
txtStatus.setRows(5);
pnStatus.setViewportView(txtStatus);

getContentPane().add(pnStatus, java.awt.BorderLayout.PAGE_END);

mnuDatei.setMnemonic('D');
mnuDatei.setText("Datei");

mnuOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
mnuOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/Open24.gif"))); // NOI18N
mnuOpen.setMnemonic('O');
mnuOpen.setText("Open");
mnuOpen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mnuOpenActionPerformed(evt);
}
});
mnuDatei.add(mnuOpen);

mnuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
mnuSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/Save24.gif"))); // NOI18N
mnuSave.setMnemonic('S');
mnuSave.setText("Save");
mnuSave.setToolTipText("");
mnuDatei.add(mnuSave);
mnuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
mnuSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/prfourgui/Icons/Save24.gif"))); // NOI18N
mnuSave.setMnemonic('S');
mnuSave.setText("Save");
mnuSave.setToolTipText("");
mnuDatei.add(mnuSave);

mnuMain.add(mnuDatei);
mnuMain.add(mnuDatei);

setJMenuBar(mnuMain);
setJMenuBar(mnuMain);

pack();
}// </editor-fold>//GEN-END:initComponents
pack();
}// </editor-fold>//GEN-END:initComponents

private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_mnuOpenActionPerformed
{//GEN-HEADEREND:event_mnuOpenActionPerformed
@@ -162,20 +174,20 @@ public class AdressbuchView extends javax.swing.JFrame
});
}

// Variables declaration - do not modify//GEN-BEGIN:variables
private prfourgui.View.AdressTable adressTable2;
private javax.swing.JFileChooser jFileChooser1;
private javax.swing.JMenu mnuDatei;
private javax.swing.JMenuBar mnuMain;
private javax.swing.JMenuItem mnuOpen;
private javax.swing.JMenuItem mnuSave;
private javax.swing.JScrollPane pnStatus;
private javax.swing.JButton toolAdd;
private javax.swing.JToolBar toolBar;
private javax.swing.JButton toolRemove;
private javax.swing.JButton toolUndo;
private javax.swing.JTextArea txtStatus;
// End of variables declaration//GEN-END:variables
// Variables declaration - do not modify//GEN-BEGIN:variables
private prfourgui.View.AdressTable adressTable2;
private javax.swing.JFileChooser jFileChooser1;
private javax.swing.JMenu mnuDatei;
private javax.swing.JMenuBar mnuMain;
private javax.swing.JMenuItem mnuOpen;
private javax.swing.JMenuItem mnuSave;
private javax.swing.JScrollPane pnStatus;
private javax.swing.JButton toolAdd;
private javax.swing.JToolBar toolBar;
private javax.swing.JButton toolRemove;
private javax.swing.JButton toolUndo;
private javax.swing.JTextArea txtStatus;
// End of variables declaration//GEN-END:variables

/**
* @return the mnuOpen

Loading…
Cancel
Save