Graphics / Image-Handling problem

I am trying to draw an image of one JPanel onto another JPanel, using the code below.
Instead of a picture of the source JPanel, i get only a white rectangle on the target JPanel.
I would greatly appreciate any help on fixing my code.
A JPanel, "sourcePanel" exists.
GraphicsConfiguration gfxConfig =
     GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
BufferedImage sourcePanelImage =
     gfxConfig.createCompatibleImage(sourcePanel.getWidth(),
                                             sourcePanel.getHeight());
Graphics2D sourceGraphics =
     (Graphics2D) sourcePanelImage.getGraphics();
     sourcePanel.paint (sourceGraphics);
TargetPanel targetPanel = new TargetPanel( sourcePanelImage.getWidth(), sourcePanelImage.getHeight(), sourcePanelImage );
PopFrame popFrame2 = new PopFrame( targetPanel, sourcePanelImage.getWidth(), sourcePanelImage.getHeight() );
import java.awt.*;
import javax.swing.*;
import java.awt.image.BufferedImage;
class TargetPanel extends JPanel {
     int width;
     int height;
     BufferedImage image;
     public TargetPanel( int width, int height, BufferedImage image ) {
          this.width = width;
          this.height = height;
          this.image = image;
          setLayout( new BoxLayout( this, BoxLayout.Y_AXIS ) );
          setPreferredSize( new Dimension( width, height ) );
          setMinimumSize( new Dimension( width, height ) );
          setMaximumSize( new Dimension( width, height ) );
          setBackground( Color.orange );
     public void paintComponent(Graphics g) {
          super.paintComponent(g);                                        //     Paint background, borders
          g.drawImage( image, 0, 0, width, height, this );
     ...          Println's show that the image exists:
"sourcePanelImage.getWidth() = 170
sourcePanelImage.getHeight() = 180
sourcePanelImage = BufferedImage@b4ee5e: type = 3 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=ff000000 IntegerInterleavedRaster: width = 170 height = 180 #Bands = 4 xOff = 0 yOff = 0 dataOffset[0] 0
but the result is only a white rectangle on "targetPanel"
Many thanks in advance for a solution.

No one to help you?

Similar Messages

  • I cannot insert a graphic image in a new composition: win 7, tb 24

    At times when composing a new e-mail I cannot insert a graphic image in the message. I have tried both the Insert button and the Insert icon. This does not happen all the time; but, when it does happen I can't seem to make it work. My system is a Win 7 with Thunderbird 24.3.0.5. I have tried inserting different graphic images and have tried all combinations in the Image Properties pop-up window.
    I have closed and reopened Thunderbird. I have restarted my system. I have closed all windows except Thunderbird. Nothing helps. Help! Thank you, Bill Gray

    Bill Gray here again. I find that if I open another Write window, then copy/paste my entire e-mail from the initial window -- I can insert graphics into the new window.
    What happens in Thunderbird to make this happen? This has happened a number of times. But, at least now I know that I can open a new Write window and get around the problem. Yet, I am still stuck with the nagging question: Why does this happen?
    Thank you and God bless, Bill Gray

  • Image quality problem when Printing Booklet to PDF

    Hi!
    I've searched the entire web trying to find a working solution for my problem but I wasn't able to find anything...
    I've created a A5 vertical page document in InDesign CS6, filled with High-Quality photographs. I now want to print it as a booklet (to a PDF file) so I can save it and print it in a professional establishment.
    The problem is, when I do this, the image quality turns out terrible...
    I've checked my Print Settings and I can't find anything wrong...
    Setup - A4 horizontally, and Graphics - Images - Send Data - is set to All.
    Is there anything else I can do/try? What can I be doing wrong?
    Here is an image of my print settings:
    When I export the document normally to PDF the image quality is fine, but it doesn't have the booklet layout which I need, it just exports single A5 pages one after the other. If I try to print this pdf as a booklet in Adobe Reader the same thing happens to the images, they loose quality.
    Please help!!
    Thanks : )

    Hi! Thank you for your quick and helpful answer.
    There's definetly something wrong with the PDF printer properties... It was on standard default, as you said... but it still didn't work when I changed it to press quality (also tried high-quality print), changed the dpi's and other few settings on the advanced preferences
    My solution was to download a free-trial of a professional pdf editor/creator (Soda PDF) and print it to that program... but, of course, this is not a long-term solution...
    I'll try and see if I can find any help in changing the settings to get the best quality in printing of the adobe acrobat program.
    Thanks!
    p.s: I think I meant to say "graphic press" when I wrote professional establishment, I'm not sure how you say it in English.

  • When opening a word doc in pages i am loosing the graphic images from powerpoint that were embedded in the word doc

    When opening a word doc in pages i am loosing the graphic images from powerpoint that were embedded in the word doc

    Are the images placed in a table? Many Word user have the habit of doing that. Tables are not handles the same way in Word and Pages so they get "hidden" in Pages. One way to find this out is to change the size of the paper of the document. You do that in the Page setup in the file menu. Create a document that is much longer that the default one and see if you images will pp up.

  • Image Handles and Flattern to String

    Hi All,
    I have an 8bit image, load an image to it, and then learn is as a template for pattern matching.
    Next I want to flatten the image handle into a string, unflatten it and then use it.
    Unfortunately, once unflattend I find that the pattern matching information is no longer available. The image itself is intact, but not the pattern information.
    Has anyone seen this before? Come up with a fix/work around?
    Thanks for you help
    Denis
    Attachments:
    Vision_Info_Tester.vi ‏102 KB

    Hi Greg,
    thanks for the response.
    To answer your question: IMAQ Vision - 7.0.0 and LV - 7.1
    I seem to have found out what the issue is.
    It appears that when I use a flatten to string function on an image handle the resulting string includes all the image data, not simply the flattened handle.
    To overcome this problem I used a cast function on the image handle to cast it to a string, and then cast that string back to an image handle. Using this operation the string is simply the same text as the image handle, and once cast back to the image handle the image still contains the pattern information
    So why is the flatten to string behaving differently for an image handle then it would for any other type of data?
    Again, thanks for your hel
    p.
    Denis

  • Regarding Pages charts, when I try to 'build' a 3D chart all I get is little dots but not graphics.  No problems with 2D charts though. Guess my question is "Help?"

    Regarding Pages charts, when I try to 'build' a 3D chart all I get is little dots but not graphics.  No problems with 2D charts though. Guess my question is "Help?"

    Sorry for the delay getting back to this.
    Thanks to Fruhulda and Peter for their comments regarding the refusal of Pages to let me make 3D charts. 
    In answer to the questions put to  me in this regard :
    1. Pages version : Pages '09  v.4.1 (923)
    2. Mac O/S :          v.10.6.8 
    3. 3D chart :          Can't find a 'name', but upright bars with rounded corners ???
    4. Moved apps :    Not that I'm aware of!  All should be as installed off the disc.
    5. A note :              I have been able to create these in the past - related to a SW update? 
                          and ... can create these charts perfectly in Keynote (go figure).
    Thanks to all.
    CM

  • I created a signature ID and customized the signature; however, when I go to sign it only shows the name layout or graphic image? How do I go back to using the certificate?

    Dear Forum
    I was using Adobe version XI and the signature feature disappeared from the menu. Now I downloaded Acrobat Reader DC. Using the menu and instructions I created a signature ID and customized the signature; however, when I go to sign a document it only shows the name layout or graphic image? How do I go back to using the certificate that I created?
    Any help would be greatly appreciated.
    Regards
    Carlos

    Firefox works fine on Windows 2000 SP4 for me.
    Any chance you have a dial-up connection that uses a web accelerator to speed the loading of content?

  • How to troubleshoot Image display problems in (web) ReportViewer?

    I have a simple CR 2008 report being hosted in an ASP.Net application. I am developing that in VS2008. Everything is fine other that me not being able to make images show up in the web report viewer.
    Here's the process I used:
    - Used "Insert->Picture" in CR 2008 Report designer to place a jpg file. Previewed the report. Everything fine.
    - Ran the report in Debug mode in Visual Studio. Everthing in the report shows other than the image. The default red cross box is shown which is an indication that the image could not be found on the server.
    - Used Export to PDF from the Report Viewer. The report and the included image show properly in PDF.
    Checked the URL for the missing image. It's something like (I had to edit it):
    http://localhost:64445/mywebapplication/Reports/CrystalImageHandler.aspx?dynamicimage=cr_tmp_image_918d9be8-5f42-43d9-b550-e56ba2d26526.png
    Checked the web.config, versions and everything checks out:
      <add key="CrystalImageCleaner-AutoStart" value="true"/>
    <add key="CrystalImageCleaner-Sleep" value="60000"/>
    <add key="CrystalImageCleaner-Age" value="120000"/>
    <add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>
    I don't know what else to check and how to go about troubleshooting this. Any hints is appreciated.
    thanks
    jeff

    It could be another custom handler you added to your web.config. I've seen someone add a handler for *.aspx ahead of the CrystalImageHandler.aspx which caused issues. You'll also want to see if your temp image files (.png) are being written/read correctly.
    Unfortunately you are using the personal web server that comes with Visual Studio .NET 2008 (file based web apps). It isn't easy to troubleshoot because you can see any of the IIS logs. If you convert this to an actual web site hosted in IIS you could at least look at your IIS HTTP logs and see if there are any errors there.
    You are on the right track. It is likely something with that image handler, or the temp files are not being written/read correctly. Process Monitor from Microsoft may help here as well.

  • I have LR5 on a mac book pro with a external hard drive with LR5 images. my problem is my external hard corrupted reformatedand have to this is expensive and i would to start over in LR5

    i have LR5 on a mac book pro with a WD external hard drive with my with my LR5 images . my problem is my external drive is corrupted .i was told by apple that my macshow the hard drive is there but it is not moumting and have to be reformat. i have to use recovery data to save my images on my external before i can refomat.iam willing to lose my images on my extenal hard drive but i would like to know can i erase my LR5 images and start over or delete LR5 and download it again

    Simply start a new catalog:
    File >> New Catalog
    Choose a new name and save.
    When the empty catalog launches you are ready to start over.

  • My iMac 27" Late 2012 has Image Persistence Problem

    I'm wondering what to do about an annoying image persistence problem on my 27" late 2012 iMac. I got the iMac just a few days ago. Monday actually, so 4 days ago.
    It's the 3.4GHz i7, 8GB, NVIDIA 680MX 1TB fusion drive model.
    Overall it has become the love of my life, but the image persistence thing is getting harder to ignore. This happens after only a few minutes of use. If I follow Apple's instruction on dealing with LCD image persistence, I can make it go away for a while, but it comes back very quickly.
    It is extremely noticeable on a plan dark background. It looks as thought he screen has been left on for a very long time with the same windows open, but it occurrs in less than 5 minutes of use with nothing more intense than a bit of web surfing.
    I've read that this is happening a great deal on these new iMacs, particularly teh 27" machines.
    While the problem seems to be known to those of us afflicted I don't know if Apple has acknowledged an issue or not.
    Here is a sample of the complaints: http://forums.macrumors.com/showthread.php?t=1509571
    I can make the ghost image vanish by bringing up an all white scree for a minute or so or using LCD Scrub.
    I'm wondering if anyone else has foun a solution other than asking for a replacement computer, which Apple seems to be granting on this issue?

    Avoiding image persistence on Apple (IPS) displays
    Avoiding image persistence on Apple LCD displays
    If you cannot resolve the issue yourself, then return the computer for a replacement. You may do this freely within 14 days from date of purchase, so don't delay.

  • Video Or Graphic Card Driver Problem After Clean And Re-Install Windows 7 32-bit

    Video Or Graphic Card Driver Problem After Clean And Re-Install Windows 7 32-bit I m Tired I m Finding & Finding Drivers
    But I Wont be Able To Play Games & Other Apps  Please Solve This And Give Me Link For Video Card Driver Or
    Graphic Card Driver For Windows 7 32-bit (x86)
    THANKS
    PROFESSOR TOM........................................

    Hi:
    See if this W7 32 bit graphics driver works...
    http://h10025.www1.hp.com/ewfrf/wc/softwareDownloa​dIndex?softwareitem=ob-100029-2&cc=us&dlc=en&lc=en​...

  • How to import many large graphic images to fit into column width?

    I have a 2-column layout and about 150 large graphic images which must be imported so that they fit exactly into the column width. These are bitmaps which have all the same dimensions. All of them will need a border (stroke). And they should be inline graphics because they belong to exact positions in the text flow.
    What would be the sensible approach to that (apart from scripting which I have not done yet)? I tried to define an object style which has the attribute "Fit content to frame", but this does not scale the image to the column size. How can I avoid to format 150 those images manually?

    It may be easier to change the ppi in photoshop so the image can be placed at the exact size.
    so if the image is 10 inches and the file is 300 ppi
    with resample image unchecked change the width to whatever you want it say 2 inches no the ppi will automatically change to 1500 ppi. Save. If you are creating a PDF make sure these images are not downsampled if you need the resolution.
    another way if all images are the same size would be to size one and place it where all the images go and relink to the other pics, when you relink it should retain the properties of the previous pic.

  • Exception Handling Problem In BPM

    All
    I am facing an exception handling problem I am using BPM and , I have caught exception in the transformation step but when there is any data problem in that mapping(mentioned in the transformation)
    it is not throwing the exception . is there any option to collect these type of system exception in  the bpm and give a alert thru mail
    is there any way to collect these type of exception happened in the BPE and raise alert thru generic alert
    Thanks
    Jayaraman

    Hi Jayaraman,
        When you say there is any data problem, does that fail the message mapping that you have defined?
    If the message mapping used in the tranformation fails, it should raise an exception in the BPM.
    Did you test the message mapping using the payload and see if it really fails or not?
    Regards,
    Ravi Kanth Talagana

  • GUI event handling problems appear in 1.4.1 vs. 1.3.1?

    Hi,
    Has anyone else experienced strange event handling problems when migrating from 1.3.1 to 1.4.1? My GUI applications that make use of Swing's AbstractTableModel suddenly don't track mouse and selection events quickly anymore. Formerly zippy tables are now very unresponsive to user interactions.
    I've run the code through JProbe under both 1.3 and 1.4 and see no differences in the profiles, yet the 1.4.1 version is virtually unusable. I had hoped that JProbe would show me that some low-level event-handling related or drawing method was getting wailed on in 1.4, but that was not the case.
    My only guess is that the existing installation of 1.3.1 is interfering with the 1.4.1 installation is some way. Any thoughts on that before I trash the 1.3.1 installation (which I'm slightly reluctant to do)?
    My platform is Windows XP Pro on a 2GHz P4 with 1GB RAM.
    Here's my test case:
    import javax.swing.table.AbstractTableModel;
    import javax.swing.*;
    import java.awt.*;
    public class VerySimpleTableModel extends AbstractTableModel
    private int d_rows = 0;
    private int d_cols = 0;
    private String[][] d_data = null;
    public VerySimpleTableModel(int rows,int cols)
    System.err.println("Creating table of size [" + rows + "," + cols +
    d_rows = rows;
    d_cols = cols;
    d_data = new String[d_rows][d_cols];
    int r = 0;
    while (r < d_rows){
    int c = 0;
    while (c < d_cols){
    d_data[r][c] = new String("[" + r + "," + c + "]");
    c++;
    r++;
    System.err.println("Done.");
    public int getRowCount()
    return d_rows;
    public int getColumnCount()
    return d_cols;
    public Object getValueAt(int rowIndex, int columnIndex)
    return d_data[rowIndex][columnIndex];
    public static void main(String[] args)
    System.err.println( "1.4..." );
    JFrame window = new JFrame();
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    Dimension size = new Dimension(500,500);
    panel.setMinimumSize(size);
    panel.setMaximumSize(size);
    JTable table = new JTable(new VerySimpleTableModel(40,5));
    panel.add(table);
    window.getContentPane().add(panel);
    window.setSize(new Dimension(600,800));
    window.validate();
    window.setVisible(true);
    Thanks in advance!!
    - Dean

    Hi,
    I've fixed the problem by upgrading to 1.4.1_02. I was on 1.4.1_01.
    I did further narrow down the symptoms more. It seemed the further the distance from the previous mouse click, the longer it would take for the table row to highlight. So, clicking on row 1, then 2, was much faster than clicking on row 1, then row 40.
    If no one else has seen this problem -- good! I wouldn't wish the tremendous waste of time I've had on anyone!
    - Dean

  • Problem: codebase, jar and image reloading problem please help!

    Hi Java Gurus,
    I have written an applet that extends JApplet for viewing webcam. In order to reduce the download time I put my classes into a doorcam.jar file. The following is my <applet> tag in my html file.
    <applet code="CameraApplet.class"
    archive="doorcam.jar"
         codebase = "webcam/classes"
         width="375" height="475">
    <param name="imagePath" value="http://judge/webcam/images">
    <param name="webCamImage" value="door.jpg">
    <param name="COMPort" value="COM2">
    <param name="frameRate" value="10"> <!-- could not exceed more than 10-->
    <param name="host" value="judge">
    </applet>
    The fist problem is that my class file does not get loaded from the jar file if i provide the "codebase" attribute as above. Instead the browser load every single class file from the webserver. This has some problem too. Coz the browser sometimes just thorough NullPointerException or ClassNotFoundException. After much of debugging I found out that the problem is the IE browser which seldom fails to load classes or image file from the server. If i referesh the browser the applet and all its classes loaded successfully and runs smoothly. This behaviour never occurs when running with "appletviewer".
    I wanted all my classes to be loaded from my jar file. After much of trial and error I found out that if i remove "codebase" attribute the browser loads the classes from my jar file and applet loads very fast. This is where the second problem comes in. The browser does not reload my webcam image file so that the webcam become alive with live images, like before.
    If I run on "appletviewer" everything works fine my web cam is displayed properly. But in IE browser the image does not get reloaded when I refresh my image to give live to my webcam display. The refresh method is given below.
    private void refresh(final URL url) {
    Image webCamImage =getImage(url);
    webCamImage.flush(); // flush out the previous image
    webCamImage = getImage(url); // get a new image
    webCamImageIcon.setImage(webCamImage); webCamImageIcon.paintIcon(webCamLabel, webCamLabel.getGraphics(), 15, 15);
    When I add the "codebase" attribute back, the image gets reloaded for every refresh() and everything works fine. But the classes are also loaded from the server. And occasionally also suffers Class loading and image loading problem. As I presented earlier, when I do refreshing in the browser everything gets loaded and the applet function correctly with web cam displaying very well.
    The problem is so strange that I could not find any way to solve it.
    It would be a great help to me if somebody provide me some work around to the problem.
    I tested on Windows 2000, Windows XP, IE 5.5, IE 6 with J2SDK 1.4.0.
    Thank you all very much in advance.
    best regards,
    Judge

    Thank you so much for the suggestions. I did tried the way u suggested. The problem still the same.
    I think its the problem between IE browser and Java Plug-in.
    I which SUN would find these incompatibilities and solve these problems.
    I even tried using java SDK and plug-in 1.4.1 it even worst. It can't even load an applet. And it does not show any loading messages nor any error messages. It just show a cross sign on the upper left coner.
    I would be so glad, if Sun would try to eliminate the inconsistancies such as caching, loading, initializing etc between browser and its Java plug-In. For example, applets behave well in appletviewer and behave unpredictably in browser environment.
    I have seen so many people in the forums with all sorts of problems because of this.
    Right now I m desperately looking for work around to my problem.
    If somebody would provide me with the solution to my problem it would be a great help to me.
    thank you all so much.
    best regards,
    Judge

Maybe you are looking for

  • Zoom Bug in FCPX 10.2

    Press Z to go into the magnifying glass.  Click around to zoom in on the timeline.  Now, hold option key down to zoom out.  Magnifying glass icon stays as a plus.  It doesn't turn into a minus like it used to. Small bug.  Can anyone else reproduce it

  • Calling an situation-sensetive action in an jsp-file

    Hi all, I have to call an action (kind of: <html:form action="/actions/myInfos/studentListTaskBeurteilungenAction.do" method="POST"> in an jsp file, but I have to give the action two paramters as well I have in this jsp. I tried things like: <c:set v

  • Internal Hyperlinks

    I would like to see the hyperlink feature expanded similiar to how MS OneNote is now working. I would like to be able to internally link parts of my project together with hyperlinks and not necessarily external URLs. For example, in my project I have

  • Setting up Miracast

    I'm running Windows 7, regularly patched and updated. Today I got the wireless display adapter, but I'm at a loss as to how to connect to it. The device is plugged in and powered on, but the instructions {to stretch the definition} provided only give

  • SuperDuper! clone & Snow Leopard

    In my MacPro I have a two 1tb HD setup where the 2nd drive is an exact clone of the 1st using 'Superduper!' When I installed 'Snow Leopard' I chose to replace the 1st HD and test the system for a week before making a new clone. Having done so without