Results 1 to 3 of 3
  1. #1
    consutes is offline Member
    Join Date
    Oct 2007
    Posts
    1
    Rep Power
    0

    Default Disable BACK and CANCEL buttons in wizard

    hi,

    I'm using a JFace wizard.
    I need to disable the BACK and CANCEL buttons after checking certain conditions, i don't know how to do that

    can you help me?

    Very thanks!!!

  2. #2
    SwinGirl is offline Member
    Join Date
    Nov 2007
    Posts
    24
    Rep Power
    0

    Default

    u can use fireChangeEvent.

    like that:


    Java Code:
    public class WizWizardPanel1 implements WizardDescriptor.Panel {
    
        private WizVisualPanel1 component;
        private final Set<ChangeListener> listeners = new  
        HashSet<ChangeListener>(1);
        
        public Component getComponent() {
            if (component == null) {
                component = new WizVisualPanel1();
                
            }
            return component;
        }
        
        public boolean isValid() {
            if(component == null){
                return false;
            }
            if ((component.getLbl1().getText().length()== 0) && 
                    (component.getLbl2().getText().length() == 0)){
                return true;
            }
            return false;
        }
        
        public final void addChangeListener(ChangeListener l) {
            synchronized (listeners) {
                listeners.add(l);
            }
        }
        public final void removeChangeListener(ChangeListener l) {
            synchronized (listeners) {
                listeners.remove(l);
            }
        }
       
        //firechange event calls to  isValid from stateChanged. if Valid is true, 
        //fireChange enable next o finish button.
    
        protected final void fireChangeEvent() {
            Iterator<ChangeListener> it;
            synchronized (listeners) {
                it = new HashSet<ChangeListener>(listeners).iterator();
            }
            ChangeEvent ev = new ChangeEvent(this);
            while (it.hasNext()) {
                it.next().stateChanged(ev);
            }
        }             
        
    }
    i let U here the Tom Wheelerīs site, where U can find a little example:
    Tom Wheeler's NetBeans Site

    itīs a little confusing, but not so hard (unless u play with wrappers like me, but itīs another issue. Nothing to do with this... :D ).

  3. #3
    SwinGirl is offline Member
    Join Date
    Nov 2007
    Posts
    24
    Rep Power
    0

    Default

    ou! JFace.. what a... sry.
    -.-
    well maybe this is useful to you, in some way...

Similar Threads

  1. Disable Radio button
    By AJG in forum New To Java
    Replies: 3
    Last Post: 05-10-2011, 11:09 AM
  2. disable parent window
    By ismailsaleh in forum AWT / Swing
    Replies: 1
    Last Post: 01-07-2008, 11:15 PM
  3. Netbeans Wizard?
    By SwinGirl in forum NetBeans
    Replies: 3
    Last Post: 11-08-2007, 04:34 PM
  4. Webservice wizard error?
    By marcelman in forum NetBeans
    Replies: 0
    Last Post: 08-10-2007, 02:46 AM
  5. Replies: 3
    Last Post: 06-07-2007, 05:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •