|
There seems to be a bug with the AS400 Toolbox's SpooledFileViewer. While the scrollbars display, they are not functional. I looked at the open-source code (version 4.4) and have come up with the following solution. The problem seems to occur at line 1377 of the code of SpooledFileViewer.java in the load() method: // create the page view for the viewer pageView_ = new SpooledFilePageView_(); scrollView_.setViewportView(pageView_); SpooledFilePageView_ is an inner class that extends JLabel. I'm not too familiar with JScrollPanes, but examples demonstrating JScrollPanes (http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html) typically involve an ImageIcon within the JLabel constructor. The SpooledFileViewer code paints directly to the SpooledFilePageView_ itself, instead of its ImageIcon's Image. I decided to modify the code accordingly by providing an ImageIcon. I added the following code to the SpooledFilePageView_ class (around line 2000 of SpooledFileViewer.java): private ImageIcon icon = new ImageIcon(); private BufferedImage image = new BufferedImage(50,50,BufferedImage.TYPE_INT_RGB); private Graphics g2 = image.getGraphics(); private JLabel label=new JLabel(icon); public void refesh() { image = new BufferedImage(viewSize_.width, viewSize_.height,BufferedImage.TYPE_INT_RGB); g2 = image.getGraphics(); g2.drawImage( currentPageImage_ ,0,0,viewSize_.width, viewSize_.height ,null); icon.setImage(image); scrollView_.setViewportView(label); } Finally, I added the call to this new refresh() method in the updateViewer() method, at line 1876. This all seems to work- the scrollbars now work properly. I haven't tested thoroughy so I can't guarantee this fixes the problem completely and efficiently, but I hope this information is nevertheless useful. Note that I've been working under Sun's JDK 1.4.2.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.