Comp 274 week 3 programming assignment
Upcoming SlideShare
Loading in...5
×
 

Comp 274 week 3 programming assignment

on

  • 336 views

Create Java programs for the following two problems. ...

Create Java programs for the following two problems.



Write a Java application to display the following GUI. At this point you are only implementing the display. We are not ready to make the calculator actually do any calculations!
This program has the following requirements:



The size of the calculator is 250 x 250 pixels.
The background and foreground color of the calculator buttons must alternate in a checker board pattern as shown above. You can choose any pair of colors for your foreground and background colors.
The buttons should have at least 5 pixels of space between them.
The text on the buttons should be SanSerif size 16 and be bold.
Your application should be implemented in a single class. The main method of the class does nothing more than create an object of the class. The constructor of the class creates and displays the GUI. The constructor may call other methods of the class if needed.
The class must inherit from JFrame as the following demonstrates:


public myGUI extends JFrame { … }



The extends keyword specifies inheritance. Inside the class you can directly access methods of the JFrame class without specifying an object due to inheritance. So when you want to add something to the frame, simply say



add(someComponent);



You can specify the title of the window in your constructor by simply adding the following line as the first thing in your constructor.



super(“Title of your window!”);

Statistics

Views

Total Views
336
Views on SlideShare
336
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Comp 274 week 3 programming assignment Comp 274 week 3 programming assignment Document Transcript

  • SOLUTIONJUG.COMCLICK HERE TO GET THE SOLUTION !!!!!COMP/274 Week 3 Programming AssignmentWeek 3 Programming AssignmentCreate Java programs for the following two problems. 1. Write a Java application to display the following GUI. At this point you are only implementing the display. We are not ready to make the calculator actually do any calculations!This program has the following requirements: 1. The size of the calculator is 250 x 250 pixels. 2. The background and foreground color of the calculator buttons must alternate in a checker board pattern as shown above. You can choose any pair of colors for your foreground and background colors. 3. The buttons should have at least 5 pixels of space between them. 4. The text on the buttons should be SanSerif size 16 and be bold. 5. Your application should be implemented in a single class. The main method of the class does nothing more than create an object of the class. The constructor of the class creates and displays the GUI. The constructor may call other methods of the class if needed. 6. The class must inherit from JFrame as the following demonstrates:public myGUI extends JFrame { … }The extends keyword specifies inheritance. Inside the class you can directly access methods of theJFrame class without specifying an object due to inheritance. So when you want to add somethingto the frame, simply sayadd(someComponent);You can specify the title of the window in your constructor by simply adding the following line as thefirst thing in your constructor.
  • super(“Title of your window!”); 1. Write a Java application to display the following GUI. At this point you are only implementing the display.This program has the following requirements: 1. The textfield should accommodate 3 characters. 2. The X and Y labels should be next to the corresponding textfields.Hint: Put each label and its adjacent text field into a panel, then put both panels into another panel! 1. The buttons should have 10 pixels horizontal spacing and 5 pixels vertical spacing. 2. For the layout of the JFrame, use FlowLayout( FlowLayout.CENTER, 10, 5). 3. Your application should be implemented in a single class. The main method of the class does nothing more than create an object of the class. The constructor of the class creates and displays the GUI. The constructor may call other methods of the class if needed. 4. Do not use inheritance for this program. Use a JFrame member variable as the main window object for this program.Screenshot 1Screenshot 2CLICK HERE TO GET THE SOLUTION !!!!!