/*
package p1;
import java.awt.Color;
/**
*
* @author Cr
*/
public class NewApplication extends javax.swing.JFrame {
/** Creates new form NewApplication */
public NewApplication() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
lableName = new javax.swing.JLabel();
labelVorname = new javax.swing.JLabel();
lableORT = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
titel = new javax.swing.JTextField();
anrede = new javax.swing.JComboBox();
name = new javax.swing.JTextField();
vorname = new javax.swing.JTextField();
plz = new javax.swing.JTextField();
ort = new javax.swing.JTextField();
adresse = new javax.swing.JTextField();
telefon = new javax.swing.JFormattedTextField();
handy = new javax.swing.JFormattedTextField();
btn_ok = new javax.swing.JButton();
btn_abbord = new javax.swing.JButton();
menuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu();
openMenuItem = new javax.swing.JMenuItem();
saveMenuItem = new javax.swing.JMenuItem();
saveAsMenuItem = new javax.swing.JMenuItem();
exitMenuItem = new javax.swing.JMenuItem();
editMenu = new javax.swing.JMenu();
cutMenuItem = new javax.swing.JMenuItem();
copyMenuItem = new javax.swing.JMenuItem();
pasteMenuItem = new javax.swing.JMenuItem();
deleteMenuItem = new javax.swing.JMenuItem();
helpMenu = new javax.swing.JMenu();
contentsMenuItem = new javax.swing.JMenuItem();
aboutMenuItem = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Eingabe");
jLabel1.setText("Titel");
jLabel2.setText("Anrede");
lableName.setText("Name");
labelVorname.setText("Vorname");
lableORT.setText("PLZ/Ort");
jLabel6.setText("Adresse");
jLabel7.setText("Telefon");
jLabel8.setText("Handy");
titel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
titelActionPerformed(evt);
}
});
anrede.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Anrede", "Herr", "Frau", "Firma" }));
anrede.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
anredeActionPerformed(evt);
}
});
name.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nameActionPerformed(evt);
}
});
plz.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
plzActionPerformed(evt);
}
});
plz.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
plzFocusLost(evt);
}
});
telefon.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
telefonActionPerformed(evt);
}
});
btn_ok.setText("OK");
btn_ok.setMaximumSize(new java.awt.Dimension(85, 23));
btn_ok.setMinimumSize(new java.awt.Dimension(85, 23));
btn_ok.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_okActionPerformed(evt);
}
});
btn_abbord.setText("Abbrechen");
btn_abbord.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_abbordActionPerformed(evt);
}
});
fileMenu.setText("File");
openMenuItem.setText("Open");
fileMenu.add(openMenuItem);
saveMenuItem.setText("Save");
fileMenu.add(saveMenuItem);
saveAsMenuItem.setText("Save As ...");
fileMenu.add(saveAsMenuItem);
exitMenuItem.setText("Exit");
exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitMenuItemActionPerformed(evt);
}
});
fileMenu.add(exitMenuItem);
menuBar.add(fileMenu);
editMenu.setText("Edit");
cutMenuItem.setText("Cut");
editMenu.add(cutMenuItem);
copyMenuItem.setText("Copy");
editMenu.add(copyMenuItem);
pasteMenuItem.setText("Paste");
editMenu.add(pasteMenuItem);
deleteMenuItem.setText("Delete");
editMenu.add(deleteMenuItem);
menuBar.add(editMenu);
helpMenu.setText("Help");
contentsMenuItem.setText("Contents");
helpMenu.add(contentsMenuItem);
aboutMenuItem.setText("About");
helpMenu.add(aboutMenuItem);
menuBar.add(helpMenu);
setJMenuBar(menuBar);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lableName)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1))
.addComponent(labelVorname)
.addComponent(lableORT)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8))
.addGap(7, 7, 7)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(vorname, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(plz, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ort, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE))
.addComponent(adresse, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
.addComponent(telefon, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
.addComponent(handy, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
.addComponent(name, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(btn_ok, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn_abbord))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(38, 38, 38)
.addComponent(anrede, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(titel, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(108, 108, 108))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(36, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(anrede, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(titel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lableName))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(vorname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelVorname))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(plz, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lableORT))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(adresse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(telefon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(handy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE, false)
.addComponent(btn_ok, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn_abbord))
.addGap(33, 33, 33))
);
pack();
}// </editor-fold>
private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void titelActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void anredeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void nameActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void telefonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btn_abbordActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void plzActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void plzFocusLost(java.awt.event.FocusEvent evt) {
if(plz.getText().length()==5)
{
if(!plz.getText().isEmpty())
{
try
{
int int1 = Integer.parseInt(plz.getText());
plz.setForeground(Color.black);
}
catch(Throwable e)
{
fehlerAusgeben1("Dieses Feld erfordert eine numerische Eingabe!");
plz.setForeground(Color.red);
}
}
}
else
{
fehlerAusgeben1("Dieses Feld benoetigt exakt 5 Zeichen!");
plz.setForeground(Color.red);
//plz.requestFocus();
}
}
private void btn_okActionPerformed(java.awt.event.ActionEvent evt) {
//fehlerBeiOk();
Ausgabe aus = new Ausgabe();
aus.setAusgabe();
aus.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{
new NewApplication().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JMenuItem aboutMenuItem;
private javax.swing.JTextField adresse;
private javax.swing.JComboBox anrede;
private javax.swing.JButton btn_abbord;
private javax.swing.JButton btn_ok;
private javax.swing.JMenuItem contentsMenuItem;
private javax.swing.JMenuItem copyMenuItem;
private javax.swing.JMenuItem cutMenuItem;
private javax.swing.JMenuItem deleteMenuItem;
private javax.swing.JMenu editMenu;
private javax.swing.JMenuItem exitMenuItem;
private javax.swing.JMenu fileMenu;
private javax.swing.JFormattedTextField handy;
private javax.swing.JMenu helpMenu;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel labelVorname;
private javax.swing.JLabel lableName;
private javax.swing.JLabel lableORT;
private javax.swing.JMenuBar menuBar;
private javax.swing.JTextField name;
private javax.swing.JMenuItem openMenuItem;
private javax.swing.JTextField ort;
private javax.swing.JMenuItem pasteMenuItem;
private javax.swing.JTextField plz;
private javax.swing.JMenuItem saveAsMenuItem;
private javax.swing.JMenuItem saveMenuItem;
private javax.swing.JFormattedTextField telefon;
private javax.swing.JTextField titel;
private javax.swing.JTextField vorname;
// End of variables declaration
private void fehlerAusgeben1(String fehlertext)
{
Fehler fehler = new Fehler(this, false);
fehler.fehlertextAendern(fehlertext);
fehler.setVisible(true);
}
private void fehlerBeiOk() {
if(!plz.getText().isEmpty())
{
try
{
int int1 = Integer.parseInt(plz.getText());
}
catch(Throwable e)
{
fehlerAusgeben1("Dieses Feld erfordert eine numerische Eingabe!");
}
}
if(telefon.getText().isEmpty()||handy.getText().isEmpty()||adresse.getText().isEmpty()||ort.getText().isEmpty()||titel.getText().isEmpty()||name.getText().isEmpty()||vorname.getText().isEmpty()||plz.getText().isEmpty()){
fehlerAusgeben1("Bitte alle Pflichtfelder ausfuellen!");
}
}
public String getNachname(){
return name.getText();
}
public String getVorname(){
return vorname.getText();
}
public String getTitel(){
return titel.getText();
}
public String getAdresse(){
return adresse.getText();
}
public String getPLZ(){
return plz.getText();
}
public String getOrt(){
return ort.getText();
}
public String getHandy(){
return handy.getText();
}
public String getTelefon(){
return telefon.getText();
}
}