Featured Posts
Tuesday, 29 April 2014
Friday, 13 December 2013
How to create a Frame in JAVA
Step 1 : Open Eclipse if u don't have Eclipse then download from here :Eclipse Download
Step 2 : import javax.swing; JFrame class . javax.swing.JFrame means we are trying to import JFrame class from swing package. A swing package contains all the necessary elements to build a GUI application. In order to make a frame we import JFrame class and create its Object.
Step 3 : public class myframe { }. Now create a class with class name myframe ( it is not compulsory to take this name , you can take any name). Classes are important in java as it is a Object Oriented Language we use mainly classes and objects. A class is block which contain methods, variables and other classes also.
Step 4 : public static void main(String args[]){}. This is the main method . The compiler starts executing our code from this position.
Step 5 : JFrame frame = new JFrame("Test Frame"); Here we are creating a object for the JFrame class that is frame. The default constructor takes a string as parameter ("Test Frame") this is the Title which will appear on the top left of your frame. You can take any other names also.
Step 6 : frame.setSize(300, 200); Using the JFrame class object frame we are calling the setSize method of JFrame class. This method basicaly sets the size of our frame . It takes two int parameters ie. width and height. Syntax is setSize(width, height). In this example width is 300px and height is 200px.
Step 7 : frame.setVisible(true); Using the JFrame class object frame we are now calling the setVisible method of JFrame class. This method is used to make the frame visible for the user. It takes a Boolean value as its parameter. Default value is false in order to make the frame visible we need to set it as true.
Step 8 : frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Using JFrame class object frame we are now calling the setDefaultCloseOperation method of JFrame class. This is used to close the window or frame.
Step 9 : Now save your code as myframe.java. This is important to save your program with same name as the class name which is containing the main method.
Step 10 : Run your code, if there are no errors then your frame is now ready to pop up.
// Program Code //
import javax.swing.JFrame;
public class myframe {
public static void main(String args[]){
JFrame frame = new JFrame("Test Frame");
frame.setSize(300, 200);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
// Code ends//
Output:
Output |
Thursday, 12 December 2013
IDM Cracked Free Download
IDM-Cracked |
Step 2 : Extract the "IDM 6.09 build 3 - CraCked By- M.ElsA3dY.RAR" file.
Step 3 : Click on "IDM 6.09 build 3 - CraCked By- M.ElsA3dY.exe".
Step 4 : Install IDM.
Step 5 : After installation, IDM update window is going to pop up "DO NOT UPDATE"
Note: NEVER UPDATE IDM
Subscribe to:
Posts (Atom)