0

error on focus

asked 2009-12-24 18:59:41 +0800

GuzZpaWn gravatar image GuzZpaWn
111 2

i have the next code:

public void onOK$txtNombres(Event evt)throws InterruptedException{
dbxFNac.focus();
}

where dbcFNac is a Datebox

it throws this error: java.lang.NullPointerException.

using zk 3.6.3 with netbeans 6.8

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2009-12-24 19:27:42 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

have you override this method ?

 public void doAfterCompose(Component comp) throws Exception {
        super.doAfterCompose(comp);       
 }

you must to override this method
and call super.doAfterCompose(comp);

link publish delete flag offensive edit

answered 2009-12-24 19:48:09 +0800

GuzZpaWn gravatar image GuzZpaWn
111 2

ok... overriding .. it throws the same error

public class frmCliente extends GenericForwardComposer implements iFrm {
private Textbox txtNombres;
private Datebox dbxFNac;

@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
}
public void onCreate$wFrm(Event evt){
......
}
public void onOK$txtNombres(Event evt){
dbxFNac.focus();
}

}

link publish delete flag offensive edit

answered 2009-12-24 20:18:47 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

this is my sample

zul

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
	<window apply="ctrl.MyComposer">
		<textbox id="txtNombres"/>
		<datebox id="dbxFNac"/>
	</window>
</zk>

composer

package ctrl;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.*;

public class MyComposer extends GenericForwardComposer {
	private Textbox txtNombres;
	private Datebox dbxFNac;
	
	@Override
	public void doAfterCompose(Component comp) throws Exception {
		// TODO Auto-generated method stub
		super.doAfterCompose(comp);
	}

	public void onOK$txtNombres(Event evt) {
		dbxFNac.focus();
	}
}

it works well

link publish delete flag offensive edit

answered 2009-12-24 20:28:00 +0800

GuzZpaWn gravatar image GuzZpaWn
111 2

ok... thank you so much

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-12-24 18:59:41 +0800

Seen: 354 times

Last updated: Dec 24 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More