COMP 274 Week 3 Lab Java Application GUI
$7.00
Description
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!”);
Write a Java application to display the following GUI. At this point you are only implementing the display.
This program has the following requirements:
The textfield should accommodate 3 characters.
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.
The buttons should have 10 pixels horizontal spacing and 5 pixels vertical spacing.
For the layout of the JFrame, use FlowLayout( FlowLayout.CENTER, 10, 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.
Do not use inheritance for this program. Use a JFrame member variable as the main window object for this program.
Take screen shots of the output of programs 1 & 2. Paste the screen shots and your source code for your programs into a Word document.
Please place things in the following order:
Screen shot of problem 1.
Code for probem 1.
Screen shot of problem 2.
Code for problem 2.
SCREENSHOTS
SOLUTION
PAYMENT
ENTIRE COURSE
The solution includes a zip file.
Attachments [Move over files to preview content of those files]
COMP274_Lab_3.zip (305.80 KB)
COMP274_Lab3_Align_Screenshot.png
COMP274_Lab3_Caculator_Screenshot.png
COMP274_LAB3_Document.docx
java source code
Align.java
Calculator.java
Netbeans project
COMP274Lab3
build
classes
.netbeans_automatic_build
.netbeans_update_resources
Align.class
Calculator.class
build.xml
manifest.mf
nbproject
build-impl.xml
genfiles.properties
private
private.properties
project.properties
project.xml
src
Align.java
Calculator.java
test
Preview Align.java
xxxxxx xxxxx xxxxx xxxxxxx xxxxxx {
xxxxxxx xxxxxxxx;
xxxxxxx xxxxxxxxxx;
xxxxxxx xxxxxxxxxxxx;
JCheckBox snapCheckBox; JCheckBox showCheckBox; JTextField xTextField; JTextField yTextField; JLabel xLabel; JLabel yLabel;
public Align(String title) { super(title); setSize(400, 170); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // the layout of the JFrame is FlowLayout( FlowLayout.CENTER
xxxxxxxxx(xxx xxxxxxxxxx(xxxxxxxxxx.xxxxxx, 10, 5));
// xxxxxx xxxxxx, xxxxxxx xxx xxxxxx
xxxxxxxxxxxx = xxx xxxxxxx(“xxxxxx”);
xxxxxxxxxx = xxx xxxxxxx(“xxxx”);
xxxxxxxx = xxx xxxxxxx(“xx”);
xxxxxx xxxxxxxxxxxx = xxx xxxxxx();
Preview Calculator.java
xxxxxx xxxxx xxxxxxxxxx xxxxxxx xxxxxx {
xxxxxx[] xxxxxxxxxxxx = {“1”, “2”, “3”, “*”, “4”, “5”, “6”, “/”, “7”, “8”, “9”, “+”, “-“, “0”, “.”, “=”};
public Calculator(String title) { super(title); setBounds(100, 100, 250, 250); //set close operation setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //display the frame setVisible(true); //The text font is SanSerif size 16 and be bold Font font = new Font(“sansserif”, Font.BOLD, 16); setLayout(new BorderLayout()); //the TextFiled JTextField input = new JTextField();
//xxx xxxxx xxxxxxxx xxxxxxx
xxxxxx xxxxx = xxx xxxxxx();
xxxxx.xxxxxxxxx(xxx xxxxxxxxxx(4, 4, 5, 5));
xxxxxxx[] xxxxxxx = xxx xxxxxxx[xxxxxxxxxxxx.xxxxxx];
Preview Align.java
xxxxxx xxxxx xxxxx xxxxxxx xxxxxx {
xxxxxxx xxxxxxxx;
xxxxxxx xxxxxxxxxx;
xxxxxxx xxxxxxxxxxxx;
JCheckBox snapCheckBox; JCheckBox showCheckBox; JTextField xTextField; JTextField yTextField; JLabel xLabel; JLabel yLabel;
public Align(String title) { super(title); setSize(400, 170); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // the layout of the JFrame is FlowLayout( FlowLayout.CENTER
xxxxxxxxx(xxx xxxxxxxxxx(xxxxxxxxxx.xxxxxx, 10, 5));
// xxxxxx xxxxxx, xxxxxxx xxx xxxxxx
xxxxxxxxxxxx = xxx xxxxxxx(“xxxxxx”);
xxxxxxxxxx = xxx xxxxxxx(“xxxx”);
xxxxxxxx = xxx xxxxxxx(“xx”);
xxxxxx xxxxxxxxxxxx = xxx xxxxxx();
Preview Calculator.java
xxxxxx xxxxx xxxxxxxxxx xxxxxxx xxxxxx {
xxxxxx[] xxxxxxxxxxxx = {“1”, “2”, “3”, “*”, “4”, “5”, “6”, “/”, “7”, “8”, “9”, “+”, “-“, “0”, “.”, “=”};
public Calculator(String title) { super(title); setBounds(100, 100, 250, 250); //set close operation setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //display the frame setVisible(true); //The text font is SanSerif size 16 and be bold Font font = new Font(“sansserif”, Font.BOLD, 16); setLayout(new BorderLayout()); //the TextFiled JTextField input = new JTextField();
//xxx xxxxx xxxxxxxx xxxxxxx
xxxxxx xxxxx = xxx xxxxxx();
xxxxx.xxxxxxxxx(xxx xxxxxxxxxx(4, 4, 5, 5));
xxxxxxx[] xxxxxxx = xxx xxxxxxx[xxxxxxxxxxxx.xxxxxx];
Price: $15
Buy Now
Checkout
Added to cart
Buy More Save More
Buy at least TWO items & save up to 30% OFF your ENTIRE order!
Rack up instant rebates in your shopping cart. Simply add items to your cart, and see the savings add up.
Discounts will automatically be applied on eligible orders.
COMP 274 Week 3 Lab Java application GUI – $15.00
COMP 274 Week 4 Lab Java Program to Convert Temperature – $15.00
COMP 274 Week 5 Lab Timer and Mouse Events and Java Graphics – $19.00
COMP 274 Week 6 Lab Calendar Program – $19.00
COMP 274 Week 7 Lab Java Doc – $19.00
Add to Cart
Checkout
Added to cart
FLASH SALE
$75
$108
Save $30
COMP274 Entire Course
Get Entire Course
You May Also Like:
COMP 274 Entire Course
COMP 274 Week 1 Lab
COMP 274 Week 2 Lab Inheritance and Polymorphism
COMP 274 Week 4 Lab Java Program to Convert Temperature
COMP 274 Week 5 Lab Timer and Mouse Events and Java Graphics
COMP 274 Week 6 Lab Calendar Program
COMP 274 Week 7 Lab Java Doc
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.