java - Setting text on Button inside Selection Listener of the same button in SWT -
i have requirement on selection of button need process stuff , based on result have set text on same button. below sample snippet.
buttonorganization = new button(parent, swt.push); orgselectionbtnlistener listnerbutton = new orgselectionbtnlistener( buttonorganization, session, false, false ); buttonorganization.addlistener( swt.selection, listnerbutton);
and orgselectionbtnlistner class below
private class orgselectionbtnlistener implements listener, propertychangelistener { public orgselectionbtnlistener( button orgbutton, session session, boolean isuser, boolean isgrp ) { } @override public void propertychange( propertychangeevent evt ) { string propname = evt.getpropertyname(); if( propname.equals( "orgchanged" ) ) { buttonorganization.settext("new group user"); } } @override public void handleevent( event arg0 ) { buttonorganization = ( button ) arg0.widget; swingutilities.invokelater( new runnable() { //display.getdefault().asyncexec(new runnable() { //@override public void run() { orgselectiondialog.addpropertychangelistener( orgselectionbtnlistener.this ); } } ); } }
appreciate help.
make button variable private or final. add selection listener using anonymous class of selection listener..
btn.addselectionlistener(new selectionlistener....
perform task inside method of , settext using
btn.settext(" ");
according result.
Comments
Post a Comment