Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package database;
- import java.awt.Dimension;
- import java.awt.FlowLayout;
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.Insets;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.BorderFactory;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.JScrollPane;
- import javax.swing.JTabbedPane;
- import javax.swing.JTable;
- import javax.swing.JTextArea;
- import javax.swing.JTextField;
- import javax.swing.SpringLayout;
- /**
- * @author styx
- *
- */
- public class MainForm extends JFrame implements ActionListener {
- private JPanel panel, tablepanel, buttonpanel, detailspanel, gläser,
- spUnters, hornhaut, bewertung, allgemein;
- private JTable table1;
- private JButton searchb, addb, saveb, delb, refreshb;
- private JTextField searchf, aNamef, aVornamef, aStraßef, aHausnf, aPlzf,
- aStadtf, aTätigkeitf, aGebdatumf, aTelefonf, aDatumf, hPflegefield,
- hdatumfield;
- private JTextArea hwünschef;
- private JTabbedPane tabbedPane;
- private JScrollPane scrollPane;
- private JLabel aNamel, aVornamel, aStraßel, aHausnl, aPlzl, aStadtl,
- aTätigkeitl, aGebdatuml, aTelefonl, aDatuml, htränen,
- hzusammensetzung, hbut, hlidspannung, hbindehaut, hlidschlag,
- hlidschluss, hpflege, hdatum, hwünsche;
- private SpringLayout splayout, hslayout;
- private JComboBox htränenbox, hzusammensetzungbox, hlidspannungbox,
- hbindehautbox, hlidschlagbox, hlidschlussbox;
- private final String[] tränen = { "<0.2", "~0.2", ">0.2" },
- zusammensetzung = { "wässrig", "normal", "ölig-viskos" },
- lidspannung = { "schwach", "normal", "stark" }, bindehaut = {
- "locker", "normal", "fest" }, lidschlag = { "selten",
- "normal", "häufig" }, lidschluss = { "komplett",
- "inkomplett" };
- public MainForm() {
- super("Client Manager");
- initMain();
- initGridBag();
- initSpingLay();
- scrollPane.add(table1);
- tabbedPane.addTab("Allgemein", allgemein);
- tabbedPane.addTab("Gläser", gläser);
- tabbedPane.addTab("Spaltuntersuchung", spUnters);
- tabbedPane.addTab("Horhaut", new JScrollPane(hornhaut));
- tabbedPane.addTab("Bewertung", bewertung);
- detailspanel.add(tabbedPane);
- buttonpanel.add(addb);
- buttonpanel.add(saveb);
- buttonpanel.add(delb);
- buttonpanel.add(refreshb);
- setContentPane(panel);
- }
- private void initSpingLay() {
- // TODO Auto-generated method stub
- allgemein.add(aVornamel);
- allgemein.add(aVornamef);
- allgemein.add(aNamel);
- allgemein.add(aNamef);
- allgemein.add(aStraßel);
- allgemein.add(aStraßef);
- allgemein.add(aHausnf);
- allgemein.add(aHausnl);
- allgemein.add(aPlzf);
- allgemein.add(aPlzl);
- allgemein.add(aStadtf);
- allgemein.add(aStadtl);
- allgemein.add(aTätigkeitf);
- allgemein.add(aTätigkeitl);
- allgemein.add(aTelefonf);
- allgemein.add(aTelefonl);
- allgemein.add(aGebdatumf);
- allgemein.add(aGebdatuml);
- allgemein.add(aDatumf);
- allgemein.add(aDatuml);
- splayout.putConstraint(SpringLayout.WEST, aVornamel, 15,
- SpringLayout.WEST, allgemein);
- splayout.putConstraint(SpringLayout.NORTH, aVornamel, 15,
- SpringLayout.NORTH, allgemein);
- splayout.putConstraint(SpringLayout.WEST, aVornamef, 5,
- SpringLayout.EAST, aTelefonl);
- splayout.putConstraint(SpringLayout.NORTH, aVornamef, 15,
- SpringLayout.NORTH, allgemein);
- splayout.putConstraint(SpringLayout.WEST, aNamel, 0, SpringLayout.WEST,
- aVornamel);
- splayout.putConstraint(SpringLayout.WEST, aNamef, 0, SpringLayout.WEST,
- aVornamef);
- splayout.putConstraint(SpringLayout.NORTH, aNamel, 5,
- SpringLayout.SOUTH, aVornamef);
- splayout.putConstraint(SpringLayout.NORTH, aNamef, 5,
- SpringLayout.SOUTH, aVornamef);
- splayout.putConstraint(SpringLayout.WEST, aStraßel, 0,
- SpringLayout.WEST, aNamel);
- splayout.putConstraint(SpringLayout.WEST, aStraßef, 0,
- SpringLayout.WEST, aNamef);
- splayout.putConstraint(SpringLayout.NORTH, aStraßel, 5,
- SpringLayout.SOUTH, aNamef);
- splayout.putConstraint(SpringLayout.NORTH, aStraßef, 5,
- SpringLayout.SOUTH, aNamef);
- splayout.putConstraint(SpringLayout.WEST, aHausnl, 0,
- SpringLayout.WEST, aStraßel);
- splayout.putConstraint(SpringLayout.WEST, aHausnf, 0,
- SpringLayout.WEST, aStraßef);
- splayout.putConstraint(SpringLayout.NORTH, aHausnl, 5,
- SpringLayout.SOUTH, aStraßef);
- splayout.putConstraint(SpringLayout.NORTH, aHausnf, 5,
- SpringLayout.SOUTH, aStraßef);
- splayout.putConstraint(SpringLayout.WEST, aPlzl, 0, SpringLayout.WEST,
- aHausnl);
- splayout.putConstraint(SpringLayout.WEST, aPlzf, 0, SpringLayout.WEST,
- aHausnf);
- splayout.putConstraint(SpringLayout.NORTH, aPlzl, 5,
- SpringLayout.SOUTH, aHausnf);
- splayout.putConstraint(SpringLayout.NORTH, aPlzf, 5,
- SpringLayout.SOUTH, aHausnf);
- splayout.putConstraint(SpringLayout.WEST, aStadtl, 0,
- SpringLayout.WEST, aPlzl);
- splayout.putConstraint(SpringLayout.WEST, aStadtf, 0,
- SpringLayout.WEST, aPlzf);
- splayout.putConstraint(SpringLayout.NORTH, aStadtl, 5,
- SpringLayout.SOUTH, aPlzf);
- splayout.putConstraint(SpringLayout.NORTH, aStadtf, 5,
- SpringLayout.SOUTH, aPlzf);
- splayout.putConstraint(SpringLayout.WEST, aTätigkeitl, 0,
- SpringLayout.WEST, aStadtl);
- splayout.putConstraint(SpringLayout.WEST, aTätigkeitf, 0,
- SpringLayout.WEST, aStadtf);
- splayout.putConstraint(SpringLayout.NORTH, aTätigkeitl, 5,
- SpringLayout.SOUTH, aStadtf);
- splayout.putConstraint(SpringLayout.NORTH, aTätigkeitf, 5,
- SpringLayout.SOUTH, aStadtf);
- splayout.putConstraint(SpringLayout.WEST, aTelefonl, 0,
- SpringLayout.WEST, aTätigkeitl);
- splayout.putConstraint(SpringLayout.WEST, aTelefonf, 0,
- SpringLayout.WEST, aTätigkeitf);
- splayout.putConstraint(SpringLayout.NORTH, aTelefonl, 5,
- SpringLayout.SOUTH, aTätigkeitf);
- splayout.putConstraint(SpringLayout.NORTH, aTelefonf, 5,
- SpringLayout.SOUTH, aTätigkeitf);
- splayout.putConstraint(SpringLayout.WEST, aGebdatuml, 0,
- SpringLayout.WEST, aTelefonl);
- splayout.putConstraint(SpringLayout.WEST, aGebdatumf, 0,
- SpringLayout.WEST, aTelefonf);
- splayout.putConstraint(SpringLayout.NORTH, aGebdatuml, 5,
- SpringLayout.SOUTH, aTelefonf);
- splayout.putConstraint(SpringLayout.NORTH, aGebdatumf, 5,
- SpringLayout.SOUTH, aTelefonf);
- splayout.putConstraint(SpringLayout.WEST, aDatuml, 0,
- SpringLayout.WEST, aGebdatuml);
- splayout.putConstraint(SpringLayout.WEST, aDatumf, 0,
- SpringLayout.WEST, aGebdatumf);
- splayout.putConstraint(SpringLayout.NORTH, aDatuml, 5,
- SpringLayout.SOUTH, aGebdatumf);
- splayout.putConstraint(SpringLayout.NORTH, aDatumf, 5,
- SpringLayout.SOUTH, aGebdatumf);
- hornhaut.add(htränen);
- hornhaut.add(hzusammensetzung);
- hornhaut.add(hbut);
- hornhaut.add(hlidspannung);
- hornhaut.add(hbindehaut);
- hornhaut.add(hlidschlag);
- hornhaut.add(hlidschluss);
- hornhaut.add(hpflege);
- hornhaut.add(hPflegefield);
- hornhaut.add(hwünsche);
- hornhaut.add(hwünschef);
- hornhaut.add(htränenbox);
- hornhaut.add(hzusammensetzungbox);
- hornhaut.add(hlidspannungbox);
- hornhaut.add(hbindehautbox);
- hornhaut.add(hlidschlagbox);
- hornhaut.add(hlidschlussbox);
- hornhaut.add(hdatum);
- hornhaut.add(hdatumfield);
- hslayout.putConstraint(SpringLayout.WEST, htränen, 15,
- SpringLayout.WEST, hornhaut);
- hslayout.putConstraint(SpringLayout.NORTH, htränen, 15,
- SpringLayout.NORTH, hornhaut);
- hslayout.putConstraint(SpringLayout.WEST, hzusammensetzung, 0,
- SpringLayout.WEST, htränen);
- hslayout.putConstraint(SpringLayout.NORTH, hzusammensetzung, 15,
- SpringLayout.SOUTH, htränen);
- hslayout.putConstraint(SpringLayout.WEST, hbut, 0, SpringLayout.WEST,
- hzusammensetzung);
- hslayout.putConstraint(SpringLayout.NORTH, hbut, 30,
- SpringLayout.SOUTH, hzusammensetzung);
- hslayout.putConstraint(SpringLayout.WEST, hlidspannung, 0,
- SpringLayout.WEST, hbut);
- hslayout.putConstraint(SpringLayout.NORTH, hlidspannung, 15,
- SpringLayout.SOUTH, hbut);
- hslayout.putConstraint(SpringLayout.WEST, hbindehaut, 0,
- SpringLayout.WEST, hlidspannung);
- hslayout.putConstraint(SpringLayout.NORTH, hbindehaut, 15,
- SpringLayout.SOUTH, hlidspannung);
- hslayout.putConstraint(SpringLayout.WEST, hlidschlag, 0,
- SpringLayout.WEST, hbindehaut);
- hslayout.putConstraint(SpringLayout.NORTH, hlidschlag, 15,
- SpringLayout.SOUTH, hbindehaut);
- hslayout.putConstraint(SpringLayout.WEST, hlidschluss, 0,
- SpringLayout.WEST, hlidschlag);
- hslayout.putConstraint(SpringLayout.NORTH, hlidschluss, 15,
- SpringLayout.SOUTH, hlidschlag);
- hslayout.putConstraint(SpringLayout.WEST, hpflege, 0,
- SpringLayout.WEST, hlidschluss);
- hslayout.putConstraint(SpringLayout.NORTH, hpflege, 30,
- SpringLayout.SOUTH, hlidschluss);
- hslayout.putConstraint(SpringLayout.WEST, hPflegefield, 0,
- SpringLayout.WEST, hpflege);
- hslayout.putConstraint(SpringLayout.NORTH, hPflegefield, 15,
- SpringLayout.SOUTH, hpflege);
- hslayout.putConstraint(SpringLayout.WEST, hwünsche, 0,
- SpringLayout.WEST, hPflegefield);
- hslayout.putConstraint(SpringLayout.NORTH, hwünsche, 15,
- SpringLayout.SOUTH, hPflegefield);
- hslayout.putConstraint(SpringLayout.WEST, hwünschef, 0,
- SpringLayout.WEST, hwünsche);
- hslayout.putConstraint(SpringLayout.NORTH, hwünschef, 15,
- SpringLayout.SOUTH, hwünsche);
- hslayout.putConstraint(SpringLayout.WEST, htränenbox, 15,
- SpringLayout.EAST, hzusammensetzung);
- hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, htränenbox, 0,
- SpringLayout.VERTICAL_CENTER, htränen);
- hslayout.putConstraint(SpringLayout.WEST, hzusammensetzungbox, 15,
- SpringLayout.EAST, hzusammensetzung);
- hslayout.putConstraint(SpringLayout.VERTICAL_CENTER,
- hzusammensetzungbox, 0, SpringLayout.VERTICAL_CENTER,
- hzusammensetzung);
- hslayout.putConstraint(SpringLayout.WEST, hlidspannungbox, 15,
- SpringLayout.EAST, hzusammensetzung);
- hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, hlidspannungbox,
- 0, SpringLayout.VERTICAL_CENTER, hlidspannung);
- hslayout.putConstraint(SpringLayout.WEST, hbindehautbox, 15,
- SpringLayout.EAST, hzusammensetzung);
- hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, hbindehautbox, 0,
- SpringLayout.VERTICAL_CENTER, hbindehaut);
- hslayout.putConstraint(SpringLayout.WEST, hlidschlagbox, 15,
- SpringLayout.EAST, hzusammensetzung);
- hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, hlidschlagbox, 0,
- SpringLayout.VERTICAL_CENTER, hlidschlag);
- hslayout.putConstraint(SpringLayout.WEST, hlidschlussbox, 15,
- SpringLayout.EAST, hzusammensetzung);
- hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, hlidschlussbox, 0,
- SpringLayout.VERTICAL_CENTER, hlidschluss);
- hslayout.putConstraint(SpringLayout.WEST, hdatum, 15,
- SpringLayout.EAST, hzusammensetzung);
- hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, hdatum, 0,
- SpringLayout.VERTICAL_CENTER, hpflege);
- hslayout.putConstraint(SpringLayout.WEST, hdatumfield, 15,
- SpringLayout.EAST, hzusammensetzung);
- hslayout.putConstraint(SpringLayout.NORTH, hdatumfield, 15,
- SpringLayout.SOUTH, hdatum);
- }
- private void initGridBag() {
- // TODO Auto-generated method stub
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.insets = new Insets(2, 2, 2, 2);
- c.gridx = 0;
- c.gridy = 0;
- c.gridheight = 2;
- c.weighty = 1.0;
- panel.add(tablepanel, c);
- c.gridheight = 1;
- c.gridx = 1;
- c.gridy = 0;
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.NORTH;
- panel.add(buttonpanel, c);
- c.anchor = GridBagConstraints.NORTH;
- c.fill = GridBagConstraints.BOTH;
- c.gridx = 1;
- c.gridy = 1;
- c.weighty = 2.0;
- panel.add(detailspanel, c);
- GridBagConstraints ct = new GridBagConstraints();
- ct.insets = new Insets(2, 2, 2, 2);
- ct.anchor = GridBagConstraints.PAGE_START;
- ct.fill = GridBagConstraints.BOTH;
- ct.weighty = 0.01;
- ct.gridx = 0;
- ct.gridy = 0;
- tablepanel.add(searchf, ct);
- ct.gridx = 1;
- tablepanel.add(searchb, ct);
- ct.weighty = 0.99;
- ct.gridx = 0;
- ct.gridy = 1;
- ct.gridwidth = 2;
- tablepanel.add(scrollPane, ct);
- }
- private void initMain() {
- // TODO Auto-generated method stub
- Dimension dimtab = new Dimension(450, 300);
- panel = new JPanel();
- tablepanel = new JPanel();
- detailspanel = new JPanel();
- buttonpanel = new JPanel();
- tabbedPane = new JTabbedPane();
- scrollPane = new JScrollPane();
- scrollPane.setPreferredSize(new Dimension(200, 200));
- aNamel = new JLabel("Name: ");
- aVornamel = new JLabel("Vorname: ");
- aStraßel = new JLabel("Straße: ");
- aHausnl = new JLabel("Hausnummer: ");
- aPlzl = new JLabel("Postleitzahl: ");
- aStadtl = new JLabel("Wohnort: ");
- aTätigkeitl = new JLabel("Tätigkeit: ");
- aGebdatuml = new JLabel("Geburtsdatum: ");
- aTelefonl = new JLabel("Telefonnummer: ");
- aDatuml = new JLabel("Datum: ");
- aNamef = new JTextField("", 10);
- aVornamef = new JTextField("", 10);
- aStraßef = new JTextField("", 15);
- aHausnf = new JTextField("", 3);
- aPlzf = new JTextField("", 10);
- aStadtf = new JTextField("", 15);
- aTätigkeitf = new JTextField("", 15);
- aGebdatumf = new JTextField("", 10);
- aTelefonf = new JTextField("", 15);
- aDatumf = new JTextField("", 10);
- htränen = new JLabel("Tränenmeniskus : ");
- hzusammensetzung = new JLabel("Tränenzusammensetzung : ");
- hbut = new JLabel("BUT/Schirmer");
- hlidspannung = new JLabel("Lidspannung : ");
- hbindehaut = new JLabel("Bindehaut : ");
- hlidschlag = new JLabel("Lidschlag : ");
- hlidschluss = new JLabel("Lidschluss : ");
- hpflege = new JLabel("Pflegemittel : ");
- hdatum = new JLabel("Datum : ");
- hwünsche = new JLabel("Vorgeschichte/Wünsche : ");
- hPflegefield = new JTextField("", 15);
- hdatumfield = new JTextField("", 15);
- hwünschef = new JTextArea(15, 15);
- searchf = new JTextField("", 10);
- searchb = new JButton("Suchen");
- table1 = new JTable();
- addb = new JButton("Hinzufügen");
- saveb = new JButton("Speichern");
- delb = new JButton("Löschen");
- refreshb = new JButton("Aktualisieren");
- allgemein = new JPanel();
- gläser = new JPanel();
- spUnters = new JPanel();
- hornhaut = new JPanel();
- bewertung = new JPanel();
- htränenbox = new JComboBox(tränen);
- hzusammensetzungbox = new JComboBox(zusammensetzung);
- hlidspannungbox = new JComboBox(lidspannung);
- hbindehautbox = new JComboBox(bindehaut);
- hlidschlagbox = new JComboBox(lidschlag);
- hlidschlussbox = new JComboBox(lidschluss);
- allgemein.setPreferredSize(dimtab);
- gläser.setPreferredSize(dimtab);
- spUnters.setPreferredSize(dimtab);
- hornhaut.setPreferredSize(dimtab);
- bewertung.setPreferredSize(dimtab);
- tablepanel.setLayout(new GridBagLayout());
- buttonpanel.setLayout(new FlowLayout());
- detailspanel.setLayout(new GridBagLayout());
- panel.setLayout(new GridBagLayout());
- splayout = new SpringLayout();
- hslayout = new SpringLayout();
- hornhaut.setLayout(hslayout);
- allgemein.setLayout(splayout);
- tablepanel.setBorder(BorderFactory.createBevelBorder(1));
- detailspanel.setBorder(BorderFactory.createBevelBorder(1));
- buttonpanel.setBorder(BorderFactory.createBevelBorder(1));
- }
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- }
- }
Add Comment
Please, Sign In to add comment