Swing Lab 2
1. In this lab, we will use IntelliJ Wysiwyg editor, to create an application as shown below:
1. In this lab, we will use IntelliJ Wysiwyg editor, to create an application as shown below:
2. Click File → New → Project. Click Next → Next → Enter “JavaCalculater as the project name → Click ‘Finish’.
3. Right click on the src folder → New → GUI Form. Enter CalcForm as Form name and click OK.
4. Select JPanel in the Component Tree. Make sure that the layout is set to GridLayoutManager.
5. Add component to JPanel as shown in the screenshot above. Set the properties of the JComponents as required.
6. Within the Calcform.java class create a main method() using the code given below:
public static void main(String[] args) {
JFrame frame = new JFrame("JavaCalc");
frame.setContentPane(new CalcForm().panelmain);
frame.setVisible(true);
frame.setSize(400,300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
7. Run the program.
Comments
Post a Comment