• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 325
  • Last Modified:

How to display text in tabular form in AWT?

How to display text in tabular form in AWT?Can i use TextArea for this? Can i update particular field in runtime, without touching other fields? Can anyone give me any suggession in designing?
0
vinaykn
Asked:
vinaykn
  • 3
  • 3
1 Solution
 
bobbit31Commented:
why not use a JTable?
0
 
Igor BazarnyCommented:
Hi,

I would use either JTable, or several fields (TextFields) layed out using GridLayout or GridBagLayout. TextArea could also work, but update of particular field would require change of whole TextArea content.

Why don't you use swing?

Regards,
Igor Bazarny,
BrainBench MVP for Java 1
0
 
vinayknAuthor Commented:
I cant use swing because all of my customers are not having swing compatiability for their browsers.  I am not for plug-in, cos while refreshing(repainting, updating) my screen it always getting hanged. I see many in forums that many facing same problem while refreshing screen when plug-in is used.  

Here i am using Array of Labels using GridLayout in contrary to using canvas and repainting it according when an updation to particual field position.  Can anybody tell me whether i am approaching good way in choose Array of Labels instead Canvas???  I am not much aware of memomy problems.  I feel it doesnt require repainting of whole screen, just using setText() method of particular Label when any updation came.

Hope you all respond.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Igor BazarnyCommented:
Hi,

I would say that using Canvas would meam more work, but labels would probably be a bit slower and consume a bit more memory. Typically, this is not the issue. Take care of label sizes/scrolling: what are you going to do if text doesn't fit into existing label? You may reserve enough space in advance, relayout pane when necessary or use disabled textfields--they provide rudimentary scrolling capabilities, if I'm not mistaken.

Regards,
Igor Bazarny
0
 
vinayknAuthor Commented:
Thanks for suggestion Bazarny.  Though its not a issue, how come labels become bit slower?  I thought, repainting canvas everytime instead setting text to label is easy. I am not sure which can be more slower.  Size/scrolling things are ok as per my application.  Will Disabled textfields give more flexibility than labels?  Need more suggestions and comments, i need to finalise my desite. Thanks for all.
0
 
Igor BazarnyCommented:

Well, you can repaint only necessary region of canvas, so it's possible to get comparable to labels repaint performance. When you have a lot of labels, each of them uses a bit of memory, and a bit of repaint processing, especially when you need to repaint the whole applet (e.g. when it was covered by another window). If scrolling is not an issue, textfield is not better than label, otherwise textfield would scroll when user moves focus to it and moves caret.

Regards,
Igor Bazarny
0
 
vinayknAuthor Commented:
Thanks for discussion Bazarny.  I stick to Array of labels than canvas.  I find more flexibility while updating the particular field.  Here textfiled is not an issue, as my application doesnt need special attributes like scrolling etc. Still you have anything to comment on memory point of view, you are always welcome, though i close this question.  Thanks again for your suggestions.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now