Solved

How to display text in tabular form in AWT?

Posted on 2002-06-05
7
318 Views
Last Modified: 2013-12-29
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
Comment
Question by:vinaykn
  • 3
  • 3
7 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 7059370
why not use a JTable?
0
 
LVL 7

Expert Comment

by:Igor Bazarny
ID: 7059943
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
 

Author Comment

by:vinaykn
ID: 7060888
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 7

Expert Comment

by:Igor Bazarny
ID: 7061633
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
 

Author Comment

by:vinaykn
ID: 7066067
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
 
LVL 7

Accepted Solution

by:
Igor Bazarny earned 200 total points
ID: 7066380

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
 

Author Comment

by:vinaykn
ID: 7069355
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
reverse digits of a number using for loop 5 52
mysql jsp example issue 32 50
Chrome and Firefox Java 5 51
Java program running SQL query 5 37
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to implement Singleton Design Pattern in Java.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question