Instant copy while typing in a textbox – ZK

Reading Time: < 1 minute

I have been looking for the exact thing online and tried entire week how to copy instant typing to another textbox or label in zk, and finally I have come to the end of making one on my own. Normally you can do the same in zul but what I really needed in work project is with the controller. The below evaluate the code

zul:

<?page title="Instant Copy" contentType="text/html;charset=UTF-8"?>
<zk>
	<window title="Instant Copy"
		apply="com.tugrulaslan.controller.InstantController" border="normal"
		width="300px">
		<grid>
			<rows>
				<row>
					<label value="Source" />
					<textbox id="dataTXT" />
				</row>
				<row>
					<label value="Instant Copy" />
					<textbox id="copyTXT" readonly="true" />
				</row>
			</rows>
		</grid>
	</window>
</zk>

controller

package com.akbank.controller;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.zkoss.zhtml.Messagebox;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.Session;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.metainfo.ComponentInfo;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zk.ui.select.annotation.VariableResolver;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Button;
import org.zkoss.zul.Label;
import org.zkoss.zul.ListModelList;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.SimpleListModel;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Window;
import org.zkoss.zk.ui.event.*;

@VariableResolver(org.zkoss.zkplus.spring.DelegatingVariableResolver.class)
public class InstantController extends SelectorComposer<Component> {

	@Wire
	Textbox dataTXT;

	@Wire
	Textbox copyTXT;

	@Listen("onChanging = #dataTXT")
	public void butttonnn(InputEvent inputEvent){
		copyTXT.setValue(inputEvent.getValue());
	}
}