1 / 5

Recitation 4

Recitation 4. In this recitation you will have an example on drawing graph on ObjectEditor. Basic tasks are try to change the values in the code and see the difference of graphs. The code can be found in the recitation page. Code Explanations.

hector
Télécharger la présentation

Recitation 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Recitation 4 • In this recitation you will have an example on drawing graph on ObjectEditor. Basic tasks are try to change the values in the code and see the difference of graphs. • The code can be found in the recitation page.

  2. Code Explanations • The ALine class and AShape class are two classes that implement the Line interface. Notice that the two classes are basically the same. The only difference is the Aline class contains annotations say that it follow line pattern.

  3. Run the code and observe the windows of ObjectEditor, console and the values of variables in the tree view of ObjectEditor

  4. What you can do with the code • Try to initialize the two instances with different initial values (in Driver line 7 and 8) • Try some new arguments of OEFrame.setSize (line 10). • For the calling of sleep method in the for loop, replace the argument with some small numbers like 10, and modify the argument of calling of moveShapes to (lineArray, 1). • If you know refactor, then use it to rename the AShape into ARectangleand AStringShape(notice the difference) • Try to comment out some methods in ALine and in its interface. Then try just comment out these methods in the interface.

  5. If you have done all those jobs, try following stuff • Search in the lecture slides and sample code to find a way to display string and image(notice annotations and different properties) • Add a new method in AShape public Stroke getStroke(){return new BasicStroke(5.0f);} And the import statements import java.awt.BasicStroke; import java.awt.Stroke; -------------------Still in AShape----------------------------- public Color getColor() {return Color.GREEN;} Import statement import java.awt.Color; • Review the polar coordination representation of a point

More Related