Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

© 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 1 Zum JFrame Step by step by step by step by step by step by step by step by.

Ähnliche Präsentationen


Präsentation zum Thema: "© 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 1 Zum JFrame Step by step by step by step by step by step by step by step by."—  Präsentation transkript:

1 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 1 Zum JFrame Step by step by step by step by step by step by step by step by

2 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 2 step 1 public class HalloWelt2{ public static void main(String[] args){ }

3 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 3 step 2 public class HalloWelt2{ public HalloWelt2(){ } public static void main(String[] args){ } Mit Konstruktor, wird aber nicht aufgerufen

4 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 4 Step 3 public class HalloWelt2{ public HalloWelt2(){ } public static void main(String[] args){ new HalloWelt2(); } Konstruktor wird aufgerufen

5 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 5 Step 4 import javax.swing.*; public class HaloWelt2 extends JFrame{ public HalloWelt2(){ } public static void main(String[] args){ new HalloWelt2(); } Man sieht aber nichts!

6 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 6 Step 5 import javax.swing.*; public class HalloWelt2 extends JFrame{ public HalloWelt2(){ setVisible(true); } public static void main(String[] args){ new HaloWelt2(); } Bilderrahmen hat keinen Titel und das Objekt existiert noch, auch wenn es weggeklickt wird.

7 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 7 step 6 import javax.swing.*; public class HalloWelt2 extends JFrame{ public HalloWlet2(String titel){ setVisible(true); } public static void main(String[] args){ new HalloWelt2("Ich bin ein JFrame-Objekt"); }

8 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 8 step 7 import javax.swing.*; public class HalloWelt2 extends JFrame{ public HalloWelt2(String titel){ super(titel); setVisible(true); } public static void main(String[] args){ new HalloWelt2("Ich bin ein JFrame-Objekt"); }

9 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 9 step 8 import javax.swing.*; import java.awt.event.*; public class HalloWelt2 extends JFrame{ public HalloWelt2(String titel){ super(titel); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){ new HalloWelt2("Ich bin ein JFrame-Objekt"); } Jetzt hört das JFrame-Objekt auf zu "existieren", wenn man es wegklickt.

10 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 10 step 9 import javax.swing.*; import java.awt.event.*; public class HalloWelt2 extends JFrame{ public HalloWelt2(String titel){ super(titel); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(300, 300); setVisible(true); } public static void main(String[] args){ new HalloWelt2("Ich bin ein JFrame-Objekt"); } Das JFrame-Objekt hat jetzt von Anfang an eine vernünftige Größe.

11 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 11 step 10 import javax.swing.*; import java.awt.event.*; import java.awt.*; public class HalloWelt2 extends JFrame{ public HalloWelt2(String titel){ super(titel); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(300, 300); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); setVisible(true); } public static void main(String[] args){ new HalloWelt2("Ich bin ein JFrame-Objekt"); } Jetzt haben wir einen Behälter, der grafische Objekte aufnehmen kann.

12 © 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 12 Aufruf der Vorlage für einen JFrame


Herunterladen ppt "© 2002 Dr. Cavelius - Ley - Pohlig - Taulien Step by step zum JFrame 1 Zum JFrame Step by step by step by step by step by step by step by step by."

Ähnliche Präsentationen


Google-Anzeigen