What we see is what we believe.
Window
An object of this class type is a window with no title bar or window manage-
ment icons. One typical use for a JWindow object is for a subsidiary application
window that is displayed on a secondary display where two or more displays
are attached to a system.
JWindow An object of this class type is a window with no title bar or window management icons. One typical use for a JWindow object is for a subsidiary application window that is displayed on a secondary display where two or more displays are attached to a system.
Here is a simple program on JWindow i.e WindowSample.java creating a window on your screen which is a dragable window containing a close button to exit from the application. The source codeof the program is given below with a download link so that you can download, edit, compile and run the application on your own system and try to understand what actually is happenng.
Downloads
or
After you download, try to understand the code. If there is any problem yo can comment below.
Frame
Most Swing applications will be built inside a basic JFrame, which creates the window in whatever operating system you’re using. The title of the window can be set using the JFrame constructor.
JFrame This is used as the basic Java application window. An object of this class has a title bar and provision for adding a menu. You can also add other components to it. You will usually subclass this class to create a window class specific to your application. You’ll then be able to add GUI components or draw in this window if required, as you’ll see.
From the above example of JWindow i.e WindowSample.java there you have to do a little change in order to get an example of JFrame. As you see in the code that the main class is extending JWindow component. What you do, instead of extending it to JWindow you extend it to JFrame and you will have the source code as an example on JFrame.
Another source code of frame is given below for download. Download it edit it create your own.
Downloads
No comments:
Post a Comment