View Single Post
  #1 (permalink)  
Old 02-12-2008, 08:10 PM
nancyhung nancyhung is offline
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));
..
..
Reply With Quote
Sponsored Links