Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4464 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

http://docs.oracle.com/javase/tutorial/uiswing/components/progress.html

 

http://www.roseindia.net/java/example/java/swing/SwingProgressBar.shtml

 

 

Change any code with EXIT_ON_CLOSE to DISPOSE_ON _CLOSE otherwise FM will be closed each time

 

The question is how are you going to determine how far through a process the process is to pass the percentage completed values to the bar????

And for what kind of tasks??

Posted
A bit of code which works properly under the GroovyConsole, but not fully in SM.
Any clues as to why, and how to make it function 360works gurus??
I presume it is thread related.
 
// progressBar(interval, fm_title)
// 12_11_10 JR
// v1.0

import groovy.swing.SwingBuilder    
import javax.swing.WindowConstants as WC
import java.awt.BorderLayout as BL
import javax.swing.BorderFactory
import java.awt.Toolkit

i = 1

udate = {
	while(i < 101){
		current.setValue(i)
		try{
			sleep(interval.toInteger())
		} catch (e){} //end try
	i++
	} //end while
} // end udate

SwingBuilder.build(){
frame = frame(title:fm_title, size:[300,90], locationRelativeTo: null, show:true, defaultCloseOperation:WC.DISPOSE_ON_CLOSE){
    panel{
        borderLayout()
        current = progressBar(id:'pb', indeterminate:false, value:0, orientation:0, stringPainted:1, maximum:100, constraints:BL.NORTH)
        current.setBorder(BorderFactory.createEmptyBorder(10, 30, 10, 40))
        //textArea()
        label = label(text:'A label goes here', constraints:BL.SOUTH)
        label.setBorder(BorderFactory.createEmptyBorder(20, 30, 10, 12))
    } //end panel
} //end frame
}

udate(current)
label.setText("<html>" + "<font color="#FF0000">" + "<b>" + 
"Done . . . ." + "</b>" + "</font>" + "</html>")
Toolkit.getDefaultToolkit().beep()

//uncomment these lines in console for self closing window
//sleep(1200)
//frame.dispose()

 

 

Posted

Answered my own question...

wrap the SwingBuilder to the end in a

 

Thread.start(){ } closure and it displays correctly.

 

So now a better question

How do I return a result from the second thread?

This topic is 4464 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.