Guest User

Untitled

a guest
May 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.63 KB | None | 0 0
  1. import java.awt.Container;
  2. import java.awt.GridBagConstraints;
  3. import java.awt.GridBagLayout;
  4.  
  5. import javax.swing.JButton;
  6. import javax.swing.JFrame;
  7. import javax.swing.JLabel;
  8. import javax.swing.JPanel;
  9. import javax.swing.JTabbedPane;
  10. import javax.swing.JTextField;
  11.  
  12. public class GUIFaktura extends JFrame {
  13.  
  14.     private JLabel lDebitorennummer;
  15.     private JLabel lNachname;
  16.     private JLabel lVorname;
  17.     private JLabel lStraße;
  18.     private JLabel lHausnummer;
  19.     private JLabel lPLZ;
  20.     private JLabel lOrt;
  21.     private JTextField tfDebitorennummer;
  22.     private JTextField tfNachname;
  23.     private JTextField tfVorname;
  24.     private JTextField tfStraße;
  25.     private JTextField tfHausnummer;
  26.     private JTextField tfPLZ;
  27.     private JTextField tfOrt;
  28.     private JButton bWeiter1;
  29.  
  30.     private JLabel lKassenzeichen;
  31.     private JLabel lSachbearbeiter;
  32.     private JLabel lFakturatext;
  33.     private JLabel lFälligkeit;
  34.     private JTextField tfKassenzeichen;
  35.     private JTextField tfSachbearbeiter;
  36.     private JTextField tfFakturatext;
  37.     private JTextField tfFälligkeit;
  38.     private JButton bAnzeigen;
  39.     private JButton bWeiter2;
  40.     private JButton bZurück1;
  41.  
  42.     private JLabel lArtikelbezeichnung;
  43.     private JLabel lBetrag;
  44.     private JLabel lAnzahl;
  45.     private JLabel lSumme;
  46.     private JTextField tfArtikelbezeichnung;
  47.     private JTextField tfBetrag;
  48.     private JTextField tfAnzahl;
  49.     private JTextField tfSumme;
  50.     private JButton bFertig;
  51.     private JButton bZurück2;
  52.  
  53.     public GUIFaktura() {
  54.  
  55.         this.setSize(800, 600); // Fenstergröße
  56.         this.setLocationRelativeTo(null); // für Tableiste
  57.         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // für Tableiste
  58.         this.setVisible(true); // Sichtbarkeit
  59.  
  60.         JTabbedPane tabLeiste = new JTabbedPane(); // erzeugt die Möglichkeit
  61.                                                     // von mehreren Blättern
  62.  
  63.         // Blatt 1: Debitor
  64.  
  65.         JPanel blatt1 = new JPanel(); // erzeugt Blatt1
  66.         tabLeiste.addTab("Debitor", blatt1); // Blattname und Blatt hinzugefügt
  67.        
  68.         blatt1.setLayout(new GridBagLayout()); // Layout-Manager
  69.         GridBagConstraints c = new GridBagConstraints(); // Bedingung
  70.  
  71.         lDebitorennummer = new JLabel("Debitorennummer:");
  72.         c.gridx = 0;
  73.         c.gridy = 0;
  74.         blatt1.add(lDebitorennummer, c);
  75.  
  76.         tfDebitorennummer = new JTextField(20);
  77.         c.gridx = 1;
  78.         c.gridy = 0;
  79.         blatt1.add(tfDebitorennummer, c);
  80.  
  81.         lNachname = new JLabel("Nachname:");
  82.         c.gridx = 0;
  83.         c.gridy = 1;
  84.         blatt1.add(lNachname, c);
  85.  
  86.         tfNachname = new JTextField(25);
  87.         c.gridx = 1;
  88.         c.gridy = 1;
  89.         blatt1.add(tfNachname, c);
  90.  
  91.         lVorname = new JLabel("Vorname:");
  92.         c.gridx = 0;
  93.         c.gridy = 2;
  94.         blatt1.add(lVorname, c);
  95.  
  96.         tfVorname = new JTextField(25);
  97.         c.gridx = 1;
  98.         c.gridy = 2;
  99.         blatt1.add(tfVorname, c);
  100.  
  101.         lStraße = new JLabel("Straße:");
  102.         c.gridx = 0;
  103.         c.gridy = 3;
  104.         blatt1.add(lStraße, c);
  105.  
  106.         tfStraße = new JTextField(25);
  107.         c.gridx = 1;
  108.         c.gridy = 3;
  109.         blatt1.add(tfStraße, c);
  110.  
  111.         lHausnummer = new JLabel("Hausnummer:");
  112.         c.gridx = 0;
  113.         c.gridy = 4;
  114.         blatt1.add(lHausnummer, c);
  115.  
  116.         tfHausnummer = new JTextField(25);
  117.         c.gridx = 1;
  118.         c.gridy = 4;
  119.         blatt1.add(tfHausnummer, c);
  120.  
  121.         lPLZ = new JLabel("PLZ:");
  122.         c.gridx = 0;
  123.         c.gridy = 5;
  124.         blatt1.add(lPLZ, c);
  125.  
  126.         tfPLZ = new JTextField(25);
  127.         c.gridx = 1;
  128.         c.gridy = 5;
  129.         blatt1.add(tfPLZ, c);
  130.  
  131.         lOrt = new JLabel("Ort:");
  132.         c.gridx = 0;
  133.         c.gridy = 6;
  134.         blatt1.add(lOrt, c);
  135.  
  136.         tfOrt = new JTextField(25);
  137.         c.gridx = 1;
  138.         c.gridy = 6;
  139.         blatt1.add(tfOrt, c);
  140.  
  141.         bWeiter1 = new JButton("Weiter");
  142.         c.gridx = 1;
  143.         c.gridy = 7;
  144.         blatt1.add(bWeiter1, c);
  145.  
  146.         // Blatt 2: Fakturakopf
  147.  
  148.         JPanel blatt2 = new JPanel(); // erzeugt Blatt2
  149.         tabLeiste.addTab("Fakturakopf", blatt2); // Blattname und Blatt
  150.                                                     // hinzugefügt
  151.  
  152.         blatt1.setLayout(new GridBagLayout()); // Layout-Manager
  153.         GridBagConstraints d = new GridBagConstraints(); // Bedingung
  154.  
  155.         lKassenzeichen = new JLabel(
  156.                 "Kassenzeichen (wird automatisch vergeben):");
  157.         d.gridx = 0;
  158.         d.gridy = 0;
  159.         blatt2.add(lKassenzeichen, d);
  160.  
  161.         tfKassenzeichen = new JTextField(25);
  162.         d.gridx = 1;
  163.         d.gridy = 0;
  164.         blatt2.add(tfKassenzeichen, d);
  165.  
  166.         lSachbearbeiter = new JLabel("Sachbearbeiter:");
  167.         d.gridx = 0;
  168.         d.gridy = 1;
  169.         blatt2.add(lSachbearbeiter, d);
  170.  
  171.         tfSachbearbeiter = new JTextField(25);
  172.         d.gridx = 1;
  173.         d.gridy = 1;
  174.         blatt2.add(tfSachbearbeiter, d);
  175.  
  176.         bAnzeigen = new JButton("Anzeigen");
  177.         d.gridx = 1;
  178.         d.gridy = 2;
  179.         blatt2.add(bAnzeigen, d);
  180.  
  181.         lFakturatext = new JLabel("Fakturatext:");
  182.         d.gridx = 0;
  183.         d.gridy = 3;
  184.         blatt2.add(lFakturatext, d);
  185.  
  186.         tfFakturatext = new JTextField(150);
  187.         d.gridx = 1;
  188.         d.gridy = 3;
  189.         blatt2.add(tfFakturatext, d);
  190.  
  191.         lFälligkeit = new JLabel("Fälligkeit:");
  192.         d.gridx = 0;
  193.         d.gridy = 4;
  194.         blatt2.add(lFälligkeit, d);
  195.  
  196.         tfFälligkeit = new JTextField(25);
  197.         d.gridx = 1;
  198.         d.gridy = 4;
  199.         blatt2.add(tfFälligkeit, d);
  200.  
  201.         bZurück1 = new JButton("Zurück");
  202.         d.gridx = 0;
  203.         d.gridy = 7;
  204.         blatt2.add(bZurück1, d);
  205.  
  206.         bWeiter2 = new JButton("Weiter");
  207.         d.gridx = 1;
  208.         d.gridy = 7;
  209.         blatt2.add(bWeiter2, d);
  210.  
  211.         // Blatt 3: Artikel
  212.  
  213.         JPanel blatt3 = new JPanel(); // erzeugt Blatt3
  214.         tabLeiste.addTab("Artikel", blatt3); // Blattname und Blatt hinzugefügt
  215.  
  216.         blatt1.setLayout(new GridBagLayout()); // Layout-Manager
  217.         GridBagConstraints e = new GridBagConstraints(); // Bedingung
  218.  
  219.         lArtikelbezeichnung = new JLabel("Artikelbezeichnung:");
  220.         e.gridx = 0;
  221.         e.gridy = 0;
  222.         blatt3.add(lArtikelbezeichnung, e);
  223.  
  224.         tfArtikelbezeichnung = new JTextField(25);
  225.         e.gridx = 1;
  226.         e.gridy = 0;
  227.         blatt3.add(tfArtikelbezeichnung, e);
  228.  
  229.         lBetrag = new JLabel("Betrag:");
  230.         e.gridx = 0;
  231.         e.gridy = 1;
  232.         blatt3.add(lBetrag, e);
  233.  
  234.         tfBetrag = new JTextField(25);
  235.         e.gridx = 1;
  236.         e.gridy = 1;
  237.         blatt3.add(tfBetrag, e);
  238.  
  239.         lAnzahl = new JLabel("Anzahl:");
  240.         e.gridx = 0;
  241.         e.gridy = 2;
  242.         blatt3.add(lAnzahl, e);
  243.  
  244.         tfAnzahl = new JTextField(25);
  245.         e.gridx = 1;
  246.         e.gridy = 2;
  247.         blatt3.add(tfAnzahl, e);
  248.  
  249.         lSumme = new JLabel("Summe (automatische Ausgabe):");
  250.         e.gridx = 0;
  251.         e.gridy = 3;
  252.         blatt3.add(lSumme, e);
  253.  
  254.         tfSumme = new JTextField(25);
  255.         e.gridx = 1;
  256.         e.gridy = 3;
  257.         blatt3.add(tfSumme, e);
  258.  
  259.         bZurück2 = new JButton("Zurück");
  260.         e.gridx = 0;
  261.         e.gridy = 7;
  262.         blatt3.add(bZurück2, e);
  263.  
  264.         bFertig = new JButton("Fertig");
  265.         e.gridx = 1;
  266.         e.gridy = 7;
  267.         blatt3.add(bFertig, e);
  268.  
  269.         // Blatt 4: Ausgabe
  270.  
  271.         JPanel blatt4 = new JPanel(); // erzeugt Blatt4
  272.         tabLeiste.addTab("Ausgabe", blatt4); // Blattname und Blatt hinzugefügt
  273.  
  274.         this.add(tabLeiste); // Hinzufügen der Tableiste zu Fenster
  275.  
  276.     }
  277.  
  278.     public static void main(String[] args) {
  279.  
  280.         GUIFaktura window = new GUIFaktura();
  281.  
  282.     }
  283.  
  284. }
Add Comment
Please, Sign In to add comment