Advertisement
Guest User

Untitled

a guest
May 25th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. /*Beispiel mit Programmfenster
  2. */
  3.  
  4. import java.awt.*;
  5. import javax.swing.*;
  6.  
  7. public class GrussMitProgrammfenster extends JFrame {
  8. public GrussMitProgrammfenster() {
  9. super("Hallo");
  10.  
  11. Icon icon = new ImageIcon("java-uebung1.png");
  12. JLabel label1 = new JLabel("Viel Erfolg beim", JLabel.CENTER);
  13. JLabel label2 = new JLabel("Programmieren mit Java!", JLabel.CENTER);
  14. JLabel label3 = new JLabel(icon);
  15. Font schrift = new Font("SansSerif", Font.BOLD, 24);
  16. label1.setFont(schrift);
  17. label1.setForeground(Color.red);
  18. label2.setFont(schrift);
  19. label2.setForeground(Color.red);
  20. Container c = getContentPane();
  21. c.setLayout(new FlowLayout());
  22. c.setBackground(Color.white);
  23. c.add(label1);
  24. c.add(label2);
  25. c.add(label3);
  26. setDefaultCloseOperation(EXIT_ON_CLOSE);
  27. setSize(350,250);
  28. setVisible(true);
  29. }
  30.  
  31. public static void main(String [] args) {
  32. new GrussMitProgrammfenster();
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement