Choose any tasks you wish to solve from the following.
Task 1
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 to the values from the file. The bar whose value is larger than 50 should be red; the rest should be blue. The value of each bar should be added under the bar.
An example of the output:
Task 2
Write a program which draws an interface of a calculator (the calculator does not have to work). Use at least two different panes (class Region or its subclasses). There should be space between the buttons. The result of a calculation should be on the white background and in the right corner. The color of the text on the buttons should be either red or blue. The size of the window should be fixed.
An example of the interface:
Task 3
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