Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-29-2009, 07:13 PM
Member
 
Join Date: Jan 2009
Posts: 1
Rep Power: 0
sumit1mca is on a distinguished road
Default how to access jTextField of one JFrame1 from JFrame2 & Modify JTextField contents
hi,

I have created a package with JFrame having Panel on it. On the panel i have created button "Tab" which will behave like Tab button. I also have a button which will act as input for alpbabets (a,b,c ... z) i.e. one character at a time per click of that button.

This is working fine, if i modifying only one textField within that package, as i am reading text from the textField and then appending that TextField with old text from that TextField and adding new alphabet on per click of alphabet button.
but, but..

I have created another package within that project having another JFrame with panel and many jTextField on that panel. I want to use the already earlier created package and generalize the behaviour that it was showing with that package having a single textField, with the textField in the another created Package's TextField also. I had already imported the earlier package in new one.

behavour should be like this.

i should able to focus on each textField by clicking on Tab button created in earlier Package. when focus is on the textField i should able to append the text with new alphabets.

i have attached an snapshot of crated page ... to make my problem more clear

thanks in advance..
sumit
Attached Images:
File Type: jpg test.JPG (43.8 KB, 4 views)
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 01-30-2009, 07:44 PM
Steve11235's Avatar
Senior Member
 
Join Date: Dec 2008
Posts: 972
Rep Power: 2
Steve11235 is on a distinguished road
Default
So, you have two classes that extend JFrame.

MyJFrame1 contains a JPanel, myJPanel1, with the buttons.

You want to show myJPanel1 inside MyJFrame2.

The secret is to move myJPanel1 into its own class, MyJPanel1. You can then use MyJPanel1 from both of your other classes.

This is so simple, it sounds complicated. Just assume that it really is simple.

This is one of the truly great features of Swing. You can create your own components and use them anywhere with almost no effort.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Got problem with JtextField hungleon88 AWT / Swing 4 12-06-2008 04:01 PM
JtextField kashifu Advanced Java 2 06-27-2008 05:25 PM
how to focus to another JTextfield? birdofprey AWT / Swing 2 04-09-2008 02:08 PM
Using Columns With JTextField The Evil Genius AWT / Swing 1 03-17-2008 02:01 AM
help with JTextfield gary New To Java 4 07-11-2007 02:58 PM


All times are GMT +2. The time now is 06:38 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org