logo       

Re: How to display file data in TextWindow or TextPanel?: msg#00225

java.imagej

Subject: Re: How to display file data in TextWindow or TextPanel?

There are many TextWindow examples in the ImageJ source code. You can find them by downloading the source from <http://rsb.info.nih.gov/ij/download/src/> and using the Find macro at <http://rsb.info.nih.gov/ij/macros/Find.txt> to search for "TextWindow". Here are some of the ImageJ commands that use TextWindows:

"List" button in Image>Color>Show LUT
"List" button in Analyze>Histogram
"List" button in Analyze>Plot Profile
Plugins>Utilities>List Commands
Plugins>Utilities>List Shortcuts

You should also check out the TextWindow API at:

http://rsb.info.nih.gov/ij/developer/api/ij/text/TextWindow.html

-wayne

On Mar 23, 2006, at 2:21 AM, zhao yl wrote:

However, this method can not set the headings of the TextWindow like
the ImageJ's ResultsTable class.
What I want to do is:
1. read the data from the file
2. store every line into the ArrayList
3. display one record per line in the TextWindow:
-------------------------------
ID Name
1 20020704001 plugin
2 20020704002 pluginfilter
3 20020704003 pluginframe
-------------------------------
TextWindow uses TextPanel to display data, but I do not know how to
format and dispay data in it.

Yili Zhao

yeliang wrote:

In TextWindow constructor like
: public TextWindow(String title, String data, int width, int height)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The second parameter "data" is what you desire to display.

To meet your needs, headings may be added by string operations.

Like this,
__________________________________________________
int count = 0;
String data = "\t\tID\t\tName\r\n";
// Suppose "str" is ONE record of your data file
data += Integer.toString(count++) + "\t\t" + str +"\r\n";
// Iterate the operation obove, it may produce the result you want.




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise