These tips all depend on using Eclipse.
Start with all the ClickListeners and do them all at once. Use Eclipse "Java Search": Search String = ClickListener, Search For = Type, Limit To = References.
For simple click situations, copy these lines:
.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event)
{
and paste them in to replace every instance of
.addClickListener(new ClickListener() {
public void onClick(Widget sender)
{
Here's an extra tip: Instead of pasting the above code from here, paste it once into one of your classes. Once you get it valid there, copy that and paste it in to replace all your listeners. When you copy and paste this way, eclipse automatically pulls in the imports for you as well.
If the sender parameter had been used, replace references to it with event.getSource(). You will probably have to cast it.
For other situations, make heavy use of auto-complete (CTRL-SPACE). For example
myObject.addCl<CTRL-SPACE><ENTER> -> myObject.addClickHandler()
myObject.addClickHandler(new <CTRL-SPACE><ENTER>) -> myObject.addClickHandler(new ClickHander)
myObject.addClickHandler(new ClickHander() {<ENTER>) ->
myObject.addClickHandler(new ClickHander() {
})
myObject.addClickHandler(new ClickHander() {
<CTRL-SPACE><ENTER>
})
->
myObject.addClickHandler(new ClickHander() {
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
}
})
Final tip: Put your cursor at the end of a listener class name (ex: new ClickListener|()) and press <CTRL-SPACE>. This will bring up the class along with other suggestions in a list. But it will also show the Java Doc for that class, which will tell you what handler(s) you should use instead. The same works for methods like addClickListener().
I write about evolutionary anthropology, behavioral sciences, and related AI, particularly small, specialized Deep Neural Networks and LLMs.
As an Amazon Associate I earn from qualifying purchases.
Subscribe to:
Post Comments (Atom)
Post Scriptum
The views in this article are mine and do not reflect those of my employer.
I am preparing to cancel the subscription to the e-mail newsletter that sends my articles.
Follow me on:
X.com (Twitter)
LinkedIn
Google Scholar
I am preparing to cancel the subscription to the e-mail newsletter that sends my articles.
Follow me on:
X.com (Twitter)
Google Scholar
My favorite quotations..
“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.” by Robert A. Heinlein
"We are but habits and memories we chose to carry along." ~ Uki D. Lucas
Popular Recent Posts
-
In my journey building software and managing technology teams, I've often witnessed the allure and danger of what Melissa Perri aptly na...
-
This is an example of an entertaining, AI-generated fictional story posing as “real-life stories”. I believe this “posing” should be outlawe...
-
If you want a straightforward choice that feels smart, responsive, and fits on a Mac with 64 GB RAM, pick Mistral-Small-3.2-24B-Instruct-250...
-
I tested to belong to Haplogroup R1b1b2a1a1d1. Subclade R1b1b2a1a1d1* (as named by 23andMe ) or R1b1a2a1a1a4 (per FTDNA ) is a paternal (...
-
Physics and the laws of relativity: in parent-child relationship sound waves reach the subject after 25 years.
-
I decided to write down a few thoughts to clarify my obsessions with creating the "multitude" of AI agents that rely on the privat...
-
I am pleased with the performance and depth of the 32B Qwen MLX, running locally on my Mac Studio M1 with 64GB of RAM. 9 tokens per second ...
-
Choice D Since we are currently renting, we started looking at the houses we could afford. This place fits our budget, but the baby blue col...
Most Popular Articles
-
In my journey building software and managing technology teams, I've often witnessed the allure and danger of what Melissa Perri aptly na...
-
Choice D Since we are currently renting, we started looking at the houses we could afford. This place fits our budget, but the baby blue col...
-
I tested to belong to Haplogroup R1b1b2a1a1d1. Subclade R1b1b2a1a1d1* (as named by 23andMe ) or R1b1a2a1a1a4 (per FTDNA ) is a paternal (...
-
I have noticed a very unsettling statistic on my blog. This prompted a fascinating question about AI, blogs' future, and maybe even the...
-
This is an example of an entertaining, AI-generated fictional story posing as “real-life stories”. I believe this “posing” should be outlawe...
-
I decided to write down a few thoughts to clarify my obsessions with creating the "multitude" of AI agents that rely on the privat...
-
I have run a quick test on a few LLM models I have installed locally on Mac OS with 64 GB of RAM. The test was conducted in English, but it ...
-
Prompt: What do you really see in the selfie of myself? AI: I see a volcano about to blow up and I see a lost, scared boy in front of it. ...
No comments:
Post a Comment
Please be polite.