• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Hemanth Kumar Simhadri
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Erik Pathin
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic