Salve a tutti, ho un problema con una window come gestisco l'abilitazione di una textarea selezionando una voce di una combobox?
il mio codice è questo
In breve quando seleziono totalerg dovrebbe abilitarmi la textarea reteC, entra correttamente nel if ma ignora il comand setEnable(true) come mai? Dove sbaglio?
Grazie a tutti
codice:[...] /** * Create contents of the window. */ protectedvoid createContents() { shell = new Shell(); shell.setSize(450, 381); final Combo tipoR = new Combo(shell, SWT.NONE); tipoR.setItems( new String[] {"Eni", "TotalErg"}); tipoR.setToolTipText( "Eni o pvt / TotalErg"); tipoR.setBounds(175, 99, 85, 23); tipoR.select(0); reteC = new Text(shell, SWT.BORDER); reteC.setEnabled(false); reteC.setToolTipText("es. 10.1.1.0"); reteC.setBounds(175, 138, 121, 21); tipoR.addSelectionListener( new SelectionAdapter() { @Override publicvoid widgetSelected(SelectionEvent e) { Display display = Display.getCurrent(); System. out.println(e.widget);//.toString()); if(e.widget.toString().equalsIgnoreCase(("Combo {TotalErg}"))) { System. out.println("entro"); reteC = new Text(shell, SWT.BORDER); reteC.setEnabled(true); reteC.setToolTipText("es. 10.1.1.0"); reteC.setBounds(175, 138, 121, 21); } else{ reteC = new Text(shell, SWT.BORDER);; reteC.setToolTipText("es. 10.1.1.0"); reteC.setBounds(175, 138, 121, 21); reteC.setEnabled(false); } } });


Rispondi quotando