This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to Resize ProgressMonitor? How to display the message/note in two lines in progress monitor? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to Resize ProgressMonitor? How to display the message/note in two lines in progress monitor?" Watch "How to Resize ProgressMonitor? How to display the message/note in two lines in progress monitor?" New topic
Author

How to Resize ProgressMonitor? How to display the message/note in two lines in progress monitor?

Hemanth Kumar Simhadri
Ranch Hand

Joined: Apr 22, 2010
Posts: 32
I am facing some problem with Progress Monitor. My Progress Monitor Displays a dynamic message which increases in length. Because of this, the message is getting truncated (cutting off) at the end and the message is not shown completely. The size of the progress monitor is not increasing dynamically along with the text. Is it possible to display the message in two lines in the progress monitor?

My actual code is like this:


ProgressMonitor progressMonitor = new ProgressMonitor(context.getMyParentFrame(),
"PM Search in progress...",
"Calculating file numbers...",
0, 100);

progressMonitor.setMillisToDecideToPopup(0);
progressMonitor.setMillisToPopup(0);
progressMonitor.setProgress(1);

note = "Searching file " + currentFileNumber +
"/" + totalNumberOfFiles + "... Found " +
(searchResults.size() + results.size()) +
" records...";

progressMonitor.setNote(note);

In the above note currentFileNumber, searchResults.size() and results.size() are the dynamic numbers

I tried to display the message in two lines in this way:

note = "Searching file " + currentFileNumber +
"/" + totalNumberOfFiles+"...";
note += "\n"+"Found " +
(searchResults.size() + results.size()) +
" records...";

But this didn't worked. So I again tried by embedding the line break of HTML in progress monitor note like this:

<html> <br></br></html>

This also didn't worked. Please help in this
Peter Taucher
Ranch Hand

Joined: Nov 18, 2006
Posts: 174
HTML code works in a ProgressMonitor (the note is simply a JLabel). To alter the private dialog's size is although another matter. To achieve such a behaviour you'd have to implement your own ProgressMonitor like mentioned here:
http://www.coderanch.com/t/457018/GUI/java/Change-size-progress-monitor


Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
Erik Pathin
Greenhorn

Joined: Mar 29, 2011
Posts: 1
Hi,

Your problem is probably solved already, but here is a simple way to do it :



The ProgressMonitor sizes to the length of the title string, but doesnt show the \t at the end.
 
Don't get me started about those stupid light bulbs.
 
subject: How to Resize ProgressMonitor? How to display the message/note in two lines in progress monitor?
 
Similar Threads
Java swing background execution
How to put ProgressMonitor bar while saving a file
Change size of progress monitor
Problem with ProgressMonitor
Progress of Zipping of folder on ProgressMonitor??