Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-12-2008, 08:10 PM
Member
 
Join Date: Jan 2008
Posts: 5
nancyhung is on a distinguished road
Can we add JCheckBox array into JTextArea?
I cannot add the JCheckBox array one by one within the JTextArea, but only can add them into the JPanel one by one.

Is it possible to add the JCheckBox array within the JTextArea ??

Thanks !!

Nancy



Code:

..
..
...
rightUpper_left = new JPanel(); //right upper left panel
rightUpper_left.setLayout(new GridLayout(3, 1));

textArea2 = new JTextArea(22,60);
textArea2.setEditable(false);

image = new JCheckBox[3];

for (int i = 0; i < 3; i++)
{
image[i] = new JCheckBox(getImageData(i+1) + "" + anno_label);
//textArea2.append(image[i] + "");
//textArea2.append(image[i].toString());
rightUpper_left.add(image[i]);
}

for (int i = 0; i < 3; i++)
{
CheckBoxHandler handler = new CheckBoxHandler();
image[i].addItemListener(handler);
}

textArea2.setText(getImage());
rightUpper_left.add(new JScrollPane(textArea2,JScrollPane.VERTICAL_SCROLLB AR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEED ED));
..
..
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-17-2008, 01:07 AM
Senior Member
 
Join Date: Jul 2007
Posts: 1,029
hardwired is on a distinguished road
Is it possible to add the JCheckBox array within the JTextArea ??
It may be but probably won't work very well. It is better to add JCheckboxes to a JPanel. Since both the JTextArea and the JCheckBox consume/use MouseEvents there will probably be some confusion about who is use the events.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


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

vB 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
JTextArea setting newtojava7 New To Java 1 01-29-2008 03:57 AM
JTextArea saytri New To Java 0 01-13-2008 02:07 AM
jcheckbox issues need help. thanks. carlos123 New To Java 3 11-05-2007 11:37 PM
using JCheckBox, JButton and JTextArea with JDBC warship Database 1 08-08-2007 02:25 AM


All times are GMT +3. The time now is 01:12 AM.


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