aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Populate the 'current' JTextField via a button/label Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply locked New topic
Author

Populate the 'current' JTextField via a button/label

Lee Quinlan
Greenhorn

Joined: Aug 25, 2009
Posts: 9
This is my first post.! I'm hoping it's clear and concise enough for constructive replies !
I'm working on a very simple app for my PPC, trying to make best use of screen real estate and simplify text entry.
The application has a simple form with numerous text fields and I'd like to be able to click a button/label titled 'N/A' to populate the textfield that currently has focus with the same value ('N/A').
In other words, I want to click in the text field I want to popluate with N/A and instead of using the SIP keyboard and typing 'N/A' every time, I want to use a single '"N/A' button/label for any field.
I'm trying to write efficient code and so trying to avoid multiple buttons that just populate their neighboring textfield.
I've done plenty of goolge'ing before making this post but couldn't find anything that fit my scenario.
I get the feeling I should be capturing focus events, determining the component name that triggered the event and then '.setText'ing that component.
Easier said than done for me at my level though
Any help greatly appreciated.
Lee Quinlan
Greenhorn

Joined: Aug 25, 2009
Posts: 9
Apologies. I figured this post was best placed in the Beginning Java forum.
Posted in 'Beginning Java' instead
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19557
    
  16

Let's close this one and move the other thread here.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populate the 'current' JTextField via a button/label
 
Similar Threads
To get the focus around the text in a label like in a button
passing value between frames
Focusing Radio Button
Netbeans 6.1 webuijsf:Addremove problems.
Populate the 'current' JTextField via a button/label