![]() | Session 7 |
Tasks (to be submitted by Sun 1.04 23:55) 2 points
Task 1. Flag
Draw a flag of any country using Canvas class. The flag must have at least three colors or a complex shape.
Task 2.
Create a program which displays a device, a schema, a masterpiece or anything else. Some examples: a bus timetable panel, a panel of a sports competition, a crossroad, a masterpiece reproduction in the style of abstractionism ...
Some mystery elements can be added using an animation (e.g. due to a programming mistake, the panel flies in the air).
- The scene graph should have at least four levels.
- The layout should be regulated by an instance of any
Panesubclasses. - Any animation should be present.
- Add at least one effect.
To come up with an idea is not an easy task, but let your fantasy fly. The society needs creative people!
Task 3.
Create a .txt file which contains some digits (each digit on a separate line). Write a program which reads in the data from the file and draws a bar chart according the values from the file. The bars whose value is larger than 50 should be filled in with red; the rest bars should be in blue. The value of each bar should be added under the bar.
An example of the output:

Task 4.
Write a program which demonstrates all the colors of Color class. Some examples of the output:
or
or
or ...The following method returns a list of all the colors:
import java.lang.reflect.Field;
import java.util.ArrayList;
import javafx.scene.paint.Color;
...
static ArrayList<Color> allColors() throws Exception {
ArrayList<Color> colors = new ArrayList<Color>();
Class<?> myClass = Class.forName("javafx.scene.paint.Color");
if (myClass != null) {
Field[] field = myClass.getFields();
for (int i = 0; i < field.length; i++) {
Field f = field[i];
Object obj = f.get(null);
if(obj instanceof Color){
colors.add((Color) obj);
}
}
}
return colors;
}
In the second example, the following effect is used - RadialGradient
![]() | Session 7 |
