Try to draw a picture on another image

Hello!
I'm developing a simple application and I want to have a background image static on my JFrame and establishes her other pictures. That's why I created a class defined by user (named FrontPanel such below) that illustrates that extends JPanel and overrided the paintComponent (Graphics g) method. So I draw the background image once on the JFrame, and then I want to dynamically draw the other images on the JPanel. Unfortunately what happens is that the background image disappears and only the JPanel images are shown. If I resize the window then the background image appears again (as the Repaint method is called), but the JPanel images disappear. They can not be together at the same time.


method of painting in my main class which extends JFrame
{} public void paint (Graphics g)
g.drawImage (this.museum_background, 0, 20, null);
}

class FrontPanel
FrontPanel class extends JPanel {
{FrontPanel()}
Super();
}

{} public void update (Graphics g)
paintComponent (g);
}


method that draws the images before
@Override
{} public void paintComponent (Graphics g)
super.paintComponent (g);
If (MainWindow.DRAW_VISITOR)
g.drawImage (MainWindow.grvisitor, 500, 100, null);
}
}


Is there a way to do this? Perhaps this is not available in Java and we are allowed to paint again what we want to display? I want to avoid this for effective purposes.
Thank you very much for your time.
Dimos.

Finally try.

In a class that extends JComponent (JPanel or, if you like)

@Override
public void paintComponent(Graphics g) {
   super.paintComponent(g); // needed if the custom painting does not paint the complete component
   g.drawImage(backgroundImage, 0, 0, this);
   if (whateverCondition) {
      g.drawImage(overlayImage, ...);
   }
}

and call repaint() whenever the application state changes in a way that determines whether the overlay should belong.

DB

Tags: Java

Similar Questions

  • MS Photo Gallery, how can I activate the "do not show this again" when the dialog box appears whenever I try to download a picture to another location?

    How can I activate the "do not show this again" when the dialog box appears whenever I try to download a picture to another location?

    The dialog box that appears frequently when I try to convert or download photos, shows the shadow of this question - I want to make it active until the times dialog box stops appearing I scroll the photo folders.

    Thank you

    I got the last part of what you wanted, which was simply not the message

    The key is that you have to allow this program through your windows firewall.

    Go to your look for the windows Firewall Control Panel,

    There should be a list to allow a program through windows firewall, look at the top left.

    If you feel safe doing this, vlc is not one that I would feel safe with, but to you, it has a function to browse to find the program to be added to your trusted list or access through your firewall.

    Still, it may give you a warning but could release the message?

  • Image disappears when you try to print a picture sewn

    original title: stitched photo printing

    I can't print a stitched photo, when I try the image appears in the box but immediately disappears and does not print

    I can't print a stitched photo, when I try the image appears in the box but immediately disappears and does not print

    =============================================
    Just some thoughts... not a definitive solution...

    I have not seen this question previously discussed... but I wonder if
    It would be interesting to try to open the picture in Paint and try printing.

    Also... It may be interesting to try to resize the picture to a smaller size
    and then try to print.

  • The camera/webcam on my laptop Windows 8 says that "something went wrong" while taking this picture when I try to take a picture.

    My laptop is a Lenovo Ideapad S405 with Windows 8. The webcam is an Image easy Lenovo is manufactured by Vimicro and is built into my laptop. Whenever I try to click to take a picture, an error message pops up that says "something was wrong all by taking this picture. Another strange thing is that four of the videos that I have taken are listed in the film, but is not graphic and cannot be played. All my photos and my previous videos are always good. I looked at the videos before and they were still there, but now they are gone. I did not any changes to settings or anything else on my computer and Control Panel seems to think that the device still works. I tried to update my computer with Windows updates, but nothing works. I also discovered that my photos folder is no longer work and Windows said it can be removed safely. I can't access my photos, music or videos. I think the problem might be that my photos have no place to be stored, but I need to know how to solve this problem.

    Thank you
    QuartzCanteloupe

    I found a solution to my problem! In another post, someone had the same message about how the library.ms could be deleted, but it was empty. They removed the libraries by clicking the option libraries from left to right, and then click. I then clicked on "restore deleted files" and my folders returned with the restored elements. I could then take pictures and videos because they had a place to be stored.

    Thank you
    QuartzCanteloupe

  • How to distort a picture in another picture in Flash?

    What should I do in order to distort a picture in another picture of the way, you can change a shape of a letter or words?

    You will need to convert rough drawn vector graphics images to try to use the shape tween to transform each other.  I do not think that you will get what you want probably visually, but it also depends on the complexity of what is in the pictures.

    Depending on the complexity of the image content, you might get better results just fading one (or rear) on top of it.

  • Trying to superimpose an image over another image

    Just installed Photoshop, I'm trying to superimpose an image over another image.

    I need 4 motorcycles all looked in a curve, and I just want to see the right edge of each bike, one behind the other.

    1st, I need to remove all solid colors, a drawing of each sketch is all I want.

    Then, I need to move the smaller bike in front of the 2nd bike, the 3rd, then the 4th...

    Try to make a logo for a T-Shirt to use at a motorcycle rally.

    Thanks in advance for the schooling of a neophyte... I can push bytes, but no image...

    John

    STAT by tracing a path around each bike image. Use the pen tool for maximum flexibility.

    Note: The pen tool can be quite difficult for beginners. But it is worth the time.

    Once you have the drawn contours of the pen you can put them in a new blank document. In the Trace Panel. Option/Alt click on the thumbnail of path (there should only be one). Edition > copy.

    Switch to the new document and publishing > paste. Double-click the thumbnail of the path and name of the path. Click in an empty area of the path Panel.

    Repeat with the other 3 paths of the remaining images.

    Create a new layer in the layers panel.

    Option/Alt click on the first path in the Trace Panel.

    Select the brush (B) tool to make edge hard about 5 pixels.

    In the Panel traced down, you will see a circle icon. Click it to stroke the path with brush that you just made.

    If it's the right size, then repeat with the other paths and don't forget, you create a new layer for each.

    If the size of the brush was not correct, cancel and set the size of the brush. Repeat the race.

    The aura features a transparent are interior makes it possible to fill.

    Command/Ctrl click on the appropriate path. Edit > fill... Select the desired fill color.

    With the bikes on layers, you can move layers independently for good order.

  • change the color of the frame to display pictures with "my images".

    When I discovered all the files in the 'My pictures' folder as the largest image size (NOT a slide show) I want the
    images, surrounded by a color - black preference - instead of the normal white collar

    Try this extension:

  • Windows Vista freezes when I try to view my pictures in windows photo gallery.

    Windows Vista freezes when I try to view my pictures in windows photo gallery.

    Even the start menu and bottom bar freeze when I try to view pictures in the Gallery of Windows, I open it with paint or another Viewer to see my photos.

    I disabled my antivirus and firewall for a while but nothing has changed.

    I have a toshiba with windows vista and intel celeron.

    Hi DianaRoman,

    Have you tried to fix it with the "difficulty it Microsoft Solution"? This solution is automated and "solve the problems of Windows Photo Gallery, such as...". You can not see the photos, the program does not work or crashes. Here is a link:

    http://support.Microsoft.com/mats/windows_photo_and_slideshow_diag/

  • I try to combine a picture of my sister with a picture of a poem next to her. How to combine the two into a single photo?

    Paint or Windows Photo Gallery

    I try to combine a picture of my sister with a picture of a poem beside it, how to combine the two into a single photo?

    If you have the poem recorded in an image format,
    the following freeware can create a side by side
    Panorama.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Download IrfanView
    http://MajorGeeks.com/IrfanView_d4253.html
    (filename: iview433_setup.exe)
    (uncheck if you don't want Google Chrome)

    Download plug-ins too...

    IrfanView plugins
    http://MajorGeeks.com/IrfanView_PlugIns_d4908.html
    (filename: irfanview_plugins_433_setup.exe)

    When the program is installed... read more...

    Open IrfanView and go... Image / create the Image of the Panorama...
    (this will open the screen to "Create a panorama image")

    On the screen to "Create a panorama image"... left click on the add images"" button.
    (Displays the 'Open' screen. Now, drill down to the
    the folder that contains your saved Photos of veterinarians.

    Now... click left (highlighted), the two images, you want to join.
    (you can select more than one if you hold down your Ctrl key)
     
    The two images highlight... left click on the button 'open '.
    (Or... you can add the images one at a time... which is always easier)

    Now, go back to the screen "Create the panorama image.
    and the file names of the selected pictures need to be in the
    Field "Input Images.

    Now with the names of two files in 'Images of entry' field...
    You can left click on the button 'create Image '.

    (the positions left and right of these images can be swapped in)
    selection of a file name and using the "mount image" / "Move."
    Images down"buttons...)

    Now you should see a display of the combined image.
    Reach... File / save as...

    Choose a backup location / enter a file name / choose a format...
    On the left, click on the button "Save..."

  • Why can't copy and paste pictures into folders "Images".

    Any time that I try to copy an image for internet and paste them to my 'Images' folder, it won't let me paste

    Hi kgreer96,

    Why not try this method of saving Web page image recommended?
    Give it a shot and post if it passes.

    1. open Internet Explorer by clicking the Start button. In the search box, type Internet Explorer, and then in the list of results, click Internet Explorer.
    2. navigate to a Web page with an image you want to save.
    3 right click on the image.
    4. click on save image as.
    5. in the Save Picture dialog box, navigate to the picture library, and then click Save.

    Information available at:

    Save an image on a Web page
    http://Windows.Microsoft.com/en-us/Windows7/save-a-picture-from-a-webpage

    This operation gives the desired result to save the image of the Web page. Let us know if you need more assistance.

    Kind regards

    Shinmila H - Microsoft Support

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Seeking help with a problem with the LR I use LR CC on a laptop, when you try to export a picture to an external hard drive, I am now without apparent reason to get the following message, "could not create a JPEG sponsor limit you 92 k Bytes.Plea.

    Seeking help with a problem with the LR


    I use LR CC on a laptop, when you try to export a picture to an external hard drive, I am now without apparent reason to get the following message.

    "Could not create a respondent JPEG limit you 92 k Bytes.Please increase the size limit files
    . (1).

    .....

    I tried to increase the size of the file several times,

    I left LR

    I restarted the computer.


    Any help or advice for this problem will be greatly appreciated


    Thanks in advance


    @stu

    Not because of the number of pixels, in this photo and the chosen level of quality there is no possible way to create a JPG file to the size of file you requested. You must change your export settings.

    Show us a copy of the export dialog box, so we can see clearly the part file setting and the size of the Image.

    Also indicate the number of this image (width and height) pixels after cropping (as appropriate) and prior to export.

  • When I try to open a picture from the camera raw bridge it appears subsequently me "camera raw editing is not enabled" "camera raw edition requires that a product has been released at least once to activate this feature, what can I do?

    When I try to open a picture from the camera raw bridge it appears subsequently me "camera raw editing is not enabled" "camera raw edition requires that a product has been released at least once to activate this function, may l.

    The Parent to Camera Raw/bridge software is Photoshop because the camera raw plugin is installed on your system with Adobe Photoshop.

    Please open Photoshop and edit an image in camera raw by going into the filters and then open the bridge of file > Browse in Bridge and check if the option to edit your images in camera raw directly.

    Also make sure that your camera raw plugin is the latest version see: Installer of plug in Camera Raw

    Concerning

    ~Assani

  • Built-in color profile is not current RGB working space... someone knows why this appears when I try to open the picture?

    Built-in color profile is not current RGB working space... someone knows why this appears when I try to open the picture?

    He does not appear for all the photos; However, I use two photos of the same photo shoot and it will show the error message, we won't.

    It has nothing to do with the shooting or shooting is not in raw?

    Or opening in the bridge?

    I need someone to break the basics of what I am under the age of two years, if you please.

    Greatly appreciated!

    Thank you!

    It will happen when your Photoshop color settings (image 1) does not match your files.  The first thing to do is to check your color settings (Edit > parameters of color or shift-command-K).  You will see that mine is set to ProPhoto RGB.  When you use RAW files, you can set the desired picture profile by clicking on the link at the bottom of the window of Camera RAW, which will bring up the workflow Options (image 2).  Here, you can see that mine is set to ProPhoto RGB, which means I'm not all conflicts.  You will have the profile matches no window, when these are different.

    Most cameras have the possibility of sRGB and Adobe RGB for RAW files no, and when the RAW capture ignores this parameter allows to set in the workflow window.  I hope this helps.

  • cropping in oval shape and move on to another image

    want to crop in an oval shape, a person's face in a photo and move it into another image. Please notify. Thank you

    For this you can use the elliptical or rectangular selection tool, draw a shape on your image, select Edit, make a copy, and then paste it on your collage.

    ~ Sarika

  • How to resize the print size of an item within my PDF to multiple pages? For example a receipt or another image that can scan in bigger or smaller than my 8.5 x 11 Bill?

    How to resize the print size of an item within my PDF to multiple pages? For example a receipt or another image that can scan in bigger or smaller than my 8.5 x 11 Bill?

    Hello

    In the print dialog box, you would get options to resize your document.

    Try them and see if that helps.

    Once you choose the print option, it would give options to change the size of the page you need.

    Please check and see if it suits you or not.

    Concerning

    Sukrit diallo

Maybe you are looking for