> I have to dispaly dynamic method invocation results
> inside a Jscrollpane.Which one is more advisable
> JTextArea or JTextPane to be used inside the scroll
> pane?
Depends on your requirements. Is plain text okay or do you need any styled text as well? If the latter, use JTextPane.
Thank you.
finally i used JTextArea to display my results.
But no TextArea is being displayed ,not only that the whole contentpane is going blank.I am doing this in JDeveloper.
I have used this code.Please tel me what went wrong.
JTextArea resultArea=new JTextArea();
resultArea.setBounds(new Rectangle(290, 225, 455, 260));
resultArea.setBorder(BorderFactory.createTitledBorder("METHOD INVOCATION RESULT"));
resultArea.setEditable(false);
resultArea.setLineWrap(true);
resultArea.setRows(100);
c.add(resultArea, null);//Add to contentPane
resultArea.setDocument(new PlainDocument());
......................
....................
Object result = method.invoke(instance, parameters);
String r=(String)result;
resultArea.setText(r);
scrollPane.getViewport().add(resultArea,null);
.................
.....................................
Thank you
Why do you explicitly call setDocument() on resultArea? Isn't it enough to
call resultArea.setText() when you have some content?
You add the result Area to a thing called "c", then later you add it to something
that is probably a JViewport. Perhaps you don't make this latter component
visible.
In any case, perhaps you could post some brief compiliable code that
illustrates your problem. (The act of making the code a manageable size
will help you focus on what the problem actually is).