Advertisement
Guest User

JLabel wird nicht angezeigt

a guest
Oct 21st, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.56 KB | None | 0 0
  1. package Sortieren;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.Panel;
  6. import java.awt.event.ActionEvent;
  7. import java.awt.event.ActionListener;
  8.  
  9. import javax.swing.JButton;
  10. import javax.swing.JFrame;
  11. import javax.swing.JLabel;
  12. import javax.swing.JScrollPane;
  13. import javax.swing.JTextArea;
  14. import javax.swing.JTextField;
  15. import javax.swing.ScrollPaneConstants;
  16.  
  17. public class FrameMenue {
  18.    
  19.     JTextArea jTextAreaAusgabe;
  20.     JScrollPane jScrollPaneAusgabe;
  21.    
  22.     JButton jButtonSchliessen;
  23.     JButton jButtonGenerieren;
  24.     JButton jButtonSortieren;
  25.    
  26.     JButton jButtonAnnehmen;
  27.     JLabel jLabelAnzahl;
  28.     JLabel jLabelMax;
  29.     JLabel jLabelTZ;
  30.     JLabel jLabelVZ;
  31.    
  32.     JTextField jTextFieldAnzahl;
  33.     JTextField jTextFieldMax;
  34.     JTextField jTextFieldTZ;
  35.     JTextField jTextFieldVZ;
  36.    
  37.    
  38.    
  39.    
  40.    
  41.     public FrameMenue(){
  42.        
  43.         JFrame hf = new JFrame("Titel");                        //hf = Hauptfenster
  44.         hf.setSize(675, 400);
  45.         hf.setResizable(false);
  46.         hf.setLayout(null);
  47.         hf.setVisible(true);
  48.         hf.setDefaultCloseOperation(hf.EXIT_ON_CLOSE);
  49.         hf.setLayout(null);
  50.        
  51.        
  52.         jButtonSchliessen = new JButton("Schliessen");
  53.         jButtonSchliessen.setBounds(560, 340, 100, 25);
  54.         jButtonSchliessen.setFont(new Font ("Arial", Font.BOLD, 12));
  55.         jButtonSchliessen.setBackground(Color.LIGHT_GRAY);
  56.         jButtonSchliessen.addActionListener(new java.awt.event.ActionListener(){
  57.             public void actionPerformed(java.awt.event.ActionEvent e){
  58.                 System.exit(0);
  59.             }
  60.         });
  61.         hf.add(jButtonSchliessen);
  62.        
  63.         jTextAreaAusgabe = new JTextArea("");
  64.         jScrollPaneAusgabe = new JScrollPane(jTextAreaAusgabe);
  65.         jScrollPaneAusgabe.setBounds(0, 0, 200, 370);
  66.         jScrollPaneAusgabe.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
  67.         jScrollPaneAusgabe.setViewportView(jTextAreaAusgabe);
  68.         hf.getContentPane().add(jScrollPaneAusgabe);
  69.        
  70.        
  71.         jButtonGenerieren = new JButton("Zahlen Generieren");
  72.         jButtonGenerieren.setBounds(225, 10, 150, 25);
  73.         jButtonGenerieren.setFont(new Font ("Arial", Font.PLAIN, 12));
  74.         hf.add(jButtonGenerieren);
  75.        
  76.         jButtonSortieren = new JButton("Sortieren");
  77.         jButtonSortieren.setBounds(225, 60, 150, 25);
  78.         jButtonSortieren.setFont(new Font ("Arial", Font.PLAIN, 12));
  79.         hf.add(jButtonSortieren);
  80.        
  81.         jLabelAnzahl = new JLabel("Anzahl der Zahlen:");
  82.         jLabelAnzahl.setText("Test");
  83.         jLabelAnzahl.setBounds(400, 10, 180, 25);
  84.         jLabelAnzahl.setFont(new Font("Arial", Font.PLAIN, 12));
  85.         jLabelAnzahl.setBackground( Color.black );
  86.         jLabelAnzahl.setVisible(true);
  87.        
  88.         hf.add(jLabelAnzahl);
  89.        
  90.        
  91.        
  92.        
  93.        
  94.     }
  95.    
  96.    
  97.    
  98.    
  99.    
  100.    
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement