Grid grid = new Grid(2, 4);
VerticalPanel vp = new VerticalPanel();
grid.setHTML(0, 0, "<b>Opacity</b>");
// The drop down lists for setting the style
final ListBox opacityBox = new ListBox();
for (int i = 100; i > 0; i -= 10) {
opacityBox.addItem(i + "%");
}
opacityBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
String val = opacityBox.getItemText(opacityBox.getSelectedIndex());
opacity = Double.parseDouble(val.replace("%", "")) / 100.0;
}
});
grid.setWidget(1, 0, opacityBox);
grid.setHTML(0, 1, "<b>Weight</b>");
final ListBox weightBox = new ListBox();
weightBox.addItem("1 pixel");
weightBox.addItem("2 pixels");
weightBox.addItem("3 pixels");
weightBox.addItem("5 pixels");
weightBox.addItem("10 pixels");
weightBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
String val = weightBox.getItemText(weightBox.getSelectedIndex());
val = val.replace(" pixel", "");
val = val.replace("s", "");
weight = Integer.parseInt(val);
}
});
grid.setWidget(1, 1, weightBox);
grid.setHTML(0, 2, "<b>Color</b>");
final ListBox colorBox = new ListBox();
colorBox.addItem("#FF0000 red");
colorBox.addItem("#FFFF00 yellow");
colorBox.addItem("#00FF00 green");
colorBox.addItem("#00FFFF cyan");
colorBox.addItem("#0000FF blue");
colorBox.addItem("#FF00FF violet");
colorBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
color = colorBox.getItemText(colorBox.getSelectedIndex()).substring(0,
7);
}
});
grid.setWidget(1, 2, colorBox);