Applet tiff viewer
hi,
Can any body give some sample code or idea how can display tiff image or tiff file in a web browser.
Thanks in advanced.
i have a code here displaying single tiff file in directory
can i put it in an iframe of a html/jsp file?(correct me if im wrong)
how does it done?
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.renderable.ParameterBlock;
import java.io.File;
import java.io.FilenameFilter;
import java.net.URL;
import javax.media.jai.InterpolationNearest;
import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSlider;
import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.sun.media.jai.widget.DisplayJAI;
* @author Sherwin_Macatangay
public class TIFFViewer extends JFrame {
private static final long serialVersionUID = 1L;
String currentFile;
private String DIRECTORY;
private int currentPage;
private int pageCount;
private File F_DIRECTORY;
private File tiff;
private Container cPane;
private JScrollPane display;
private JPanel topBar;
private JLabel unReadable;
public JLabel pageCounter1;
public JTextField pageCounter2;
private JLabel pageCounter3;
private JSlider slider;
private DisplayJAI Dpanel;
// private RenderedImage tiffFile;
private PlanarImage tiffImage; // the original TIFF image
// constructor
public TIFFViewer() {
// TODO Auto-generated constructor stub
@SuppressWarnings("deprecation")
public TIFFViewer(String directory) {
// TODO Auto-generated constructor stub
DIRECTORY = directory;
F_DIRECTORY = new File(DIRECTORY);
if (F_DIRECTORY.isDirectory()) {
getPageCount();// get the count of file(s) in a directory
for (File file : F_DIRECTORY.listFiles()) {
if (file.getName().toLowerCase().endsWith(".tif")) {
tiff = file;
//tiff = fileTIFF;
javax.swing.JOptionPane.showMessageDialog(null, "Tiff: "
+ tiff);
break;
}else{
newImage(tiff);
//newImage(tiff);
PlanarImage image = JAI.create("fileLoad", tiff.getAbsolutePath());
if (image == null) {
System.out.println("image " + image);
Scale(image);
} else {
Scale(image);
currentPage = 1;
pageCounter2 = new JTextField(currentPage);
pageCounter3 = new JLabel("of " + pageCount);
initViewer();
return;
}// end TIFFViewer()
* @param args
public static void main(String[] args) {
// TODO Auto-generated method stub
TIFFViewer TW = new TIFFViewer();
TW.begin("./web content/images/layout/");
}// end main()
public void begin(String args) {
// We need one argument: the TIFF directory.
if (args.length() == 0) {
System.err.println("Usage: java operators.TIFFViewer image");
javax.swing.JOptionPane.showMessageDialog(null,
"Usage: java operators. TIFFViewer image");
System.exit(0);
new TIFFViewer(args);
}// end begin()
public void initViewer() {
cPane = getContentPane();
cPane.setLayout(new BorderLayout());
topBar = new JPanel();
topBar.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
// setup page display and changer
Component[] itemsToAdd = initChangerPanel();
for (int i = 0; i < itemsToAdd.length; i++) {
topBar.add(itemsToAdd);
cPane.add(topBar, BorderLayout.NORTH);
display = new JScrollPane();
if (tiffImage == null) {
unReadable = new JLabel(
"The file is unreadable or there's no file!");
display = new JScrollPane(unReadable);
} else {
Dpanel = new DisplayJAI(tiffImage);
display = new JScrollPane(Dpanel);
cPane.add(display, BorderLayout.CENTER);
// pack();
// setSize(800,700);
setTitle(tiff.getName());
setSize(getToolkit().getScreenSize().width, 700);
setLocationRelativeTo(null);// center on screen
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}// end initViewer()
public void getPageCount() {
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".tif");
String[] children = F_DIRECTORY.list(filter);
pageCount = children.length;
}// end getTIFFPageCount()
private Component[] initChangerPanel() {
Component[] list = new Component[10];
// Create the start button and set icon
/** start page */
JButton start = new JButton();
start.setBorderPainted(false);
URL startImage = getClass()
.getResource("/winmac/gui/generic/start.gif");
start.setIcon(new ImageIcon(startImage));
start.setText("Start");
start.setToolTipText("Back to start page");
list[0] = start;
start.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (currentPage != 1) {
currentPage = 1;
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".tif");
int i = currentPage;
File filename;
File[] startTiff = F_DIRECTORY.listFiles(filter);
if (i == i) {
// Get filename of file
filename = startTiff[i - 1];
tiff = filename;
newImage(tiff);
// set page number display
pageCounter2.setText(String.valueOf(currentPage));
/** back 1 page */
JButton back = new JButton();
back.setBorderPainted(false);
URL backImage = getClass().getResource("/winmac/gui/generic/back.gif");
back.setIcon(new ImageIcon(backImage));
back.setText("Back");
back.setToolTipText("Back page");
list[1] = back;
back.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (currentPage > 1) {
// currentPage -= 1;
currentPage--;
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".tif");
int i = currentPage;
File filename;
File[] backTiff = F_DIRECTORY.listFiles(filter);
if (i == i) {
// Get filename of file
filename = backTiff[i - 1];
tiff = filename;
newImage(tiff);
// set page number display
pageCounter2.setText(String.valueOf(currentPage));
// Create the pageCounter1, pageCounter2 and set its labels
pageCounter1 = new JLabel("Page");
list[2] = pageCounter1;
list[3] = new JPanel();
// Create the pageCounter2 and set its labels
pageCounter2 = new JTextField(5);
pageCounter2.setEditable(true);
pageCounter2.setText(String.valueOf(currentPage));
list[4] = pageCounter2;
/**pageCounter2.addKeyListener(new KeyAdapter(){
public void keyReleased(KeyEvent me){
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".tif");
int i = Integer.parseInt(pageCounter2.getText());
System.out.println(i);
File filename;
File[] getTiff = F_DIRECTORY.listFiles(filter);
if (i==i){
filename = getTiff[i-1];
tiff = filename;
newImage(tiff);
list[5] = new JPanel();
list[6] = pageCounter3;
/** next one page */
JButton next = new JButton();
next.setBorderPainted(false);
URL nextImage = getClass().getResource("/winmac/gui/generic/next.gif");
next.setIcon(new ImageIcon(nextImage));
next.setText("Next");
next.setToolTipText("Next page");
list[7] = next;
next.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (currentPage < pageCount) {
// currentPage += 1;
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".tif");
int i = currentPage;
File filename;
File[] nextTiff = F_DIRECTORY.listFiles(filter);
if (i == currentPage) {
// Get filename of file
filename = nextTiff[i];
tiff = filename;
newImage(tiff);
currentPage++;
// set page number display
pageCounter2.setText(String.valueOf(currentPage));
/** end page */
JButton end = new JButton();
end.setBorderPainted(false);
URL endImage = getClass().getResource("/winmac/gui/generic/end.gif");
end.setIcon(new ImageIcon(endImage));
end.setText("End");
end.setToolTipText("End page");
list[8] = end;
end.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (currentPage < pageCount) {
currentPage = pageCount - 1;
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".tif");
int i = currentPage;
File filename;
File[] endTiff = F_DIRECTORY.listFiles(filter);
if (i == currentPage) {
currentPage = pageCount;
// Get filename of file
filename = endTiff[i];
tiff = filename;
newImage(tiff);
// set page number display
pageCounter2.setText(String.valueOf(currentPage));
/** slider */
slider = new JSlider(600, 12000, 12000);
slider.setToolTipText("Scale image");
list[9] = slider;
slider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
// If interactivity is off and we're still adjusting, return.
// Gets the scale (converting it to a percentage)
float scale = slider.getValue() / 12000f;
// Scales the original image
ParameterBlock pb = new ParameterBlock();
pb.addSource(tiffImage);
pb.add(scale);
pb.add(scale);
pb.add(0.0F);
pb.add(0.0F);
pb.add(new InterpolationNearest());
// Creates a new, scaled image and uses it on the DisplayJAI
// component
PlanarImage scaledImage = JAI.create("scale", pb);
Dpanel.set(scaledImage);
return list;
}// end initChangerPanel()
public void Scale(PlanarImage image) {
try {
tiffImage = image;
} catch (Exception e) {
System.err.print("Scale " + e.getMessage());
}// end Scale()
public void newImage(File tiff) {
// javax.swing.JOptionPane.showMessageDialog(null, "TIFF FILE:" + tiff);
setTitle(tiff.getName());
PlanarImage image = JAI.create("fileLoad", tiff.getAbsolutePath());
Dpanel.set(image);
Scale(image);
}// end newImage()
}// end class TIFFViewer
Similar Messages
-
I can't view TIFF files, specifically at < <a class="jive-link-external-small" href="http://">http://www.originsnetwork.com/help/popup-helpimages.htm > Sorry, can't remember how to make link clickable.
This link explains what I am trying to do. I have followed all instructions, & finally installed Accel View TIFF demo internet plug-in. Nothing I do will work with Safari. I went to QuickTime & unchecked the TIFF Viewer box, incase there was a conflict, to no evail. The plug-in will work with Internet Explorer, but it is quite expensive. Graphic Converter also will work with IE, but it is a bit of a hassle &, I want to use Safari. Any ideas most appreciated, Thanks, ColleenCollen,
Thanks for the reply I did look at the page you linked us to, which is for troubleshooting the plugin, just wanted to make sure I understood so the images you need to view are on this web site
Did you place the Plug in the Internet Plug-Ins folder found in HD/Library/Internet Plugins folder, then do a reboot.
See if that helps any.
edited by: Eme additionally it seems the web site has this alernate method in viewing without the plug in, if they chose to ? by using a Java applet,
http://www.acordex.com/browseProd/VTplugin.html
see the bottom of this page ^ -
Need Multi-Page TIFF Viewer Add-In for Safari
Greetings - Any recommendations on a (preferably free of charge) multi-page TIFF viewer add-on for Safari?
Thanks.Sorry for the delayed reply as I cannot access from work.
Here is the link to the tool...
[http://www.daeja.com/products/viewone1.asp]
Here is what I did so far:
I copied ViewONE files to my \forms\java directory
Added the ViewONE ji.jar reference to my 'archive_jini' parameter in formsweb.cfg
Create a Bean item on my form
Added 'ji.applet.jiApplet.class' to my Implementation class property for item
when I invoke the layout, I get the following error:
FRM-13008 Cannot find JavaBean with name 'ji.applet.jiApplet.class'.
Appreciate any info to get this going. -
Use TIFF-Viewer (ActiveX) in ABAP-Programm
Hy all,
I am looking for a Viewer for TIFF-documents that can be used in a ABAP-Container.
The Viewer should offer methods or parameters to get the zoom-area, that the user has selected, and to set the same zoom-area in the next document that will be opened.
I found some TIFF-Viewers (BravaX, CADViewX from Softgold ...) that work but all of them have the problem, that the wanted function with the zoom-area doesn´t work exactly.
Have anyone of you made well experience with a TIFF-Viewer in SAP?
Thanks a lot for help.
Harrycheck out this weblog.
[Using Classic ActiveX Controls in the ABAP Control Framework|/people/thomas.jung3/blog/2005/05/11/using-classic-activex-controls-in-the-abap-control-framework] -
Tiff viewer for text files.
I recently purchased an iPad 3. I need to view and sign tiff files that are text form sent from my office. How can I save them and send them back? The only information I can find so far are referring to picture files. What type of app do I need?
All I could find is a tiff viewer:
http://appshopper.com/productivity/tiff-fax-viewer
There are computer apps that can convert them to PDFs and there are many PDF readers apps for the iPad that allow you to sign/annotate PDFs. GoodReader is one. There is also PDF Annotate. -
Unaasociating TIFF viewing with Quicktime
After installing Quicktime for Windows it automatically associated Tiff viewing in IE. I do not wish to have Quicktime handle my TIFF viewing needs. I would rather use Windows picture and fax viewer but even if I change the default association in folder settings it still opens in IE which I guess wouldn't be a problem but when I print them from IE it prints a blank page. I have turned on print background image in IE thinking tha would resolve the problem but still nothing. How can I restore the file association to Windows picture and fax viewer?
QuickTime Control Panel Browser tab MIME Settings
Under Images - Still Images remove the check mark for TIFF
Quit and relaunch your browser for these changes to take effect. -
Tiff Viewer which disables print, copy and save TIFF file
I am looking TIFF Viewer solution which woul disable any print, save and copy functions for a TIFF file. Thisfunctionality is available for PDF but I need to disable print, copy and save for TIFF files.
Would anyone know a TIFF viewer or solution that supports the following functions:
1) TIFF viewer where we can turn off any options to print the TIFF file or save it to disk. That would include disabling any options where the user could right click on the TIFF and save the file somewhere else.
2) It would need to be able to open multi-page TIFFs.
3) It would be nice if the TIFF viewer could be run on both Mac and Windows platforms.
I need to send files to users for view only, and these should be in TIFF fomat, not converted into a PDF.
Thank you for your help.
Regards,
SapnaThe same answer applies to any kind of file.
You need a Digital Rights Management solution. Very expensive. -
Applet is viewed by appletviewer but not browser
Hello All:
I have created several applets, and they all can be viewed by appletviewer. Some of them can be viewed by both appletviewer and the browser, and I have Internet Explorer. I realized that if in an applet a class extends JApplet, then that applet cannot be viewed by the browser but appletviewer let you view it. Classes in all the other applets extends Applet, and these applets will easily be viewed by both browser and the appletviewer. Could someone please let me know what the problem is? My guess is the platform setting. The platform is J2EE, and each applet and the related files such as html file containing applet tag, etc are in the same directory.
Thanks,it shows up and when i click it shows the mouse position if i somehow refresh the screen (like move some window over the applet )
it should be repainting but doesn't seem to either... and it doesn't seem to be reading from the file... but all this works fine with the appletviewer...
udam -
Is their a Tiff viewer compatible with the US Patent Office Web Site?
Viewing image files of pre-1948 patents at the USP&TMO site requires a compatible Tiff file viewer. The one built into FF4 and previous versions does not work. Is there a plug-in for this? In the past AccelViewTiff worked. Quicktime doesn't work except on Safari.
Mac OS X 10.5.8No luck. I installed ToyViewer and instructed Firefox to use ToyViewer to view Tiff files, but it does not appear to work on the Patent Office site. The PO apparently uses some weird compression scheme that most Tiff viewers cannot handle. It was designed for the Netscape browser. Perhaps some kind patent junky will build a plug-in for Firefox that displays the Patent images? : )
-
Which applet to view office file ?
Hi all,
I have a program to view file. I receive a stream and must render to client (must control). I don't know which applet to render office file ?
ThanksI'm confused, you're coding for the server-side, with JSP/servlets aren't you? So how can you intercept the stream at the browser? That'll be beyond your code.
And anyway, if you set the MIME types and set the content for the response, the browser itself will decide and prompt the user for handling the file.
If on the other hand, you want to open a file on the server and send the contents of that to the browser, you can look into Apache POI (http://poi.apache.org/) for handling Excel, Word and PowerPoint documents. -
My iPhone is trying to open PDF Mail attachments with tiff viewer
I receive my faxes via email. They are delivered as PDF files. Sometimes when I try to open them on my iPhone, it says that it cannot open the tiff file. The attachment is clearly named with a .pdf file extension, but the iPhone still tries to open it as a tiff. Other PDFs open fine, but it treats these as if they are tiff files.
George is correct. XFA forms (which the mobile Reader does not support) are often built with a generic error (like the one described) page that displays for Readers that do not support these document types.
-
How can I get back to the standard .TIFF viewer in my browser ?
Hello,
I have installed iTune on my PC. Since then I can no longer use the standard MSW picture viewer. This one allows me to rotate and resize pictures, and I cannot do this with QT. How can I get back ? I tried to use the "External module management" of my browser, but it was useless.
Thanks for your help,
ThierryI am speaking of the browser situation. And I did the uncheck, on both "MIME" and "File Types" panes, without success. I even tried to restart my computer, and I still have this f... Quicktime coming ! Sorry. But for once that an MS product worked well for my needs, beeing ennoyed by an Apple one turns me a bit angry !
Thierry -
Thumbnails/Previews not showing on tiffs viewed on Mac
I have a client who is asking me why the tiffs I'm supplying him with don't have thumbnails/previews. He's working an a Mac and has had to resave the files in order to create previews. I haven't been able to answer his question. Any takers? TIA. PShop CS4 / Windows XP.
Well, Photoshop does offer the ability to choose not to save thumbnails/previews... Check Edit - Preferences - File Handling. What's your setting?
-Noel -
Greetings,
I just started studying java at my vocational school and i'm studying from a book that was published by The Oracle Online Academy. But anyways, my issue is that inside the book they have a little screen shot of what I should be seeing. They are using an Applet Viewing program instead of the standard Command line utility. I'm looking for the program that is used to view programs. Maybe even a GUI for compiling and viewing. Please reply if you know where I can find either of these utilities.
Mike BaileyI think a little clarification is in order.
There are two kinds of java programs - applets and applications.
Applets are viewed through a html page using either the browser or the "appletviewer" utility
that comes with the jdk.
You cannot run applications with the appletviewer. That's why it is called Appletviewer.
Java applications on the other hand are run through the command line and may or may not
contain a gui - it depends on your program. The whole idea of having a gui to run java applications
defeats its purpose so there aren't any. Java applications - are always run from the command-line
using the "java someprogram" command.
The last thing which you asked for - a gui for compiling and viewing, however, is available. There
are numerous such tools and they are called IDE's (integrated development environments). They
allow you to compile and even run your programs...they look as if they run an application within
a gui but it actually gets run through the command line.
Check out http://www.gExperts.com for a IDE called Gel. Its small and powerful.
In retrospect, you need both the appletviewer (equivalent of a browser as far as applets are
concerned) and a command-line which is capable of running applications.
If you are so interested in running a gui version - why don't you write your own...you'll see they
are relatively easy...just go to..
http://java.sun.com/docs/books/tutorial/
This is one of the best resources to help you learn the language from beginner upto advanced level.
regards. -
Query to find out controls displayed as in UI for an applet,along with view
Hi,
I am looking for a query to find out list of all the controls as displayed in UI applet along with applet's view.
Please note that in the query only mapped controls (those displayed in UI ) should come up.
Regards,
KunalHi,
If the EUL is an apps mode (EBS) EUL then the eu_username column is the apps user id or apps resp id. If you want to show only the responsibilities and convert those ids to names then you need to use the EUL5_GET_APPS_USERRESP function like this:
select ba_name, ba_developer_key, EUL5_GET_APPS_USERRESP(eu.eu_username, 'R') responsibility_name
from eul5_bas ba
, eul5_access_privs ap
, eul5_eul_users eu
where ba.ba_id = ap.gba_ba_id
and ap.ap_type = 'GBA'
and ap.ap_eu_id = eu.eu_id
and eu.eu_role_flag=1
order by 1,2,3Rod West
Maybe you are looking for
-
I am having issues with my Apple ID and iTunes. I can log into the Apple ID with no issues on the Apple website and on my iPhone and computer but as soon as I try and do an update to my 51 Apps that need to be updated it says "Apple ID as been disabl
-
I'll be waiting in line for the iPhone 5 tonight and would like to upgrade my phone as well as my two daughters phones tomorrow, all of which are eligible for upgrade. Will I be aloud to purchase 3 iPhones at once tomorrow or is it one per customer?
-
If I choose one of the fly-out "edit page size options" at the bottom of the pages palette, such as compact disc or business card, why does the page size still say 8.1/2 x 11 if I go to--> "document set-up"? Is there a way that you can tell the actua
-
Updates is unavailable for my ID, but i only have one ID.
I just found a problem today that i am unable to update my apps. It told me that "This update is not available for this Apple ID either because it was bought by a different user or the item was refunded of cancelled' ~ Both iphone and ipad. I am sure
-
ABAP Query - Differences in generated code after upgrade
Hi all, We have upgraded to ECC 6. from 4.6C. We are experiencing differences between the behaviour of some queries in different systems. This can be as subtle as some of the output parameters not appearing on the selection screen (such as the option