/****************************************************************/
/* Rezepte eintragen (Formular erstellen)
Rezepte speichern (XML)
Rezepte Verzeichnis anlegen
Rezepte Suche
Rezepte Zufallssuche
Rezepte Forum
test */
/* */
/****************************************************************/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* Summary description for test
*
*/
public class test extends JFrame
{
// Variables declaration
private JButton jButton1;
private JButton jButton2;
private JButton jButton3;
private JButton jButton4;
private JButton jButton5;
private JButton jButton6;
private JButton jButton7;
private JButton jButton8;
private JPanel contentPane;
//-----
private JLabel jLabel1;
private JLabel jLabel2;
private JLabel jLabel3;
private JLabel jLabel4;
private JLabel jLabel5;
private JLabel jLabel6;
//label für die Ausgabe
private JLabel jLabel10;
private JLabel jLabel11;
private JLabel jLabel12;
private JLabel jLabel13;
private JLabel jLabel14;
private JPanel jPanel1;
//-----meine eingefügten listen, labels e.t.c.
private JList jList1; //<---hier ist liste
private JTextField jTextField1;
private JTextField jTextField2;
private JTextField jTextField3;
private JTextArea jTextArea1;
private JScrollPane jScrollPane1;
private JTextArea jTextArea2;
private JScrollPane jScrollPane2;
// End of variables declaration
public test()
{
super();
initializeComponent();
//
// TODO: Add any constructor code after initializeComponent call
//
this.setVisible(true);
}
/**
* 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 Windows Form Designer. Otherwise, retrieving disign might not work properly.
*/
private void initializeComponent()
{
jButton1 = new JButton();
jButton2 = new JButton();
jButton3 = new JButton();
jButton4 = new JButton();
jButton5 = new JButton();
jButton6 = new JButton();
jButton7 = new JButton();
jButton8 = new JButton();
//-----
jLabel1 = new JLabel();
jLabel2 = new JLabel();
jLabel3 = new JLabel();
jLabel4 = new JLabel();
jLabel5 = new JLabel();
jLabel6 = new JLabel();
//Labels für die Ausgabe
jLabel10 = new JLabel();
jLabel11 = new JLabel();
jLabel12 = new JLabel();
jLabel13 = new JLabel();
jLabel14 = new JLabel();
jPanel1 = new JPanel();
//-----hier kommen die neuen listen, labels...
jList1 = new JList(); //<---hier ist liste
jTextField1 = new JTextField();
jTextField2 = new JTextField();
jTextField3 = new JTextField();
jTextArea1 = new JTextArea();
jScrollPane1 = new JScrollPane();
jTextArea2 = new JTextArea();
jScrollPane2 = new JScrollPane();
contentPane = (JPanel)this.getContentPane();
//jList1.add("Berlin");
//
// jButton1
//
jButton1.setText("Rezept anschauen");
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton1_actionPerformed(e);
}
});
jButton1.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
{
jButton1_mouseClicked(e);
}
});
//
// jButton2
//
jButton2.setText("Rezept eingeben");
jButton2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton2_actionPerformed(e);
}
});
jButton2.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
{
jButton2_mouseClicked(e);
}
});
//
// jButton3
//
jButton3.setText("Rezept ändern");
jButton3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton3_actionPerformed(e);
}
});
jButton3.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
{
jButton3_mouseClicked(e);
}
});
//
// jButton4
//
jButton4.setText("Zufallsrezept");
jButton4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton4_actionPerformed(e);
}
});
jButton4.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
{
jButton4_mouseClicked(e);
}
});
//
// jButton5
//
jButton5.setText("Forum");
jButton5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton5_actionPerformed(e);
}
});
jButton5.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
{
jButton5_mouseClicked(e);
}
});
//
// jButton6
//
jButton6.setText("Start");
jButton6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton6_actionPerformed(e);
}
});
jButton6.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
{
jButton6_mouseClicked(e);
}
});
//
// jButton7
//
jButton7.setText("Abbrechen");
jButton7.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton7_actionPerformed(e);
}
});
jButton7.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
{
jButton7_mouseClicked(e);
}
});
//
// jButton8
//
jButton8.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton8_actionPerformed(e);
}
});
jButton8.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
{
jButton8_mouseClicked(e);
}
});
//
// contentPane
//
//
// jTextField1
//
jTextField1.setText("jTextField1");
jTextField1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jTextField1_actionPerformed(e);
}
});
//
// jTextField2
//
jTextField2.setText("jTextField2");
jTextField2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jTextField2_actionPerformed(e);
}
});
//
// jTextField3
//
jTextField3.setText("jTextField3");
jTextField3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jTextField3_actionPerformed(e);
}
});
//
// jTextArea1
//
jTextArea1.setText("jTextArea1");
//
// jScrollPane1
//
jScrollPane1.setViewportView(jTextArea1);
//
// jTextArea2
//
jTextArea2.setText("jTextArea2");
//
// jScrollPane2
//
jScrollPane2.setViewportView(jTextArea2);
//
// contentPane
//
//
// jList1 //<---hier ist liste
//
/*
jList1.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e)
{
jList1_valueChanged(e);
}
});
*/
//
contentPane.setLayout(null);
Color f; f=new Color(0.5F, 0.5F, 0.5F);
contentPane.setBackground(f);
addComponent(contentPane, jButton1, 3,4,127,26);
addComponent(contentPane, jButton2, 133,4,127,26);
addComponent(contentPane, jButton3, 263,4,127,26);
addComponent(contentPane, jButton4, 393,4,127,26);
addComponent(contentPane, jButton5, 523,4,127,26);
addComponent(contentPane, jPanel1, 1,35,652,500);
//
// jLabel1
//
jLabel1.setText("\tDieses Progamm wurde von Mario und Matze erstellt.");
jLabel2.setText("Rezeptname: ");
jLabel3.setText("Rezeptautor: ");
jLabel4.setText("Rezeptzeit: ");
jLabel5.setText("Zutaten: ");
jLabel6.setText("Beschreibung: ");
//Eingabe der Ausgabelabels
jLabel10.setText("Hier kommt Rezeptname");
jLabel11.setText("Hier kommt Rezeptautor");
jLabel12.setText("Hier kommt Rezeptzeit ");
jLabel13.setText("Hier kommt Zutaten");
jLabel14.setText("Hier kommt Beschreibung");
//Button Farbe
Color jb; jb=new Color(230, 230 , 230);
jButton1.setBackground(jb);
jButton2.setBackground(jb);
jButton3.setBackground(jb);
jButton4.setBackground(jb);
jButton5.setBackground(jb);
//Objekte sichtbar oder noch nicht sichtbar
jList1.setVisible(false);
jLabel2.setVisible(false);
jLabel3.setVisible(false);
jLabel4.setVisible(false);
jLabel5.setVisible(false);
jLabel6.setVisible(false);
jLabel10.setVisible(false);
jLabel11.setVisible(false);
jLabel12.setVisible(false);
jLabel13.setVisible(false);
jLabel14.setVisible(false);
jButton6.setVisible(false);
jButton7.setVisible(false);
jButton8.setVisible(false);
jTextField1.setVisible(false);
jTextField2.setVisible(false);
jTextField3.setVisible(false);
jScrollPane1.setVisible(false);
jScrollPane2.setVisible(false);
//hier wird die liste true gesetzt
// jPanel1
//
jPanel1.setLayout(null);
Color c; c=new Color(0.5F, 0.5F, 0.5F);
jPanel1.setBackground(c);
addComponent(jPanel1,jLabel1,10,10,1000,15);
addComponent(jPanel1,jLabel2,200,50,290,15);
addComponent(jPanel1,jLabel3,200,100,290,15);
addComponent(jPanel1,jLabel4,200,150,290,15);
addComponent(jPanel1,jLabel5,200,200,290,15);
addComponent(jPanel1,jLabel6,200,275,290,15);
addComponent(jPanel1, jList1, 10,50,160,375);
addComponent(jPanel1, jButton6, 24,100,150,27);
addComponent(jPanel1, jButton7, 300,400,150,27);
addComponent(jPanel1, jButton8, 475,400,150,27);
addComponent(jPanel1, jTextField1, 300,50,100,22);
addComponent(jPanel1, jTextField2, 300,100,100,22);
addComponent(jPanel1, jTextField3, 300,150,100,22);
addComponent(jPanel1, jScrollPane1, 300,200,275,45);
addComponent(jPanel1, jScrollPane2, 300,275,275,100);
//Hier kommen die Ausgabelabels auf den Panel und werden Ausgerichtet
addComponent(jPanel1,jLabel10,300,50,100,22);
addComponent(jPanel1,jLabel11,300,100,100,22);
addComponent(jPanel1,jLabel12,300,150,100,22);
addComponent(jPanel1,jLabel13,300,200,275,45);
addComponent(jPanel1,jLabel14,300,275,275,100);
jPanel1.setBorder(BorderFactory.createLoweredBevelBorder());
//
// test
//
this.setTitle("Kochbuch");
this.setLocation(new Point(5, 25));
this.setSize(new Dimension(662, 515));
}
/** Add Component Without a Layout Manager (Absolute Positioning) */
private void addComponent(Container container,Component c,int x,int y,int width,int height)
{
c.setBounds(x,y,width,height);
container.add(c);
}
//
// TODO: Add any appropriate code in the following Event Handling Methods
//
private void jButton1_actionPerformed(ActionEvent e)
{
System.out.println("jButton1_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jButton1_mouseClicked(MouseEvent e)
{
System.out.println("jButton1_mouseClicked(MouseEvent e) called.");
// TODO: Add any handling code here
Color b; b=new Color(0, 0 , 255);
jButton1.setBackground(b);
Color jb; jb=new Color(230, 230 , 230);
jButton2.setBackground(jb);
jButton3.setBackground(jb);
jButton4.setBackground(jb);
jButton5.setBackground(jb);
jLabel1.setVisible(true);
jLabel2.setVisible(true);
jLabel3.setVisible(true);
jLabel4.setVisible(true);
jLabel5.setVisible(true);
jLabel6.setVisible(true);
jLabel10.setVisible(true);
jLabel11.setVisible(true);
jLabel12.setVisible(true);
jLabel13.setVisible(true);
jLabel14.setVisible(true);
jLabel1.setText("Klicken Sie auf ein Rezept aus der Liste um dieses zu kochen");
jList1.setVisible(true);
jButton6.setVisible(false);
jButton7.setVisible(false);
jButton8.setVisible(false);
jTextField1.setVisible(false);
jTextField2.setVisible(false);
jTextField3.setVisible(false);
jScrollPane1.setVisible(false);
jScrollPane2.setVisible(false);
}
private void jButton2_actionPerformed(ActionEvent e)
{
System.out.println("jButton2_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jButton2_mouseClicked(MouseEvent e)
{
System.out.println("jButton2_mouseClicked(MouseEvent e) called.");
// TODO: Add any handling code here
Color b; b=new Color(0, 0 , 255);
jButton2.setBackground(b);
Color jb; jb=new Color(230, 230 , 230);
jButton1.setBackground(jb);
jButton3.setBackground(jb);
jButton4.setBackground(jb);
jButton5.setBackground(jb);
jLabel1.setVisible(true);
jLabel2.setVisible(true);
jLabel3.setVisible(true);
jLabel4.setVisible(true);
jLabel5.setVisible(true);
jLabel6.setVisible(true);
jLabel1.setText("Füllen Sie die Felder aus und drücken sie Speichen, um ein Rezept zu speichern.");
jLabel10.setVisible(false);
jLabel11.setVisible(false);
jLabel12.setVisible(false);
jLabel13.setVisible(false);
jLabel14.setVisible(false);
jList1.setVisible(true);
jButton6.setVisible(false);
jButton7.setVisible(true);
jButton8.setText("Speichern");
jButton8.setVisible(true);
jTextField1.setVisible(true);
jTextField2.setVisible(true);
jTextField3.setVisible(true);
jScrollPane1.setVisible(true);
jScrollPane2.setVisible(true);
}
private void jButton3_actionPerformed(ActionEvent e)
{
System.out.println("jButton3_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jButton3_mouseClicked(MouseEvent e)
{
System.out.println("jButton3_mouseClicked(MouseEvent e) called.");
// TODO: Add any handling code here
Color b; b=new Color(0, 0 , 255);
jButton3.setBackground(b);
Color jb; jb=new Color(230, 230 , 230);
jButton2.setBackground(jb);
jButton1.setBackground(jb);
jButton4.setBackground(jb);
jButton5.setBackground(jb);
jLabel1.setVisible(true);
jLabel2.setVisible(true);
jLabel3.setVisible(true);
jLabel4.setVisible(true);
jLabel5.setVisible(true);
jLabel6.setVisible(true);
jList1.setVisible(true);
jLabel1.setText("Wählen Sie ein Rezept aus und berichtigen Sie das Rezept. Vielen Dank.");
jLabel10.setVisible(false);
jLabel11.setVisible(false);
jLabel12.setVisible(false);
jLabel13.setVisible(false);
jLabel14.setVisible(false);
jButton6.setVisible(false);
jButton7.setVisible(true);
jButton8.setVisible(true);
jButton8.setText("Ändern");
jTextField1.setVisible(true);
jTextField2.setVisible(true);
jTextField3.setVisible(true);
jScrollPane1.setVisible(true);
jScrollPane2.setVisible(true);
}
private void jButton4_actionPerformed(ActionEvent e)
{
System.out.println("jButton4_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jButton4_mouseClicked(MouseEvent e)
{
System.out.println("jButton4_mouseClicked(MouseEvent e) called.");
// TODO: Add any handling code here
Color b; b=new Color(0, 0 , 255);
jButton4.setBackground(b);
Color jb; jb=new Color(230, 230 , 230);
jButton1.setBackground(jb);
jButton3.setBackground(jb);
jButton2.setBackground(jb);
jButton5.setBackground(jb);
jList1.setVisible(false);
jLabel1.setVisible(true);
jLabel2.setVisible(true);
jLabel3.setVisible(true);
jLabel4.setVisible(true);
jLabel5.setVisible(true);
jLabel6.setVisible(true);
jLabel1.setText("Button 4 wurde geklickt");
jLabel10.setVisible(true);
jLabel11.setVisible(true);
jLabel12.setVisible(true);
jLabel13.setVisible(true);
jLabel14.setVisible(true);
jButton6.setVisible(true);
jButton7.setVisible(false);
jButton8.setVisible(false);
jTextField1.setVisible(false);
jTextField2.setVisible(false);
jTextField3.setVisible(false);
jScrollPane1.setVisible(false);
jScrollPane2.setVisible(false);
}
private void jButton5_actionPerformed(ActionEvent e)
{
System.out.println("jButton5_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jButton5_mouseClicked(MouseEvent e)
{
System.out.println("jButton5_mouseClicked(MouseEvent e) called.");
// TODO: Add any handling code here
Color b; b=new Color(0, 0 , 255);
jButton5.setBackground(b);
Color jb; jb=new Color(230, 230 , 230);
jButton1.setBackground(jb);
jButton3.setBackground(jb);
jButton4.setBackground(jb);
jButton2.setBackground(jb);
jLabel1.setVisible(true);
jLabel2.setVisible(false);
jLabel3.setVisible(false);
jLabel4.setVisible(false);
jLabel5.setVisible(false);
jLabel6.setVisible(false);
jLabel1.setText("Hierkommen Meinungen Statements hin");
jLabel10.setVisible(false);
jLabel11.setVisible(false);
jLabel12.setVisible(false);
jLabel13.setVisible(false);
jLabel14.setVisible(false);
jList1.setVisible(false);
jButton6.setVisible(false);
jButton7.setVisible(false);
jButton8.setVisible(false);
jTextField1.setVisible(false);
jTextField2.setVisible(false);
jTextField3.setVisible(false);
jScrollPane1.setVisible(false);
jScrollPane2.setVisible(false);
}
//
private void jButton6_actionPerformed(ActionEvent e)
{
System.out.println("jButton6_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jButton6_mouseClicked(MouseEvent e)
{
System.out.println("jButton6_mouseClicked(MouseEvent e) called.");
// TODO: Add any handling code here
}
//
//
private void jButton7_actionPerformed(ActionEvent e)
{
System.out.println("jButton7_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jButton7_mouseClicked(MouseEvent e)
{
System.out.println("jButton7_mouseClicked(MouseEvent e) called.");
// TODO: Add any handling code here
}
//
//
private void jButton8_actionPerformed(ActionEvent e)
{
System.out.println("jButton8_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jButton8_mouseClicked(MouseEvent e)
{
System.out.println("jButton8_mouseClicked(MouseEvent e) called.");
// TODO: Add any handling code here
}
//
// TODO: Add any method code to meet your needs in the following area
//
//
// TODO: Add any appropriate code in the following Event Handling Methods
//
private void jTextField1_actionPerformed(ActionEvent e)
{
System.out.println("\njTextField1_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jTextField2_actionPerformed(ActionEvent e)
{
System.out.println("\njTextField2_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
private void jTextField3_actionPerformed(ActionEvent e)
{
System.out.println("\njTextField3_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
//
// TODO: Add any method code to meet your needs in the following area
/*
private void jList1_valueChanged(ListSelectionEvent e) //<---hier besteht ein fehler
{
System.out.println("jList1_valueChanged(ListSelectionEvent e) called.");
//if(!e.getValueIsAdjusting())
{
Object o = jList1.getSelectedValue();
System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");
// TODO: Add any handling code here for the particular object being selected
}
}
*/
// TODO: Add any method code to meet your needs in the following area
//
//============================= Testing ================================//
//= =//
//= The following main method is just for testing this class you built.=//
//= After testing,you may simply delete it. =//
//======================================================================//
public static void main(String[] args)
{
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
catch (Exception ex)
{
System.out.println("Failed loading L&F: ");
System.out.println(ex);
}
new test();
}
//= End of Testing =
}