Re: Showing progress bar when opening images
Posted by
Ignacio Garcia-Gonzalez on
Mar 21, 2017; 9:22am
URL: http://imagej.273.s1.nabble.com/Showing-progress-bar-when-opening-images-tp5018335p5018338.html
> ImageJ automatically displays a progress bar as needed when reading and writing TIFF images and stacks.
>
> -wayne
Thank you for your quick reply. However, my concern is that I cannot see
this progress bar when opening the image from another frame, and I do
not find the way to do it. I even looked through the source code to try
to understand how the ProgressBar works.
The following piece of code opens an image, but the bar is not displayed
(running under Windows 10 with 64 bit Java 1.8.0_121). I was opening 200
Mb files, which displayed the progress bar when opening directly from
ImageJ.
import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import java.awt.event.*;
import ij.plugin.*;
import ij.plugin.frame.PlugInFrame;
import java.io.File;
import java.io.*;
public class Test1_ extends PlugInFrame implements ActionListener {
static private Button btnOpen=new Button("Open");
public Test1_() {
super("Open file test");
btnOpen.addActionListener(this);
add(btnOpen);
setResizable(false);
pack();
GUI.center(this);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
Object source=e.getSource();
if (source==btnOpen) {
ImagePlus imp=IJ.openImage(filename);
imp.show();
}
}
}
Greetings,
Ignacio.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html