SlideShare a Scribd company logo
1 of 10
Requirements to get full credits in Documentation
1.A description of each method is also needed.
2.Some additional comments inside of methods to explain code
that are hard to follow should be written.
You can look at the Java programs in the text book to see how
comments are added to programs.
Minimal Submitted Files
You are required, but not limited, to turn in the following
source files:
Assignment7.java
(No need to be changed)
DrawingPane.java
-- to be completed.
You may add more classes or more methods than the specified
ones. (You might need them.)
Skills to be Applied:
JavaFX
Classes may be needed:
Button, ComboBox, Color, Graphics, Line, ActionHandler,
MouseHandler. You may use other classes.
Here is
Assignment7.java:
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
public class Assignment7 extends Application
{
public void start(Stage primaryStage)
{
//create a DrawPane object. See DrawPane.java for details.
DrawingPane gui = new DrawingPane();
//put gui on top of the rootPane
StackPane rootPane = new StackPane();
rootPane.getChildren().add(gui);
// Create a scene and place rootPane in the stage
Scene scene = new Scene(rootPane, 600, 400);
primaryStage.setTitle("Line Drawing");
primaryStage.setScene(scene); // Place the scene in the
stage
primaryStage.show(); // Display the stage
}
public static void main(String[] args)
{
Application.launch(args);
}
}
Here is
DrawingPane.java
(This is a semi-finished product, you need to add):
//import any classes necessary here
//----
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.shape.Line;
import javafx.scene.paint.Color;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.geometry.Orientation;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.input.MouseEvent;
import java.util.ArrayList;
public class DrawingPane extends BorderPane
{
private Button undoButton, eraseButton;
private ComboBox colorCombo, widthCombo;
private ArrayList lineList;
private Pane canvas;
//declare any other necessary instance variables here
//----
//Constructor
public DrawingPane()
{
//Step #1: initialize instance variable and set up layout
undoButton = new Button("Undo");
eraseButton = new Button("Erase");
undoButton.setMinWidth(80.0);
eraseButton.setMinWidth(80.0);
//Create the color comboBox and width comboBox,
//----
//initialize lineList, it is a data structure we used
//to track the lines we created
//----
//topPane should contain two combo boxes and two buttons
HBox topPane = new HBox();
topPane.setSpacing(40);
topPane.setPadding(new Insets(10, 10, 10, 10));
topPane.setStyle("-fx-border-color: black");
//canvas is a Pane where we will draw lines
canvas = new Pane();
canvas.setStyle("-fx-background-color: white;");
//add the canvas at the center of the pane and top panel
//should have two combo boxes and two buttons
this.setCenter(canvas);
this.setTop(topPane);
//Step #3: Register the source nodes with its handler objects
canvas.setOnMousePressed(new MouseHandler());
//----
//----
}
//Step #2(A) - MouseHandler
private class MouseHandler implements EventHandler
{
public void handle(MouseEvent event)
{
//handle MouseEvent here
//Note: you can use if(event.getEventType()==
MouseEvent.MOUSE_PRESSED)
//to check whether the mouse key is pressed, dragged or
released
//write your own codes here
//----
}//end handle()
}//end MouseHandler
//Step #2(B)- A handler class used to handle events from
Undo & Erase buttons
private class ButtonHandler implements EventHandler
{
public void handle(ActionEvent event)
{
//write your codes here
//----
}
}//end ButtonHandler
//Step #2(C)- A handler class used to handle colors
private class ColorHandler implements EventHandler
{
public void handle(ActionEvent event)
{
//write your own codes here
//----
}
}//end ColorHandler
//Step #2(D)- A handler class used to handle widths of lines
private class WidthHandler implements EventHandler
{
public void handle(ActionEvent event)
{
//write your own codes here
//----
}
}//end WidthHandler
}//end class DrawingPane
The remail details is in the picture file.

More Related Content

Similar to Requirements to get full credits in Documentation1.A descripti

202: When the user clicks a JCheckBox, a(n) occurs.
202: When the user clicks a JCheckBox, a(n) occurs.202: When the user clicks a JCheckBox, a(n) occurs.
202: When the user clicks a JCheckBox, a(n) occurs.
sukeshsuresh189
 
3: A(n) ________ enables a program to read data from the user.
3: A(n) ________ enables a program to read data from the user.3: A(n) ________ enables a program to read data from the user.
3: A(n) ________ enables a program to read data from the user.
sukeshsuresh189
 
22: The logical relationship between radio buttons is maintained by objects o...
22: The logical relationship between radio buttons is maintained by objects o...22: The logical relationship between radio buttons is maintained by objects o...
22: The logical relationship between radio buttons is maintained by objects o...
sukeshsuresh189
 
19: When the user presses Enter in a JTextField, the GUI component generates ...
19: When the user presses Enter in a JTextField, the GUI component generates ...19: When the user presses Enter in a JTextField, the GUI component generates ...
19: When the user presses Enter in a JTextField, the GUI component generates ...
sukeshsuresh189
 
12: When an object is concatenated with a String
12: When an object is concatenated with a String12: When an object is concatenated with a String
12: When an object is concatenated with a String
sukeshsuresh189
 
5: Every Java application is required to have
5: Every Java application is required to have5: Every Java application is required to have
5: Every Java application is required to have
sukeshsuresh189
 
15: Which method call converts the value in variable stringVariable to an int...
15: Which method call converts the value in variable stringVariable to an int...15: Which method call converts the value in variable stringVariable to an int...
15: Which method call converts the value in variable stringVariable to an int...
sukeshsuresh189
 
16: Which of the following is the method used to display a dialog box to gath...
16: Which of the following is the method used to display a dialog box to gath...16: Which of the following is the method used to display a dialog box to gath...
16: Which of the following is the method used to display a dialog box to gath...
sukeshsuresh189
 
13: What do the following statements do?
13: What do the following statements do?13: What do the following statements do?
13: What do the following statements do?
sukeshsuresh189
 
Comp 328 final guide (devry)
Comp 328 final guide (devry)Comp 328 final guide (devry)
Comp 328 final guide (devry)
sukeshsuresh189
 
7: Assume the following class declaration.
7: Assume the following class declaration.7: Assume the following class declaration.
7: Assume the following class declaration.
sukeshsuresh189
 
8: Which statement below could be used to randomly select a state from an arr...
8: Which statement below could be used to randomly select a state from an arr...8: Which statement below could be used to randomly select a state from an arr...
8: Which statement below could be used to randomly select a state from an arr...
sukeshsuresh189
 
11: Which is a correct way to invoke the static method sqrt of the Math class?
11: Which is a correct way to invoke the static method sqrt of the Math class?11: Which is a correct way to invoke the static method sqrt of the Math class?
11: Which is a correct way to invoke the static method sqrt of the Math class?
sukeshsuresh189
 
14: Consider the class below:
14: Consider the class below:14: Consider the class below:
14: Consider the class below:
sukeshsuresh189
 
18: Which of the following does not generate an event?
18: Which of the following does not generate an event?18: Which of the following does not generate an event?
18: Which of the following does not generate an event?
sukeshsuresh189
 
17: provides the basic attributes and behaviors of a window—a title bar at th...
17: provides the basic attributes and behaviors of a window—a title bar at th...17: provides the basic attributes and behaviors of a window—a title bar at th...
17: provides the basic attributes and behaviors of a window—a title bar at th...
sukeshsuresh189
 
23: Which layout manager is the default for JPanel?
23: Which layout manager is the default for JPanel?23: Which layout manager is the default for JPanel?
23: Which layout manager is the default for JPanel?
sukeshsuresh189
 
1: The .class extension on a file means that the file
1:  The .class extension on a file means that the file1:  The .class extension on a file means that the file
1: The .class extension on a file means that the file
sukeshsuresh189
 
Assignment6~$signment6.docxAssignment6Assignment6.docxAs.docx
Assignment6~$signment6.docxAssignment6Assignment6.docxAs.docxAssignment6~$signment6.docxAssignment6Assignment6.docxAs.docx
Assignment6~$signment6.docxAssignment6Assignment6.docxAs.docx
ssuser562afc1
 

Similar to Requirements to get full credits in Documentation1.A descripti (20)

202: When the user clicks a JCheckBox, a(n) occurs.
202: When the user clicks a JCheckBox, a(n) occurs.202: When the user clicks a JCheckBox, a(n) occurs.
202: When the user clicks a JCheckBox, a(n) occurs.
 
3: A(n) ________ enables a program to read data from the user.
3: A(n) ________ enables a program to read data from the user.3: A(n) ________ enables a program to read data from the user.
3: A(n) ________ enables a program to read data from the user.
 
22: The logical relationship between radio buttons is maintained by objects o...
22: The logical relationship between radio buttons is maintained by objects o...22: The logical relationship between radio buttons is maintained by objects o...
22: The logical relationship between radio buttons is maintained by objects o...
 
19: When the user presses Enter in a JTextField, the GUI component generates ...
19: When the user presses Enter in a JTextField, the GUI component generates ...19: When the user presses Enter in a JTextField, the GUI component generates ...
19: When the user presses Enter in a JTextField, the GUI component generates ...
 
12: When an object is concatenated with a String
12: When an object is concatenated with a String12: When an object is concatenated with a String
12: When an object is concatenated with a String
 
5: Every Java application is required to have
5: Every Java application is required to have5: Every Java application is required to have
5: Every Java application is required to have
 
15: Which method call converts the value in variable stringVariable to an int...
15: Which method call converts the value in variable stringVariable to an int...15: Which method call converts the value in variable stringVariable to an int...
15: Which method call converts the value in variable stringVariable to an int...
 
16: Which of the following is the method used to display a dialog box to gath...
16: Which of the following is the method used to display a dialog box to gath...16: Which of the following is the method used to display a dialog box to gath...
16: Which of the following is the method used to display a dialog box to gath...
 
13: What do the following statements do?
13: What do the following statements do?13: What do the following statements do?
13: What do the following statements do?
 
Comp 328 final guide (devry)
Comp 328 final guide (devry)Comp 328 final guide (devry)
Comp 328 final guide (devry)
 
7: Assume the following class declaration.
7: Assume the following class declaration.7: Assume the following class declaration.
7: Assume the following class declaration.
 
8: Which statement below could be used to randomly select a state from an arr...
8: Which statement below could be used to randomly select a state from an arr...8: Which statement below could be used to randomly select a state from an arr...
8: Which statement below could be used to randomly select a state from an arr...
 
11: Which is a correct way to invoke the static method sqrt of the Math class?
11: Which is a correct way to invoke the static method sqrt of the Math class?11: Which is a correct way to invoke the static method sqrt of the Math class?
11: Which is a correct way to invoke the static method sqrt of the Math class?
 
14: Consider the class below:
14: Consider the class below:14: Consider the class below:
14: Consider the class below:
 
18: Which of the following does not generate an event?
18: Which of the following does not generate an event?18: Which of the following does not generate an event?
18: Which of the following does not generate an event?
 
17: provides the basic attributes and behaviors of a window—a title bar at th...
17: provides the basic attributes and behaviors of a window—a title bar at th...17: provides the basic attributes and behaviors of a window—a title bar at th...
17: provides the basic attributes and behaviors of a window—a title bar at th...
 
23: Which layout manager is the default for JPanel?
23: Which layout manager is the default for JPanel?23: Which layout manager is the default for JPanel?
23: Which layout manager is the default for JPanel?
 
1: The .class extension on a file means that the file
1:  The .class extension on a file means that the file1:  The .class extension on a file means that the file
1: The .class extension on a file means that the file
 
Assignment6~$signment6.docxAssignment6Assignment6.docxAs.docx
Assignment6~$signment6.docxAssignment6Assignment6.docxAs.docxAssignment6~$signment6.docxAssignment6Assignment6.docxAs.docx
Assignment6~$signment6.docxAssignment6Assignment6.docxAs.docx
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 

More from anitramcroberts

Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docxProsecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
anitramcroberts
 
prompt:Leadership Culture - Describe the leadership culture in ope.docx
prompt:Leadership Culture - Describe the leadership culture in ope.docxprompt:Leadership Culture - Describe the leadership culture in ope.docx
prompt:Leadership Culture - Describe the leadership culture in ope.docx
anitramcroberts
 
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docx
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docxPrompt #1 Examples of Inductive InferencePrepare To prepare to.docx
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docx
anitramcroberts
 
Project This project requires you to identify and analyze le.docx
Project This project requires you to identify and analyze le.docxProject This project requires you to identify and analyze le.docx
Project This project requires you to identify and analyze le.docx
anitramcroberts
 

More from anitramcroberts (20)

Propose recommendations to create an age diverse workforce.W.docx
Propose recommendations to create an age diverse workforce.W.docxPropose recommendations to create an age diverse workforce.W.docx
Propose recommendations to create an age diverse workforce.W.docx
 
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docxProsecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
Prosecuting Cybercrime  The Jurisdictional ProblemIn this discuss.docx
 
PromptTopic Joseph is scheduled to have hip replacement surgery .docx
PromptTopic Joseph is scheduled to have hip replacement surgery .docxPromptTopic Joseph is scheduled to have hip replacement surgery .docx
PromptTopic Joseph is scheduled to have hip replacement surgery .docx
 
Property TaxThe property tax has been criticized as an unfair ba.docx
Property TaxThe property tax has been criticized as an unfair ba.docxProperty TaxThe property tax has been criticized as an unfair ba.docx
Property TaxThe property tax has been criticized as an unfair ba.docx
 
Prosecutors and VictimsWrite a 2 page paper.  Address the follow.docx
Prosecutors and VictimsWrite a 2 page paper.  Address the follow.docxProsecutors and VictimsWrite a 2 page paper.  Address the follow.docx
Prosecutors and VictimsWrite a 2 page paper.  Address the follow.docx
 
Prompt Discuss the recent public policy decisions made in Texas wit.docx
Prompt Discuss the recent public policy decisions made in Texas wit.docxPrompt Discuss the recent public policy decisions made in Texas wit.docx
Prompt Discuss the recent public policy decisions made in Texas wit.docx
 
Properties of LifeChapter 1 of the text highlights the nine proper.docx
Properties of LifeChapter 1 of the text highlights the nine proper.docxProperties of LifeChapter 1 of the text highlights the nine proper.docx
Properties of LifeChapter 1 of the text highlights the nine proper.docx
 
Proofread and complete your manual that includes the following ite.docx
Proofread and complete your manual that includes the following ite.docxProofread and complete your manual that includes the following ite.docx
Proofread and complete your manual that includes the following ite.docx
 
Proof Reading and adding 5 pages to chapter 2The pre-thesis .docx
Proof Reading and adding 5 pages to chapter 2The pre-thesis .docxProof Reading and adding 5 pages to chapter 2The pre-thesis .docx
Proof Reading and adding 5 pages to chapter 2The pre-thesis .docx
 
prompt:Leadership Culture - Describe the leadership culture in ope.docx
prompt:Leadership Culture - Describe the leadership culture in ope.docxprompt:Leadership Culture - Describe the leadership culture in ope.docx
prompt:Leadership Culture - Describe the leadership culture in ope.docx
 
Prompt  These two poems are companion pieces from a collection by.docx
Prompt  These two poems are companion pieces from a collection by.docxPrompt  These two poems are companion pieces from a collection by.docx
Prompt  These two poems are companion pieces from a collection by.docx
 
PromptTopic Robert was quite active when he first started colleg.docx
PromptTopic Robert was quite active when he first started colleg.docxPromptTopic Robert was quite active when he first started colleg.docx
PromptTopic Robert was quite active when he first started colleg.docx
 
PromptTopic Outline the flow of blood through the heart.  Explai.docx
PromptTopic Outline the flow of blood through the heart.  Explai.docxPromptTopic Outline the flow of blood through the heart.  Explai.docx
PromptTopic Outline the flow of blood through the heart.  Explai.docx
 
PromptTopic Deborah has 2 preschool-age children and one school-.docx
PromptTopic Deborah has 2 preschool-age children and one school-.docxPromptTopic Deborah has 2 preschool-age children and one school-.docx
PromptTopic Deborah has 2 preschool-age children and one school-.docx
 
PROMPTAnalyze from Amreeka the scene you found most powerfu.docx
PROMPTAnalyze from Amreeka the scene you found most powerfu.docxPROMPTAnalyze from Amreeka the scene you found most powerfu.docx
PROMPTAnalyze from Amreeka the scene you found most powerfu.docx
 
Prompt What makes a poem good or bad  Use Chapter 17 to identi.docx
Prompt What makes a poem good or bad  Use Chapter 17 to identi.docxPrompt What makes a poem good or bad  Use Chapter 17 to identi.docx
Prompt What makes a poem good or bad  Use Chapter 17 to identi.docx
 
PromptTopic Anton grew up in France and has come to America for .docx
PromptTopic Anton grew up in France and has come to America for .docxPromptTopic Anton grew up in France and has come to America for .docx
PromptTopic Anton grew up in France and has come to America for .docx
 
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docx
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docxPrompt #1 Examples of Inductive InferencePrepare To prepare to.docx
Prompt #1 Examples of Inductive InferencePrepare To prepare to.docx
 
Project This project requires you to identify and analyze le.docx
Project This project requires you to identify and analyze le.docxProject This project requires you to identify and analyze le.docx
Project This project requires you to identify and analyze le.docx
 
ProjectUsing the information you learned from your assessments and.docx
ProjectUsing the information you learned from your assessments and.docxProjectUsing the information you learned from your assessments and.docx
ProjectUsing the information you learned from your assessments and.docx
 

Recently uploaded

SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MysoreMuleSoftMeetup
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 

Recently uploaded (20)

OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 

Requirements to get full credits in Documentation1.A descripti

  • 1. Requirements to get full credits in Documentation 1.A description of each method is also needed. 2.Some additional comments inside of methods to explain code that are hard to follow should be written. You can look at the Java programs in the text book to see how comments are added to programs. Minimal Submitted Files You are required, but not limited, to turn in the following source files: Assignment7.java (No need to be changed) DrawingPane.java -- to be completed. You may add more classes or more methods than the specified ones. (You might need them.) Skills to be Applied: JavaFX
  • 2. Classes may be needed: Button, ComboBox, Color, Graphics, Line, ActionHandler, MouseHandler. You may use other classes. Here is Assignment7.java: import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.StackPane; public class Assignment7 extends Application { public void start(Stage primaryStage) { //create a DrawPane object. See DrawPane.java for details. DrawingPane gui = new DrawingPane(); //put gui on top of the rootPane StackPane rootPane = new StackPane();
  • 3. rootPane.getChildren().add(gui); // Create a scene and place rootPane in the stage Scene scene = new Scene(rootPane, 600, 400); primaryStage.setTitle("Line Drawing"); primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage } public static void main(String[] args) { Application.launch(args); } } Here is DrawingPane.java (This is a semi-finished product, you need to add): //import any classes necessary here //---- import javafx.scene.control.Button;
  • 4. import javafx.scene.control.ComboBox; import javafx.scene.layout.Pane; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.shape.Line; import javafx.scene.paint.Color; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.geometry.Orientation; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.input.MouseEvent; import java.util.ArrayList; public class DrawingPane extends BorderPane { private Button undoButton, eraseButton; private ComboBox colorCombo, widthCombo;
  • 5. private ArrayList lineList; private Pane canvas; //declare any other necessary instance variables here //---- //Constructor public DrawingPane() { //Step #1: initialize instance variable and set up layout undoButton = new Button("Undo"); eraseButton = new Button("Erase"); undoButton.setMinWidth(80.0); eraseButton.setMinWidth(80.0); //Create the color comboBox and width comboBox, //---- //initialize lineList, it is a data structure we used
  • 6. //to track the lines we created //---- //topPane should contain two combo boxes and two buttons HBox topPane = new HBox(); topPane.setSpacing(40); topPane.setPadding(new Insets(10, 10, 10, 10)); topPane.setStyle("-fx-border-color: black"); //canvas is a Pane where we will draw lines canvas = new Pane(); canvas.setStyle("-fx-background-color: white;"); //add the canvas at the center of the pane and top panel //should have two combo boxes and two buttons this.setCenter(canvas); this.setTop(topPane); //Step #3: Register the source nodes with its handler objects
  • 7. canvas.setOnMousePressed(new MouseHandler()); //---- //---- } //Step #2(A) - MouseHandler private class MouseHandler implements EventHandler { public void handle(MouseEvent event) { //handle MouseEvent here //Note: you can use if(event.getEventType()== MouseEvent.MOUSE_PRESSED) //to check whether the mouse key is pressed, dragged or released //write your own codes here //----
  • 8. }//end handle() }//end MouseHandler //Step #2(B)- A handler class used to handle events from Undo & Erase buttons private class ButtonHandler implements EventHandler { public void handle(ActionEvent event) { //write your codes here //---- } }//end ButtonHandler //Step #2(C)- A handler class used to handle colors private class ColorHandler implements EventHandler
  • 9. { public void handle(ActionEvent event) { //write your own codes here //---- } }//end ColorHandler //Step #2(D)- A handler class used to handle widths of lines private class WidthHandler implements EventHandler { public void handle(ActionEvent event) { //write your own codes here //----
  • 10. } }//end WidthHandler }//end class DrawingPane The remail details is in the picture file.