Created
August 21, 2018 06:17
-
-
Save luchtech/88779c69af5dffea4aedca0b99e8a8a1 to your computer and use it in GitHub Desktop.
Simple JFrame Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.JFrame; | |
public class MyFirstJFrame extends JFrame { | |
public MyFirstJFrame() { | |
/* | |
* There are two ways to set the Windows title of the JFrame | |
* One is by passing a string to the "super constructor". | |
* The other one is using the "setTitle" method. | |
*/ | |
super("Insert Title Here"); // --> JFrame Constructor | |
setTitle("Insert Title Here"); // --> Method from JFrame | |
setVisible(true); // --> Method from JFrame | |
setSize(500, 300); // --> Method from JFrame | |
setDefaultCloseOperation(EXIT_ON_CLOSE); // --> Method from JFrame | |
} | |
public static void main(String[] args) { | |
new MyFirstJFrame(); // --> instantiate Constructor from this class to run JFrame | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment