Saturday 15 August 2015

java - How to keep the item selection fixed in a combobox -


I am trying to create a unit converter in LWUT, and I am working with two composites.

It works like this online converter.

I have made it successfully, but I am facing a problem about Cambobox.

When I select an item on Cambodia and then select an item on any combobox, then the selection of the previous combo box is lost.

Because of this, I have to choose combobox again and again, even when I want to decide one of my units.

I want my application to work like this online unit converter, where selected once

any method that preserves your selection, unless You have not changed it manually?

I can not upload any image due to my low rating and there will be no use in providing code because it is too long and it is okay for the most part.

Please help me, any information really will be helpful.

  form b = new form (); String content = {"Content here for Kambox 1"}; String content2 = {"content here for combobox2"}; Lesser value 1 = new textaria (); Value1.setConstraint (TextArea.DECIMAL) Textairia Value2 = New Textaria (); Value2.setEditable (wrong); Final combo box V2 = new combo box (content 2); V2.setListCellRenderer (new checkbox renderer 1 ()); Final combo box V1 = new combo box (content); V1.setListCellRenderer (new checkbox renderer); V1.addActionListener {New Zero Action Action (Action Evant Evt) {int a = V1.getSelectedIndex (); Switch (A) {Case 0: int v2sel = V2.getSelectedIndex (); Switch (v2sel) { Case 0: Double D1; Value 2. Set Text (Value 1.gettext (); Break; Case 1: D1 = Double. PRADABB (Value 1.Gate Text) ()); D1 = D1 * 0.1; Price 2 .Set Text (double.tastring (D1)); Break; Case 2: D1 = Double. PRSD Double (value 1.getText ()); D1 = D1 * 1.0E-5; Value 2 .Settext (double.tastening (D1)); Break; // Multiple case statements} // multiple case statements}}); B.addComponent (V1); B.addComponent (value1); B.addComponent (V2); B.addComponent (value2); B.addComponent (Bexit); B.show (); // End    

Have you set the same model instance in both combo boxes?

Model control selection therefore also it will not work clearly.

No comments:

Post a Comment