Update of /cvsroot/metamorphosis/krysalis-jplugin/src/java/org/krysalis/swingx
In directory sc8-pr-cvs1:/tmp/cvs-serv22842/src/java/org/krysalis/swingx
Modified Files:
PrintUtils.java
Log Message:
Fix so that Components that are Printable are treated as
Printable and not as simple Components.
Index: PrintUtils.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-jplugin/src/java/org/krysalis/swingx/PrintUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PrintUtils.java 24 Oct 2003 09:42:07 -0000 1.2
--- PrintUtils.java 24 Oct 2003 14:33:40 -0000 1.3
***************
*** 16,19 ****
--- 16,21 ----
import java.awt.print.PrinterJob;
+ import java.util.logging.*;
+
import javax.swing.JScrollPane;
import javax.swing.RepaintManager;
***************
*** 25,34 ****
--- 27,44 ----
public static void print(Object o) throws PrinterException {
+
Printable p;
+ //do not move this inside the Component check, as
+ //the JScrollPane can contain a Printable already
+ if(o instanceof JScrollPane){
+ o = ((JScrollPane)o).getViewport().getComponents()[0];
+ }
+
if (o instanceof Printable) {
p = (Printable)o;
}
else if (o instanceof Component) {
+
p = new PrintableComponent((Component)o);
}
***************
*** 44,51 ****
}
- public static void print(Component component) throws PrinterException {
- print(new PrintUtils.PrintableComponent(component));
- }
-
public static void disableDoubleBuffering(Component c) {
RepaintManager.currentManager(c).setDoubleBufferingEnabled(false);
--- 54,57 ----
***************
*** 82,87 ****
enableDoubleBuffering(componentToBePrinted);
return (PAGE_EXISTS);
}
}
}
! }
\ No newline at end of file
--- 88,95 ----
enableDoubleBuffering(componentToBePrinted);
return (PAGE_EXISTS);
+
}
}
}
! }
!
-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community? Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.