daily pastebin goal
73%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package database;
  2.  
  3. import java.awt.Dimension;
  4. import java.awt.FlowLayout;
  5. import java.awt.GridBagConstraints;
  6. import java.awt.GridBagLayout;
  7. import java.awt.Insets;
  8. import java.awt.event.ActionEvent;
  9. import java.awt.event.ActionListener;
  10.  
  11. import javax.swing.BorderFactory;
  12. import javax.swing.JButton;
  13. import javax.swing.JComboBox;
  14. import javax.swing.JFrame;
  15. import javax.swing.JLabel;
  16. import javax.swing.JPanel;
  17. import javax.swing.JScrollPane;
  18. import javax.swing.JTabbedPane;
  19. import javax.swing.JTable;
  20. import javax.swing.JTextArea;
  21. import javax.swing.JTextField;
  22. import javax.swing.SpringLayout;
  23.  
  24. /**
  25.  * @author styx
  26.  *
  27.  */
  28. public class MainForm extends JFrame implements ActionListener {
  29.  
  30.     private JPanel panel, tablepanel, buttonpanel, detailspanel, gläser,
  31.             spUnters, hornhaut, bewertung, allgemein;
  32.     private JTable table1;
  33.     private JButton searchb, addb, saveb, delb, refreshb;
  34.     private JTextField searchf, aNamef, aVornamef, aStraßef, aHausnf, aPlzf,
  35.             aStadtf, aTätigkeitf, aGebdatumf, aTelefonf, aDatumf, hPflegefield,
  36.             hdatumfield;
  37.     private JTextArea hwünschef;
  38.     private JTabbedPane tabbedPane;
  39.     private JScrollPane scrollPane;
  40.     private JLabel aNamel, aVornamel, aStraßel, aHausnl, aPlzl, aStadtl,
  41.             aTätigkeitl, aGebdatuml, aTelefonl, aDatuml, htränen,
  42.             hzusammensetzung, hbut, hlidspannung, hbindehaut, hlidschlag,
  43.             hlidschluss, hpflege, hdatum, hwünsche;
  44.     private SpringLayout splayout, hslayout;
  45.     private JComboBox htränenbox, hzusammensetzungbox, hlidspannungbox,
  46.             hbindehautbox, hlidschlagbox, hlidschlussbox;
  47.     private final String[] tränen = { "<0.2", "~0.2", ">0.2" },
  48.             zusammensetzung = { "wässrig", "normal", "ölig-viskos" },
  49.             lidspannung = { "schwach", "normal", "stark" }, bindehaut = {
  50.                     "locker", "normal", "fest" }, lidschlag = { "selten",
  51.                     "normal", "häufig" }, lidschluss = { "komplett",
  52.                     "inkomplett" };
  53.  
  54.     public MainForm() {
  55.         super("Client Manager");
  56.         initMain();
  57.         initGridBag();
  58.         initSpingLay();
  59.  
  60.         scrollPane.add(table1);
  61.  
  62.         tabbedPane.addTab("Allgemein", allgemein);
  63.         tabbedPane.addTab("Gläser", gläser);
  64.         tabbedPane.addTab("Spaltuntersuchung", spUnters);
  65.         tabbedPane.addTab("Horhaut", new JScrollPane(hornhaut));
  66.         tabbedPane.addTab("Bewertung", bewertung);
  67.  
  68.         detailspanel.add(tabbedPane);
  69.  
  70.         buttonpanel.add(addb);
  71.         buttonpanel.add(saveb);
  72.         buttonpanel.add(delb);
  73.         buttonpanel.add(refreshb);
  74.  
  75.         setContentPane(panel);
  76.     }
  77.  
  78.     private void initSpingLay() {
  79.         // TODO Auto-generated method stub
  80.         allgemein.add(aVornamel);
  81.         allgemein.add(aVornamef);
  82.         allgemein.add(aNamel);
  83.         allgemein.add(aNamef);
  84.         allgemein.add(aStraßel);
  85.         allgemein.add(aStraßef);
  86.         allgemein.add(aHausnf);
  87.         allgemein.add(aHausnl);
  88.         allgemein.add(aPlzf);
  89.         allgemein.add(aPlzl);
  90.         allgemein.add(aStadtf);
  91.         allgemein.add(aStadtl);
  92.         allgemein.add(aTätigkeitf);
  93.         allgemein.add(aTätigkeitl);
  94.         allgemein.add(aTelefonf);
  95.         allgemein.add(aTelefonl);
  96.         allgemein.add(aGebdatumf);
  97.         allgemein.add(aGebdatuml);
  98.         allgemein.add(aDatumf);
  99.         allgemein.add(aDatuml);
  100.  
  101.         splayout.putConstraint(SpringLayout.WEST, aVornamel, 15,
  102.                 SpringLayout.WEST, allgemein);
  103.         splayout.putConstraint(SpringLayout.NORTH, aVornamel, 15,
  104.                 SpringLayout.NORTH, allgemein);
  105.         splayout.putConstraint(SpringLayout.WEST, aVornamef, 5,
  106.                 SpringLayout.EAST, aTelefonl);
  107.         splayout.putConstraint(SpringLayout.NORTH, aVornamef, 15,
  108.                 SpringLayout.NORTH, allgemein);
  109.  
  110.         splayout.putConstraint(SpringLayout.WEST, aNamel, 0, SpringLayout.WEST,
  111.                 aVornamel);
  112.         splayout.putConstraint(SpringLayout.WEST, aNamef, 0, SpringLayout.WEST,
  113.                 aVornamef);
  114.         splayout.putConstraint(SpringLayout.NORTH, aNamel, 5,
  115.                 SpringLayout.SOUTH, aVornamef);
  116.         splayout.putConstraint(SpringLayout.NORTH, aNamef, 5,
  117.                 SpringLayout.SOUTH, aVornamef);
  118.  
  119.         splayout.putConstraint(SpringLayout.WEST, aStraßel, 0,
  120.                 SpringLayout.WEST, aNamel);
  121.         splayout.putConstraint(SpringLayout.WEST, aStraßef, 0,
  122.                 SpringLayout.WEST, aNamef);
  123.         splayout.putConstraint(SpringLayout.NORTH, aStraßel, 5,
  124.                 SpringLayout.SOUTH, aNamef);
  125.         splayout.putConstraint(SpringLayout.NORTH, aStraßef, 5,
  126.                 SpringLayout.SOUTH, aNamef);
  127.  
  128.         splayout.putConstraint(SpringLayout.WEST, aHausnl, 0,
  129.                 SpringLayout.WEST, aStraßel);
  130.         splayout.putConstraint(SpringLayout.WEST, aHausnf, 0,
  131.                 SpringLayout.WEST, aStraßef);
  132.         splayout.putConstraint(SpringLayout.NORTH, aHausnl, 5,
  133.                 SpringLayout.SOUTH, aStraßef);
  134.         splayout.putConstraint(SpringLayout.NORTH, aHausnf, 5,
  135.                 SpringLayout.SOUTH, aStraßef);
  136.  
  137.         splayout.putConstraint(SpringLayout.WEST, aPlzl, 0, SpringLayout.WEST,
  138.                 aHausnl);
  139.         splayout.putConstraint(SpringLayout.WEST, aPlzf, 0, SpringLayout.WEST,
  140.                 aHausnf);
  141.         splayout.putConstraint(SpringLayout.NORTH, aPlzl, 5,
  142.                 SpringLayout.SOUTH, aHausnf);
  143.         splayout.putConstraint(SpringLayout.NORTH, aPlzf, 5,
  144.                 SpringLayout.SOUTH, aHausnf);
  145.  
  146.         splayout.putConstraint(SpringLayout.WEST, aStadtl, 0,
  147.                 SpringLayout.WEST, aPlzl);
  148.         splayout.putConstraint(SpringLayout.WEST, aStadtf, 0,
  149.                 SpringLayout.WEST, aPlzf);
  150.         splayout.putConstraint(SpringLayout.NORTH, aStadtl, 5,
  151.                 SpringLayout.SOUTH, aPlzf);
  152.         splayout.putConstraint(SpringLayout.NORTH, aStadtf, 5,
  153.                 SpringLayout.SOUTH, aPlzf);
  154.  
  155.         splayout.putConstraint(SpringLayout.WEST, aTätigkeitl, 0,
  156.                 SpringLayout.WEST, aStadtl);
  157.         splayout.putConstraint(SpringLayout.WEST, aTätigkeitf, 0,
  158.                 SpringLayout.WEST, aStadtf);
  159.         splayout.putConstraint(SpringLayout.NORTH, aTätigkeitl, 5,
  160.                 SpringLayout.SOUTH, aStadtf);
  161.         splayout.putConstraint(SpringLayout.NORTH, aTätigkeitf, 5,
  162.                 SpringLayout.SOUTH, aStadtf);
  163.  
  164.         splayout.putConstraint(SpringLayout.WEST, aTelefonl, 0,
  165.                 SpringLayout.WEST, aTätigkeitl);
  166.         splayout.putConstraint(SpringLayout.WEST, aTelefonf, 0,
  167.                 SpringLayout.WEST, aTätigkeitf);
  168.         splayout.putConstraint(SpringLayout.NORTH, aTelefonl, 5,
  169.                 SpringLayout.SOUTH, aTätigkeitf);
  170.         splayout.putConstraint(SpringLayout.NORTH, aTelefonf, 5,
  171.                 SpringLayout.SOUTH, aTätigkeitf);
  172.  
  173.         splayout.putConstraint(SpringLayout.WEST, aGebdatuml, 0,
  174.                 SpringLayout.WEST, aTelefonl);
  175.         splayout.putConstraint(SpringLayout.WEST, aGebdatumf, 0,
  176.                 SpringLayout.WEST, aTelefonf);
  177.         splayout.putConstraint(SpringLayout.NORTH, aGebdatuml, 5,
  178.                 SpringLayout.SOUTH, aTelefonf);
  179.         splayout.putConstraint(SpringLayout.NORTH, aGebdatumf, 5,
  180.                 SpringLayout.SOUTH, aTelefonf);
  181.  
  182.         splayout.putConstraint(SpringLayout.WEST, aDatuml, 0,
  183.                 SpringLayout.WEST, aGebdatuml);
  184.         splayout.putConstraint(SpringLayout.WEST, aDatumf, 0,
  185.                 SpringLayout.WEST, aGebdatumf);
  186.         splayout.putConstraint(SpringLayout.NORTH, aDatuml, 5,
  187.                 SpringLayout.SOUTH, aGebdatumf);
  188.         splayout.putConstraint(SpringLayout.NORTH, aDatumf, 5,
  189.                 SpringLayout.SOUTH, aGebdatumf);
  190.  
  191.         hornhaut.add(htränen);
  192.         hornhaut.add(hzusammensetzung);
  193.         hornhaut.add(hbut);
  194.         hornhaut.add(hlidspannung);
  195.         hornhaut.add(hbindehaut);
  196.         hornhaut.add(hlidschlag);
  197.         hornhaut.add(hlidschluss);
  198.         hornhaut.add(hpflege);
  199.         hornhaut.add(hPflegefield);
  200.         hornhaut.add(hwünsche);
  201.         hornhaut.add(hwünschef);
  202.         hornhaut.add(htränenbox);
  203.         hornhaut.add(hzusammensetzungbox);
  204.         hornhaut.add(hlidspannungbox);
  205.         hornhaut.add(hbindehautbox);
  206.         hornhaut.add(hlidschlagbox);
  207.         hornhaut.add(hlidschlussbox);
  208.         hornhaut.add(hdatum);
  209.         hornhaut.add(hdatumfield);
  210.  
  211.         hslayout.putConstraint(SpringLayout.WEST, htränen, 15,
  212.                 SpringLayout.WEST, hornhaut);
  213.         hslayout.putConstraint(SpringLayout.NORTH, htränen, 15,
  214.                 SpringLayout.NORTH, hornhaut);
  215.  
  216.         hslayout.putConstraint(SpringLayout.WEST, hzusammensetzung, 0,
  217.                 SpringLayout.WEST, htränen);
  218.         hslayout.putConstraint(SpringLayout.NORTH, hzusammensetzung, 15,
  219.                 SpringLayout.SOUTH, htränen);
  220.  
  221.         hslayout.putConstraint(SpringLayout.WEST, hbut, 0, SpringLayout.WEST,
  222.                 hzusammensetzung);
  223.         hslayout.putConstraint(SpringLayout.NORTH, hbut, 30,
  224.                 SpringLayout.SOUTH, hzusammensetzung);
  225.  
  226.         hslayout.putConstraint(SpringLayout.WEST, hlidspannung, 0,
  227.                 SpringLayout.WEST, hbut);
  228.         hslayout.putConstraint(SpringLayout.NORTH, hlidspannung, 15,
  229.                 SpringLayout.SOUTH, hbut);
  230.  
  231.         hslayout.putConstraint(SpringLayout.WEST, hbindehaut, 0,
  232.                 SpringLayout.WEST, hlidspannung);
  233.         hslayout.putConstraint(SpringLayout.NORTH, hbindehaut, 15,
  234.                 SpringLayout.SOUTH, hlidspannung);
  235.  
  236.         hslayout.putConstraint(SpringLayout.WEST, hlidschlag, 0,
  237.                 SpringLayout.WEST, hbindehaut);
  238.         hslayout.putConstraint(SpringLayout.NORTH, hlidschlag, 15,
  239.                 SpringLayout.SOUTH, hbindehaut);
  240.  
  241.         hslayout.putConstraint(SpringLayout.WEST, hlidschluss, 0,
  242.                 SpringLayout.WEST, hlidschlag);
  243.         hslayout.putConstraint(SpringLayout.NORTH, hlidschluss, 15,
  244.                 SpringLayout.SOUTH, hlidschlag);
  245.  
  246.         hslayout.putConstraint(SpringLayout.WEST, hpflege, 0,
  247.                 SpringLayout.WEST, hlidschluss);
  248.         hslayout.putConstraint(SpringLayout.NORTH, hpflege, 30,
  249.                 SpringLayout.SOUTH, hlidschluss);
  250.  
  251.         hslayout.putConstraint(SpringLayout.WEST, hPflegefield, 0,
  252.                 SpringLayout.WEST, hpflege);
  253.         hslayout.putConstraint(SpringLayout.NORTH, hPflegefield, 15,
  254.                 SpringLayout.SOUTH, hpflege);
  255.  
  256.         hslayout.putConstraint(SpringLayout.WEST, hwünsche, 0,
  257.                 SpringLayout.WEST, hPflegefield);
  258.         hslayout.putConstraint(SpringLayout.NORTH, hwünsche, 15,
  259.                 SpringLayout.SOUTH, hPflegefield);
  260.  
  261.         hslayout.putConstraint(SpringLayout.WEST, hwünschef, 0,
  262.                 SpringLayout.WEST, hwünsche);
  263.         hslayout.putConstraint(SpringLayout.NORTH, hwünschef, 15,
  264.                 SpringLayout.SOUTH, hwünsche);
  265.  
  266.         hslayout.putConstraint(SpringLayout.WEST, htränenbox, 15,
  267.                 SpringLayout.EAST, hzusammensetzung);
  268.         hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, htränenbox, 0,
  269.                 SpringLayout.VERTICAL_CENTER, htränen);
  270.  
  271.         hslayout.putConstraint(SpringLayout.WEST, hzusammensetzungbox, 15,
  272.                 SpringLayout.EAST, hzusammensetzung);
  273.         hslayout.putConstraint(SpringLayout.VERTICAL_CENTER,
  274.                 hzusammensetzungbox, 0, SpringLayout.VERTICAL_CENTER,
  275.                 hzusammensetzung);
  276.  
  277.         hslayout.putConstraint(SpringLayout.WEST, hlidspannungbox, 15,
  278.                 SpringLayout.EAST, hzusammensetzung);
  279.         hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, hlidspannungbox,
  280.                 0, SpringLayout.VERTICAL_CENTER, hlidspannung);
  281.  
  282.         hslayout.putConstraint(SpringLayout.WEST, hbindehautbox, 15,
  283.                 SpringLayout.EAST, hzusammensetzung);
  284.         hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, hbindehautbox, 0,
  285.                 SpringLayout.VERTICAL_CENTER, hbindehaut);
  286.  
  287.         hslayout.putConstraint(SpringLayout.WEST, hlidschlagbox, 15,
  288.                 SpringLayout.EAST, hzusammensetzung);
  289.         hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, hlidschlagbox, 0,
  290.                 SpringLayout.VERTICAL_CENTER, hlidschlag);
  291.  
  292.         hslayout.putConstraint(SpringLayout.WEST, hlidschlussbox, 15,
  293.                 SpringLayout.EAST, hzusammensetzung);
  294.         hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, hlidschlussbox, 0,
  295.                 SpringLayout.VERTICAL_CENTER, hlidschluss);
  296.  
  297.         hslayout.putConstraint(SpringLayout.WEST, hdatum, 15,
  298.                 SpringLayout.EAST, hzusammensetzung);
  299.         hslayout.putConstraint(SpringLayout.VERTICAL_CENTER, hdatum, 0,
  300.                 SpringLayout.VERTICAL_CENTER, hpflege);
  301.  
  302.         hslayout.putConstraint(SpringLayout.WEST, hdatumfield, 15,
  303.                 SpringLayout.EAST, hzusammensetzung);
  304.         hslayout.putConstraint(SpringLayout.NORTH, hdatumfield, 15,
  305.                 SpringLayout.SOUTH, hdatum);
  306.     }
  307.  
  308.     private void initGridBag() {
  309.         // TODO Auto-generated method stub
  310.         GridBagConstraints c = new GridBagConstraints();
  311.         c.fill = GridBagConstraints.BOTH;
  312.         c.insets = new Insets(2, 2, 2, 2);
  313.         c.gridx = 0;
  314.         c.gridy = 0;
  315.         c.gridheight = 2;
  316.         c.weighty = 1.0;
  317.         panel.add(tablepanel, c);
  318.         c.gridheight = 1;
  319.         c.gridx = 1;
  320.         c.gridy = 0;
  321.         c.fill = GridBagConstraints.NONE;
  322.         c.anchor = GridBagConstraints.NORTH;
  323.         panel.add(buttonpanel, c);
  324.         c.anchor = GridBagConstraints.NORTH;
  325.         c.fill = GridBagConstraints.BOTH;
  326.         c.gridx = 1;
  327.         c.gridy = 1;
  328.         c.weighty = 2.0;
  329.         panel.add(detailspanel, c);
  330.  
  331.         GridBagConstraints ct = new GridBagConstraints();
  332.         ct.insets = new Insets(2, 2, 2, 2);
  333.         ct.anchor = GridBagConstraints.PAGE_START;
  334.         ct.fill = GridBagConstraints.BOTH;
  335.         ct.weighty = 0.01;
  336.         ct.gridx = 0;
  337.         ct.gridy = 0;
  338.         tablepanel.add(searchf, ct);
  339.         ct.gridx = 1;
  340.         tablepanel.add(searchb, ct);
  341.         ct.weighty = 0.99;
  342.         ct.gridx = 0;
  343.         ct.gridy = 1;
  344.         ct.gridwidth = 2;
  345.         tablepanel.add(scrollPane, ct);
  346.     }
  347.  
  348.     private void initMain() {
  349.         // TODO Auto-generated method stub
  350.         Dimension dimtab = new Dimension(450, 300);
  351.         panel = new JPanel();
  352.         tablepanel = new JPanel();
  353.         detailspanel = new JPanel();
  354.         buttonpanel = new JPanel();
  355.         tabbedPane = new JTabbedPane();
  356.         scrollPane = new JScrollPane();
  357.         scrollPane.setPreferredSize(new Dimension(200, 200));
  358.  
  359.         aNamel = new JLabel("Name: ");
  360.         aVornamel = new JLabel("Vorname: ");
  361.         aStraßel = new JLabel("Straße: ");
  362.         aHausnl = new JLabel("Hausnummer: ");
  363.         aPlzl = new JLabel("Postleitzahl: ");
  364.         aStadtl = new JLabel("Wohnort: ");
  365.         aTätigkeitl = new JLabel("Tätigkeit: ");
  366.         aGebdatuml = new JLabel("Geburtsdatum: ");
  367.         aTelefonl = new JLabel("Telefonnummer: ");
  368.         aDatuml = new JLabel("Datum: ");
  369.  
  370.         aNamef = new JTextField("", 10);
  371.         aVornamef = new JTextField("", 10);
  372.         aStraßef = new JTextField("", 15);
  373.         aHausnf = new JTextField("", 3);
  374.         aPlzf = new JTextField("", 10);
  375.         aStadtf = new JTextField("", 15);
  376.         aTätigkeitf = new JTextField("", 15);
  377.         aGebdatumf = new JTextField("", 10);
  378.         aTelefonf = new JTextField("", 15);
  379.         aDatumf = new JTextField("", 10);
  380.  
  381.         htränen = new JLabel("Tränenmeniskus : ");
  382.         hzusammensetzung = new JLabel("Tränenzusammensetzung : ");
  383.         hbut = new JLabel("BUT/Schirmer");
  384.         hlidspannung = new JLabel("Lidspannung : ");
  385.         hbindehaut = new JLabel("Bindehaut : ");
  386.         hlidschlag = new JLabel("Lidschlag : ");
  387.         hlidschluss = new JLabel("Lidschluss : ");
  388.         hpflege = new JLabel("Pflegemittel : ");
  389.         hdatum = new JLabel("Datum : ");
  390.         hwünsche = new JLabel("Vorgeschichte/Wünsche : ");
  391.  
  392.         hPflegefield = new JTextField("", 15);
  393.         hdatumfield = new JTextField("", 15);
  394.         hwünschef = new JTextArea(15, 15);
  395.  
  396.         searchf = new JTextField("", 10);
  397.         searchb = new JButton("Suchen");
  398.         table1 = new JTable();
  399.         addb = new JButton("Hinzufügen");
  400.         saveb = new JButton("Speichern");
  401.         delb = new JButton("Löschen");
  402.         refreshb = new JButton("Aktualisieren");
  403.  
  404.         allgemein = new JPanel();
  405.         gläser = new JPanel();
  406.         spUnters = new JPanel();
  407.         hornhaut = new JPanel();
  408.         bewertung = new JPanel();
  409.  
  410.         htränenbox = new JComboBox(tränen);
  411.         hzusammensetzungbox = new JComboBox(zusammensetzung);
  412.         hlidspannungbox = new JComboBox(lidspannung);
  413.         hbindehautbox = new JComboBox(bindehaut);
  414.         hlidschlagbox = new JComboBox(lidschlag);
  415.         hlidschlussbox = new JComboBox(lidschluss);
  416.  
  417.         allgemein.setPreferredSize(dimtab);
  418.         gläser.setPreferredSize(dimtab);
  419.         spUnters.setPreferredSize(dimtab);
  420.         hornhaut.setPreferredSize(dimtab);
  421.         bewertung.setPreferredSize(dimtab);
  422.  
  423.         tablepanel.setLayout(new GridBagLayout());
  424.         buttonpanel.setLayout(new FlowLayout());
  425.         detailspanel.setLayout(new GridBagLayout());
  426.         panel.setLayout(new GridBagLayout());
  427.         splayout = new SpringLayout();
  428.         hslayout = new SpringLayout();
  429.         hornhaut.setLayout(hslayout);
  430.         allgemein.setLayout(splayout);
  431.  
  432.         tablepanel.setBorder(BorderFactory.createBevelBorder(1));
  433.         detailspanel.setBorder(BorderFactory.createBevelBorder(1));
  434.         buttonpanel.setBorder(BorderFactory.createBevelBorder(1));
  435.     }
  436.  
  437.     public void actionPerformed(ActionEvent e) {
  438.         // TODO Auto-generated method stub
  439.  
  440.     }
  441. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top