-
-
Notifications
You must be signed in to change notification settings - Fork 8
#08.2 Checkbox
Valkryst edited this page May 13, 2018
·
16 revisions
import com.valkryst.VTerminal.Screen;
import com.valkryst.VTerminal.builder.CheckBoxBuilder;
import java.io.IOException;
public class Driver {
public static void main(final String[] args) throws IOException {
final Screen screen = new Screen();
screen.addCanvasToFrame();
final CheckBoxBuilder checkBoxBuilder = new CheckBoxBuilder();
checkBoxBuilder.setPosition(10, 10);
checkBoxBuilder.setText("Click Me");
screen.addComponent(checkBoxBuilder.build());
screen.draw();
}
}
final CheckBoxBuilder checkBoxBuilder = new CheckBoxBuilder();
Constructs a new CheckBoxBuilder.
You can reuse the builder, so you won't need to create a new CheckBoxBuilder every time you want to create a new check box.
checkBoxBuilder.setPosition(10, 10);
This tells the builder to place the check box at position (10x, 10y).
checkBoxBuilder.setText("Click Me");
This sets the text on the check box, so this check box will display "Click Me".
screen.addComponent(checkBoxBuilder.build());
This builds the check box and adds it to the panel.
screen.draw();
This redraws the screen, to show the newly added button.