Advertisement
Wood14Mine

GUI

Oct 30th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. package me.wood14mine.gui;
  2.  
  3. import java.awt.Font;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6.  
  7. import javax.swing.JButton;
  8. import javax.swing.JFrame;
  9. import javax.swing.JLabel;
  10.  
  11. public class GUI extends JFrame {
  12.     JLabel Text1;
  13.     static JLabel Text2;
  14.     static JLabel TextN;
  15.     static JButton btn1;
  16.     static JButton btn2;
  17.    
  18.     public GUI() {
  19.         setLayout(null);
  20.         setSize(1200,700);
  21.         setTitle("ACP by Wood14Mine");
  22.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  23.        
  24.         Text1 = new JLabel("ACP | by Wood14Mine");
  25.         Text1.setBounds(50, 2, 400, 100);
  26.         Font schriftart = new Font("Arial", Font.PLAIN, 30);
  27.         Text1.setFont(schriftart);
  28.         add(Text1);
  29.        
  30.         Text2 = new JLabel("Du bist angemeldet als:");
  31.         Text2.setBounds(800, 2, 400, 100);
  32.         Font schriftart1 = new Font("Arial", Font.PLAIN, 15);
  33.         Text2.setFont(schriftart1);
  34.         add(Text2);
  35.        
  36.         TextN = new JLabel("Wood14Mine");
  37.         TextN.setBounds(955, 2, 400, 100);
  38.         Font schriftart2 = new Font("Arial", Font.PLAIN, 15);
  39.         TextN.setFont(schriftart2);
  40.         TextN.setVisible(false);
  41.         add(TextN);
  42.        
  43.         btn1 = new JButton("Login");
  44.         btn1.setBounds(50, 625, 125, 20);
  45.         btn1.addActionListener(new ActionLogin());
  46.         add(btn1);
  47.        
  48.         btn2 = new JButton("Beenden");
  49.         btn2.setBounds(1025, 625, 125, 20);
  50.         btn2.addActionListener(new ActionClose());
  51.         add(btn2);
  52.        
  53.        
  54.     }
  55.    
  56.  
  57.     static class ActionClose implements ActionListener {
  58.        
  59.         public void actionPerformed(ActionEvent e) {
  60.             if (e.getSource() == btn2) {
  61.                 System.exit(0);
  62.             }
  63.         }
  64.     }
  65.    
  66.     static class ActionLogin implements ActionListener {
  67.        
  68.         public void actionPerformed(ActionEvent e) {
  69.             if (e.getSource() == btn1) {
  70.                 JFrame GUILogin = new GUILogin();
  71.                 GUILogin.setVisible(true);
  72.             }
  73.         }
  74.     }
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement