GWT: hour dropdown

 private ListBox createHourSelectorListBox(String hours)

    {

ListBox listBox = new ListBox();

listBox.ensureDebugId("listbox_hourSelector_configAttributes");

listBox.addItem("0:00 AM", "0");

listBox.addItem("1:00 AM", "1");

listBox.addItem("2:00 AM", "2");

listBox.addItem("3:00 AM", "3");

listBox.addItem("4:00 AM", "4");

listBox.addItem("5:00 AM", "5");

listBox.addItem("6:00 AM", "6");

listBox.addItem("7:00 AM", "7");

listBox.addItem("8:00 AM", "8");

listBox.addItem("9:00 AM", "9");

listBox.addItem("10:00 AM", "10");

listBox.addItem("11:00 AM", "11");

listBox.addItem("12:00 PM", "12");

listBox.addItem("13:00 PM", "13");

listBox.addItem("14:00 PM", "14");

listBox.addItem("15:00 PM", "15");

listBox.addItem("16:00 PM", "16");

listBox.addItem("17:00 PM", "17");

listBox.addItem("18:00 PM", "18");

listBox.addItem("19:00 PM", "19");

listBox.addItem("20:00 PM", "20");

listBox.addItem("21:00 PM", "21");

listBox.addItem("22:00 PM", "22");

listBox.addItem("23:00 PM", "23");

if (hours != null && hours.length() > 0)

{

    int index = (new Integer(hours)).intValue();

    listBox.setSelectedIndex(index);

}

listBox.addChangeListener(new ChangeListener()

{

    public void onChange(Widget sender)

    {

saveButton.setVisible(true);

    }

});

return listBox;

    }



As an Amazon Associate I earn from qualifying purchases.

My favorite quotations..


“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”  by Robert A. Heinlein

"We are but habits and memories we chose to carry along." ~ Uki D. Lucas


Popular Recent Articles