Have a colored background of your liking. I have used Color.getHSBColor(0.8f, 0.2f, 0.9f). • Two lines that divide the frame into 4 equal parts, that are x and y axes. • A triangle that is filled with a color. (You can use fillPolygon() function) • Add a control panel. • Add 6 buttons to the panel called “Translate Up”, “Translate Down”,“Translate Right”, “Translate Left”, “Reflect X” and “Reflect Y”. • Menubar of this program should have an item called “Set Default”which will reset the values of x and y to the values they had initially. • Modify the action listener according to the buttons and menu item. • Set the title to “Transformations” in the constructor and add your WindowListener. • Modify your paint method to draw 1 triangle and 2 lines with different colors. • The main method should create and display an instance of Transformations(). • The frame should be set to the size 800 by 800. • You can use a grid layout which is pretty straightforward. • Submit only one file called Transformations.java import java.awt.*; import java.awt.event.*; public class Transformations extends Frame implements ActionListener { // Initialize coordinates of the triangle int[] x = {500,700,600}; int[] y = {300,300,100}; public static void main(String[] args) { // Set Frame s ize to 800x800) // Set background color // Set visibility … } public Transformations() { // Set title // Create menu // Add WindowListener to exit the program when window is closed // Set layout // Add control panel // Add buttons … } // Draw 2 lines and paint 1 filled triangle public void paint(Graphics g) { … } // Action listener public void actionPerformed(ActionEvent evt) { … }
• Have a colored background of your liking. I have used Color.getHSBColor(0.8f, 0.2f, 0.9f).
• Two lines that divide the frame into 4 equal parts, that are x and y axes.
• A triangle that is filled with a color. (You can use fillPolygon() function)
• Add a control panel.
• Add 6 buttons to the panel called “Translate Up”, “Translate Down”,“Translate Right”,
“Translate Left”, “Reflect X” and “Reflect Y”.
• Menubar of this
values of x and y to the values they had initially.
• Modify the action listener according to the buttons and menu item.
• Set the title to “Transformations” in the constructor and add your WindowListener.
• Modify your paint method to draw 1 triangle and 2 lines with different colors.
• The main method should create and display an instance of Transformations().
• The frame should be set to the size 800 by 800.
• You can use a grid layout which is pretty straightforward.
• Submit only one file called Transformations.java
import java.awt.*;
import java.awt.event.*;
public class Transformations extends Frame implements ActionListener {
// Initialize coordinates of the triangle
int[] x = {500,700,600};
int[] y = {300,300,100};
public static void main(String[] args) {
// Set Frame s ize to 800x800)
// Set background color
// Set visibility
…
}
public Transformations() {
// Set title
// Create menu
// Add WindowListener to exit the program when window is closed
// Set layout
// Add control panel
// Add buttons
…
}
// Draw 2 lines and paint 1 filled triangle
public void paint(Graphics g) {
…
}
// Action listener
public void actionPerformed(ActionEvent evt) {
…
}
}
![Transformations File
Transformations
Translate Up
Translate Down
Translate Right
Translate Left
Reflect Y
Reflect X](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F47f4c967-1b91-45d3-b87d-a8496dd05b55%2F2d88920f-6d28-4e17-822d-68ae94980e4f%2F2h1xyd_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)