![]() ![]() We can set the size of the window by setting the number of pixels. But first, we must set a size for the window. Now let's try seeing what the window looks like. This is handy so that you don't have to memorize how to import individual parts. If you're using Eclipse, you can simply hit ctrl+shift+o to fix all of your imports automatically. It's not hard just add this line to the very top of your code: This is because you will have to import JFrame from the Java Swing library. ![]() You'll notice that if you try putting that line into your code, you will get an error saying that your program does not recognize JFrame. Here you can see we are creating a JFrame variable called window. Let's start with creating a JFrame variable. There are two ways of creating a Java JFrame, either by creating a variable that is the JFrame or by having our class be a subclass of JFrame. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |