SHARE
TWEET

Untitled

a guest Feb 19th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main;
  2.  
  3. import java.awt.Dimension;
  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. import javax.swing.JMenu;
  11. import javax.swing.JMenuBar;
  12. import javax.swing.JMenuItem;
  13. import javax.swing.JPanel;
  14. import javax.swing.JTextField;
  15.  
  16. public class Aufg1 implements ActionListener{
  17.  
  18.     public Aufg1() {
  19.        
  20.         JFrame frame = new JFrame();
  21.         JPanel panel = new JPanel();
  22.  
  23.         //Menu
  24.         JMenuBar bar = new JMenuBar();
  25.         JMenu fileMenu = new JMenu("File");
  26.         JMenu aktionMenu = new JMenu("Aktion");
  27.         JMenuItem plusItem = new JMenuItem("plus");
  28.         JMenuItem minusItem = new JMenuItem("minus");
  29.        
  30.         aktionMenu.add(plusItem);
  31.         aktionMenu.add(minusItem);
  32.  
  33.         bar.add(fileMenu);
  34.         bar.add(aktionMenu);
  35.        
  36.         //Inhalt
  37.         panel.setPreferredSize(new Dimension(500, 500));
  38.         panel.add(new JLabel("Anzahl Striche: "));
  39.        
  40.         JTextField anzStricheFeld = new JTextField();
  41.         anzStricheFeld.setPreferredSize(new Dimension(100, 25));
  42.         panel.add(anzStricheFeld);
  43.        
  44.         JButton plusButton = new JButton("+");
  45.         JButton minusButton = new JButton("-");
  46.         JButton okButton = new JButton("OK");
  47.         panel.add(plusButton);
  48.         panel.add(minusButton);
  49.         panel.add(okButton);
  50.        
  51.         //Frame
  52.         frame.setJMenuBar(bar);
  53.         frame.setContentPane(panel);
  54.         frame.setVisible(true);
  55.         frame.pack();
  56.  
  57.     }
  58.  
  59.     public static void main(String[] args) {
  60.  
  61.         Aufg1 main = new Aufg1();
  62.     }
  63.  
  64.     @Override
  65.     public void actionPerformed(ActionEvent e) {
  66.         // TODO Auto-generated method stub
  67.        
  68.     }
  69.  
  70. }
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