Sale!

CSE 271 Lab Assignment 09 solution

$30.00 $25.50

Category:

Description

5/5 - (3 votes)

Graphical User Interface and Java Graphics

In this lab, you will practice designing graphical user interface and create drawings using Java
graphics. We have three problems in this assignment. You have to create three classes for three
problems.
You must watch the following recorded lecture, posted last week, to complete this lab assignment:
https://miamioh.instructure.com/courses/117194/discussion_topics/841389
Problem 01 (35 Points):
We are going to redesign the graphical user interface we designed in the last lab (Lab 08). Today,
we are going to use Layout Managers and JPanels with title border. Use the following figure as a
guideline to redesign GUI of the AddressBook (Lab 08).
Note: For this problem, we are going to look at the design of the GUI, not the functionality (as you
were graded on functionality part before).
Hint: You can use the setBorder(TitledBorder titleBorder) method for setting title of a JPanel object.
TitledBorder is a java class that can be used to set title of a JPanel object. Here is an example:
panelObject.setBorder(new TitledBorder(“Border Title”));
Problem 02 (20 Points):
Create a class called ColorFrame that extends JFrame. Create a “Colors” menu with three menu
items: Red, Green, and Blue. The ColorFrame class also contains a JPanel object that changes to the
appropriate color when the user selects a menu item.
JPanels with a
border and a title
For this JPanel, use the
GridLayout to organize the
JLabels and JTextFields
For this JPanel, use the
FlowLayout to organize the
JButtons
You do not need to use any
layout manager for this
JPanel
Use BorderLayout for the JFrame container and add three JPanels
Lab Assignment 09, Object-Oriented Programming, CSE 271, Spring 2020
Department of Computer Science and Engineering, Miami University
Graphical User Interface and Java Graphics
Hint: You can use JPanel object to call setBackground(Color color) method to set the background
color.
Problem 03 (45 Points):
Create a class named Emoticon and draw the following faces on the canvas (JComponent) side by
side using the Java graphics. You can choose your own colors for these faces. The faces are, from left
to right, smiley, sad, surprise, wink. You can use your own dimensions for the faces below. You will
receive full credit if they are similar in appearance and do not need to be exact.
The sample canvas below is 1800 pixels in width and 600 pixels in height. Each face is an oval
enclosed in a 300 x 300 pixels rectangle. Eyes are ovals enclosed in 50×50 pixels rectangles. Arcs
are enclosed in 150×100 pixels rectangles. Each face is 400 pixels away from each other in
distance.
Important Note:
Make sure the file name is correct and code is well commented. No late submission. You will get
zero for late submission.
Submission:
Submit all java files to the appropriate submission folder on the Canvas by the due time.
Grading:
Total 100 Points