Java:public void actionFontSize(ContextMenuEvent inputMethodEvent) { // txtMsg.setFont(Font.font("Times New Roman", fw, fp, (double) cbxFontSize.getValue())); // choiceBox.setOnAction((event) -> { int selectedIndex = cbxFontSize.getSelectionModel().getSelectedIndex(); Object selectedItem = cbxFontSize.getSelectionModel().getSelectedItem(); System.out.println("Selection made: [" + selectedIndex + "] " + selectedItem); System.out.println(" ChoiceBox.getValue(): " + cbxFontSize.getValue()); if (selectedIndex == 1) txtMsg.setFont(new Font(10)); if (selectedIndex == 2) txtMsg.setFont(new Font(20)); if (selectedIndex == 3) txtMsg.setFont(new Font(30)); if (selectedIndex == 4) txtMsg.setFont(new Font(40)); // txtMsg.setFont(new Font("Times New Roman", 10)); // String value = (String) cbxFontSize.getValue(); // txtMsg.setFont(new Font("Times New Roman", Double.parseDouble(value))); ----- මේ වගේ කරන්න බැරි ඇයි? // }); }
Choice box value එක index එකෙන් access කරන්නේ නැතුව
කෙලින්ම value එක විතරක් ගන්න විදිහක් නැද්ද double value එකක් විදිහට ?
මෝඩ ප්රශ්නයක් වෙන්න ඇති ඒත් හොයා ගන්න බැරි වුණා.