Printing Swing components doesn't work on all printers? Please Help!

I have a really serious problem. I try to print Swing components with the so called PrintUtilities class. The source code can be found here: http://archive.corewebprogramming.com/Chapter15/printing/PrintUtilities.java).
My Swing components are panels (JPanel) including more panels and/or other components like text fields, text areas, combo boxes, radio buttons, check boxes and so on.
On one of my printers (Kyocera mita FS 1010) it works fine. But on other printers (Panasonic DP-2000, HP Deskjet 890 C) the results are weird: Only the first component (independent of the component depth) is printed (and it is every time the same result!).
I don't know whether this is important or not, but all printers I use are installed as network printers.
I have already searched the forum but couldn't find a similar problem.
Can anyone tell me what the problem is and what I can do to solve it?
Thank you for any response in advance!

try this:
package ayto;
import java.awt.*;
import java.awt.print.*;
import javax.swing.JComponent;
public class ComponenteParaImprimir
implements Printable {
private Component mComponent;
boolean isBook;
final static boolean PARA_BOOK = true;
final static boolean HARDCOPY = false;
public ComponenteParaImprimir(Component c, boolean book) {
mComponent = c;
isBook = book;
public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
if (pageIndex > 0 && !isBook) {
return NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D) g;
g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
boolean wasBuffered = disableDoubleBuffering(mComponent);
mComponent.paint(g2);
restoreDoubleBuffering(mComponent, wasBuffered);
return PAGE_EXISTS;
private boolean disableDoubleBuffering(Component c) {
if (c instanceof JComponent == false) {
return false;
JComponent jc = (JComponent) c;
boolean wasBuffered = jc.isDoubleBuffered();
jc.setDoubleBuffered(false);
return wasBuffered;
private void restoreDoubleBuffering(Component c, boolean wasBuffered) {
if (c instanceof JComponent) {
( (JComponent) c).setDoubleBuffered(wasBuffered);
}

Similar Messages

  • I Just got my i pad and the microphone doesnt't work at all. Please help!

    It seems that my mic doesn't work at all, when using  Camera or skype i can hear noise. What to do?

    It is possible that there is a problem with the file(s) that store the extensions registry.
    Delete the files extensions.* (e.g. extensions.sqlite, extensions.ini, extensions.cache) and compatibility.ini in the Firefox profile folder to reset the extensions registry.
    *https://support.mozilla.org/kb/Profiles
    New files will be created when required.
    See "Corrupt extension files":
    *http://kb.mozillazine.org/Unable_to_install_themes_or_extensions
    *https://support.mozilla.org/kb/Unable+to+install+add-ons
    If you see disabled, not compatible, extensions in "Tools > Add-ons > Extensions" then click the Tools button at the left side of the Search Bar (or click the "Find Updates" button in older Firefox versions) to check if there is a compatibility update available.
    If this hasn't helped then also try to delete the addons.sqlite file.

  • Microsoft word doesn't work with Yosemite. Please Help

    Microsoft word doesn't work with Yosemite. Please Help

    Office 2008 and 2011 work with Yosemite. If you had Office 2004 installed, then it will not work. If you had Office 2008 I would upgrade to Office 2011. In any event you should try completely uninstalling Office and then reinstalling it.

  • Bridge CC is asking my to 'purge cache'. When I do this doesn't work and freezes my mac. Bridge is unable to work at all. Please help?

    When I start up Bridge CC I get a error message instructing me to purge cache in preferences which I do but it doesn't work and freezes my mac. I cannot curretnly use Bridge CC. PLease help as this is costing me time and money - thank you in advance....

    Hold down the Option key as you launch Bridge, keep it down until you see a dialog box, then click all three options in the re-set box that comes up.
    If you don't see that re-set box, you're doing it wrong, i.e., you're not holding the Option key down fast enough.

  • 'email video' doesn't work on iPad 2; please help

    I am unable to email video recorded on my iPad 2.  I used to be able to, but in the last couple of days it has not been working.  The 'email video' selection does show up and after I tap it, nothing happens.  That is, the popup window to allow me to type the email address doesn't show up. I have to email an important video tonight.  Any help is extremely appreciated.  Is there any other option such as transferring the video to my laptop and then send it from there?  If so, how should I accomplish it?  Please help.  Thanks.

    Hello - I have the same problem and have tried a variety of configurations.
    When headphones are plugged in:   All apps and sound effects work with head phones
    but not when headphones are unplugged. When the headphones are plugged in I can
    controll volume using the volume up down button on the side of the pad. I can also
    double tap home screen and adjust volume with the slider. The system mute button
    is turned off in the home screen so there should be sound. In general setting I've set
    the switch button to control screen rotation. But there is no change in behavior if I change
    that button to control sound. My rotate switch is set to screen.
    When headphones are unplugged:  If I unplug the headphone, there is no sound from anything.
    If I double press the home to get to the task bar I can swipe to the far left and see the mute button
    is turned off. I can control the screen brightness, but the slider for the sound is missing. The sound
    slider slot is there but the button to slide volume left or right is missing. It's like someone pulled that
    knob off the slider switch. If I press the volume up / down button on the side of the iPad the 'sound
    effects' pop up box show up but there is no increasing / decreasing sound. The ringer and alerts button
    in general settings / sound is on. And if I slide the ringer alerts volume slider left / right it does make
    increase / decrease sound.
    I've rebooted several times. I've open task manager and manually closed all apps.  Don't know what to do...
    Sound just doesn't work and sound effects don't work either.... I've tried all the different suggestions on
    blogs and this forum but I can't seem to get it to work..  Please help, or maybe I should just bring it in...
    Thanks.

  • Backlight doesn`t work on Windows Seven~ Please help!!

    I have Macbook Pro Z0G5 model
    My backlight doesn`t work on Windows Seven!
    Does anyone know how to turn it on??

    It is working properly now. it was a problem with classpath
    settings. Ensured that the classpath is according to what is
    there in the install docs + sp11 readme. It is all fine.
    Regards,
    Bala
    "Suresh" <[email protected]> wrote in message news:<3cc54106$[email protected]>...
    Make sure that u have the latest service pack jar file ( for example weblogic510sp11.jar
    for service pack 11 - use service pack 8 or later for better NTREALM configuration
    ) ahead of the weblogicaux.jar in your classpath. This should solve the problem.
    Suresh.
    "YP Wang" <[email protected]> wrote:
    OS: Windows 2000
    WLS: 5.1 with sp 7
    I run java weblogic.security.ntrealm.NTRealm username password and I got
    exception
    like:
    ----->NTDelegate.useAltDomain is NULL!
    Exception in thread "main" java.lang.NoSuchFieldError: useAltDomain
    at weblogic.security.ntrealm.NTDelegate.initFields(Native Method)
    at weblogic.security.ntrealm.NTDelegate.loadlib(NTDelegate.java:132)
    at weblogic.security.ntrealm.NTDelegate.<init>(NTDelegate.java:56)
    at weblogic.security.ntrealm.NTRealm.<init>(NTRealm.java:39)
    at weblogic.security.ntrealm.NTRealm.main(NTRealm.java, Compiled
    Code)
    Does any one know what's wrong with it? Thanks.
    YP

  • Lasso tool not working at all. Please help!

    Hi Community. I just started the CC version of Illustrator and the lasso tools isn't working. I am able to select the tool and draw an outline with it, but nothing is selected when I make a closed loop. I cannot select anything in any way with the lasso tool. I have made sure that I am circling strokes that are on the active layer. Please help!! I'm currently stuck in my project as a result.
    -A

    What OS do you have, have you updated to thte latest  dot verison eg: 10.9.1?
    Reset your Illustrator preferences? Try making a new documnet really simple, to see if this happens on all documennts.

  • TS1702 I can t download new apps, it doesn t work. Could somebody please help me?.....

    Since i ve downloaded ios6 ( the new version), I had trouble starting apps, I started an app and then it just closed and i was back on my homepage. I also can t download new apps or update them.
    Somebody please help me!

    From Apple Support...
    Here are troubleshooting steps that should help you fix the problem.
    1) Quit App Store in multi-tasking.
    2) Tap Settings.
    3) Tap Safari.
    4) Tap Clear History.
    5) Tap the Clear History button.
    6) Tap Clear Cookies and Data.
    7) Tap the Clear Cookies and Data button.
    Try purchasing an app again from the device to get the security question prompt. You really need to set up the security question.
    ...it seems to have worked for me.....

  • My home button on my iPod 4th gen stop working. When I push it, it doesn't feel like it moves or clicks and when I push it it doesn't respond at all. Please help.

    The question is on the top links and videos accepted

    Try:
    http://snapguide.com/guides/calibrate-your-home-button/?utm_expid=69945963-15
    fix for Home button
    iPhone Home Button Not Working or Unresponsive? Try This Fix
    - If you have iOS 5 and later you can turn on Assistive Touch it add the Home and other buttons to the iPods screen. Settings>General>Accessibility>Assistive Touch
    - If not under warranty Apple will exchange your iPod for a refurbished one for:
    Apple - Support - iPod - Repair pricing
    You can do it at an Apple store by making an appointment:
    Apple Retail Store - Genius Bar
    or sent it in to Apple. See:
    Apple - Support - iPod - Service FAQ
    - There are third-party places like the following that will repair the Home button. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens

  • Menu Button not working at all..Please help needed urgently for deadline.

    I have used all the suggestions I can find in the forum. Nothing is working.
    I am trying to draw button rectangle on a still background for a menu. Draging the pointer doesn't do anything. I have tried to import a tutorial with menu and buttons within it. When loading the project assets the import stops at "Loading menu" and does not proceed.
    I am using suitcase fusion for a font manager.I have reinstalled the DSP a few times without any success.
    I have spent three nights trying to solvge the problem and I am running out of time for the project delivery help is need urgently

    Your key is the "suitcase fusion for a font manager" line.
    There is a bug where you won't be able to create a button if you have a bad font, or a duplicate font, installed.
    First try shutting off all of the fonts you have open with Suitcase, and see if that helps. If so, open one suitcase at a time until you figure out which font is the culprit.
    If shutting off all but the basic System fonts does not help, you might have to reinstall your system, or somehow update your core System fonts. I don't know how to do that, but there was a recent article at http://www.tidbits.com/ that discussed fonts and their maintenance. But ultimately it's a font problem.

  • Battery Drained & AC Doesn't Work... PLEASE HELP!

    I opened up my Powerbook g4 1.67 this morning after it was asleep all weekend to find that the battery has died and it will not start up. When checking the battery the led blinks indicating that it is completely out. When i plug in the adapter it glows orange. Nothing is happening! Please give me some advice!!!
    thanks,
    Kyle

    When there are charging problems, it's one of 3 components: power adapter, battery, or logic board.
    First, if you haven't already, check to see if your battery is being recalled: https://support06.apple.com/index.html
    Next, run your Apple hardware test: use the first Mac OS X DVD that came with your system (it will say AHT Version x.x in small print on the DVD), reboot holding the option key down, choose Apple hardware test, and follow directions. You may want to use the extended test. This tests your logic board, any issues noted?
    Do you have a way to test the power adapter? A multimeter to check the output?
    How many cycles do you have on your battery and what's it's full charge capacity? Click the blue apple, about this mac, more info, power, and battery information. Apple says a properly maintained battery should retain 80% capacity after 300 charge/discharge cycles.

  • My new iPhone 5S will not ring for incoming calls.  It vibrates. I've tried suggested tips for iPhone 4 but it doesn't work for 5S.  Please help!!

    Can anyone help.  My new iPhone 5S does not ring for incoming calls.  It vibrates.  How can I get ringer to work?

    Hello lyngos,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iPhone: No sound or distorted sound from speaker
    http://support.apple.com/kb/TS2802
    If an audio issue occurs when using a specific application, try testing other applications to see if the issue persists.
    If the iPhone is paired with a Bluetooth headset or car kit:
    Try turning off Bluetooth.
    If you experience difficulties with the Bluetooth feature, follow these troubleshooting steps.
    Restart the iPhone.
    If restarting doesn't fix the issue, ensure that your iPhone is updated to the latest version of iOS.
    Best of luck,
    Mario

  • NTRealm (WLS5.1 w SP7 ) doesn't work on Windows 2000, Please Help !

    OS: Windows 2000
    WLS: 5.1 with sp 7
    I run java weblogic.security.ntrealm.NTRealm username password and I got exception
    like:
    ----->NTDelegate.useAltDomain is NULL!
    Exception in thread "main" java.lang.NoSuchFieldError: useAltDomain
    at weblogic.security.ntrealm.NTDelegate.initFields(Native Method)
    at weblogic.security.ntrealm.NTDelegate.loadlib(NTDelegate.java:132)
    at weblogic.security.ntrealm.NTDelegate.<init>(NTDelegate.java:56)
    at weblogic.security.ntrealm.NTRealm.<init>(NTRealm.java:39)
    at weblogic.security.ntrealm.NTRealm.main(NTRealm.java, Compiled Code)
    Does any one know what's wrong with it? Thanks.
    YP

    It is working properly now. it was a problem with classpath
    settings. Ensured that the classpath is according to what is
    there in the install docs + sp11 readme. It is all fine.
    Regards,
    Bala
    "Suresh" <[email protected]> wrote in message news:<3cc54106$[email protected]>...
    Make sure that u have the latest service pack jar file ( for example weblogic510sp11.jar
    for service pack 11 - use service pack 8 or later for better NTREALM configuration
    ) ahead of the weblogicaux.jar in your classpath. This should solve the problem.
    Suresh.
    "YP Wang" <[email protected]> wrote:
    OS: Windows 2000
    WLS: 5.1 with sp 7
    I run java weblogic.security.ntrealm.NTRealm username password and I got
    exception
    like:
    ----->NTDelegate.useAltDomain is NULL!
    Exception in thread "main" java.lang.NoSuchFieldError: useAltDomain
    at weblogic.security.ntrealm.NTDelegate.initFields(Native Method)
    at weblogic.security.ntrealm.NTDelegate.loadlib(NTDelegate.java:132)
    at weblogic.security.ntrealm.NTDelegate.<init>(NTDelegate.java:56)
    at weblogic.security.ntrealm.NTRealm.<init>(NTRealm.java:39)
    at weblogic.security.ntrealm.NTRealm.main(NTRealm.java, Compiled
    Code)
    Does any one know what's wrong with it? Thanks.
    YP

  • I have a friend in a different country, but everytime I try to message her from my IMessage (my number) it doesn't work. Can someone please help me here?

    Basically. I have a friend from Australia, while I am from America. I met her on Twitter, blah, blah, blah. I'm trying to figure out how to message her with IMessage without using email. Because, I'm connected to my dad's ITunes account, so therefore, if I sent a message to her that way, my dad would get the too. MY number is hooked to IMessage, I checked. But, I just can't seem to message her from my phone, with my number with IMessage. It just sends as Text Message.

    She must have an idevice. Her iMessage has to be on and connected to a source of data such as cellular data or wifi.
    You would be fine as long as you use your number even on your dad apple account. Just as long as your dad uses his respective number or the account email as his iMessage then he won't be able to receive iMessages sent or receive from your number.
    You must have cellular data or connected to wifi and iMessage has to be on in order for it to work as well.

  • Turned on my iMac and looks like a negative, try using the control, alt command 8 trick but doesn't work.. can someone please help?

    I've tried using control, alt, command 8 to no avail... When I log out of my user name and go to my son's, this doesn't happen?  I'm perplexed?

    It is ⌃⌥⌘ 8 if your Keyboard Shortcut are set to default.
    The System Preference location depends on what OS X you are running..?
    For Snow Leopard and earlier, use or go to System Preferences > Universal Access and select Black on white.
    For Mountain Lion and later, go to System Preferences > Accessibility > Display and uncheck Invert colors.

Maybe you are looking for