ANuB figures out how == overlap transparent gif in a JPanel!

I have to say I have a hate/love realtionship with this forum. Sorry if I ofend but I know it's hard sometimes to get an answer for help as it is purely voluntary. But I've asked help for this a bazillion times and help has been min to null, but I want to say I'm hoping to post something to help someone how to figure out how to Overlap a transparent image or transparent gif over another in a custom JPanel and display it when an action is called. (action called code to follow soon in another forum)
import java.awt.*;                                                                                          //     import extension packages
import javax.swing.*;
* <strong>TransparentImageExample</strong> -- drawing a transparent
* image on top of a background image.
public class PizzaImage extends JPanel
     private Icon     icnPizza,
                         icnLoaded,
                         icnSausage,
                         icnPepp,
                         icnOnion,
                         icnGrPep,
                         icnMush,
                         icnOlive,
                         icnGarlic,
                         icnPineApp,
                         icnSpinach;
     private Color bgColor;
     public void paintComponent( Graphics g )
          super.paintComponent( g );
          bgColor = new Color( 255, 235, 160 );
          this.setBackground( bgColor );
          icnPizza = new ImageIcon( "pzaThin.gif" );
          icnLoaded = new ImageIcon( "icnLoaded.gif" );
          icnSausage = new ImageIcon( "topSausage.gif" );
          icnPepp = new ImageIcon( "topPepp.gif" );
          icnOnion = new ImageIcon( "topOnion.gif" );
          icnGrPep = new ImageIcon( "topGrPep.gif" );
          icnMush = new ImageIcon( "topMush.gif" );
          icnOlive = new ImageIcon( "topOlives.gif" );
          icnGarlic = new ImageIcon( "topGarlic.gif" );
          //icnPineApp = new ImageIcon( "topPineApp.gif" );
          //icnSpinach = new ImageIcon( "icnLoaded.gif" );
          icnPizza.paintIcon( this, g, 0, 0 );
          icnSausage.paintIcon( this, g, 0, 0 );
          icnPepp.paintIcon( this, g, 0, 0 );
          icnOnion.paintIcon( this, g, 0, 0 );
          icnGrPep.paintIcon( this, g, 0, 0 );
          icnMush.paintIcon( this, g, 0, 0 );
          icnOlive.paintIcon( this, g, 0, 0 );
          icnGarlic.paintIcon( this, g, 0, 0 );
     public void draw()
          repaint();
so just import the above code in a class fime which extends JPanel and display the PizzaImage objVariable  = new PizzaImage() in the component of your choice.
[\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

You guys are right about setting the background color outside of the paint method. I was more pre-occupied with trying to overlap the images. So now I have it set. NOW I need to draw each item when it is selected with a JCheckBox and I can't think of a good way to do that. Is there a way to undraw an image? I suppose I've gone too long w/o sleep. Here's what I have.
// this code is in another class file
private class chkBoxHandler implements ItemListener
          public void itemStateChanged( ItemEvent e )
               for( int i = 0; i < chkBoxName.length; i++ )
                    if( e.getSource() == toppingChk[ i ] )     
                         if( e.getStateChange() == ItemEvent.SELECTED )
                              pzaImage.setImage( i );
                              pzaImage.draw();
                         if( e.getStateChange() != ItemEvent.SELECTED )
                              JOptionPane.showMessageDialog( null, "Button Unselected",     //     displays a message
                                   "About MyPizzeria", JOptionPane.PLAIN_MESSAGE );          //     code to "undraw" the image will go here
import java.awt.*;     
import javax.swing.*;
public class PizzaImage extends JPanel
     int     thisImgNum = -1;
     Icon pzaThin, icnLoaded;
     public String imgName[] = {     "topSausage.gif",
                                        "topPepp.gif",
                                        "topOnion.gif",
                                        "topGrPep.gif",
                                        "topMush.gif",
                                        "topOlives.gif",
                                        "topGarlic.gif",
                                        "topPine.gif",
                                        "topSpinach.gif"
     public Icon topping[] = {     new ImageIcon ( imgName[ 0 ] ),
                                        new ImageIcon ( imgName[ 1 ] ),
                                        new ImageIcon ( imgName[ 2 ] ),
                                        new ImageIcon ( imgName[ 3 ] ),
                                        new ImageIcon ( imgName[ 4 ] ),
                                        new ImageIcon ( imgName[ 5 ] ),
                                        new ImageIcon ( imgName[ 6 ] ),
                                        new ImageIcon ( imgName[ 7 ] ),
                                        new ImageIcon ( imgName[ 8 ] )
     private Color bgColor;
     public PizzaImage()
          setBackground(new Color(255, 235, 160));                         
          pzaThin = new ImageIcon( "pzaThin.gif" );                         
          icnLoaded = new ImageIcon( "icnLoaded.gif" );                    
     public void setImage( int img )                                             
          thisImgNum = img;                                                       
     public void paintComponent( Graphics g )                              
          super.paintComponent( g );
          pzaThin.paintIcon( this, g, 0, 0 );                                   
          if( thisImgNum == 0 )
               topping[ 0 ].paintIcon( this, g, 0, 0 );
          if( thisImgNum == 1 )
               topping[ 1 ].paintIcon( this, g, 0, 0 );
          if( thisImgNum == 2 )
               topping[ 2 ].paintIcon( this, g, 0, 0 );
          if( thisImgNum == 3 )
               topping[ 3 ].paintIcon( this, g, 0, 0 );
          if( thisImgNum == 4 )
               topping[ 4 ].paintIcon( this, g, 0, 0 );
          if( thisImgNum == 5 )
               topping[ 5 ].paintIcon( this, g, 0, 0 );
          if( thisImgNum == 6 )
               topping[ 6 ].paintIcon( this, g, 0, 0 );
          if( thisImgNum == 7 )
               topping[ 7 ].paintIcon( this, g, 0, 0 );
          if( thisImgNum == 8 )
               topping[ 8 ].paintIcon( this, g, 0, 0 );
     public void draw()
          repaint();
}

Similar Messages

  • I am trying to figure out how to clear my massage backlog of messages on Messages for Mavericks OS. I believe a lot of space is taken up by this running in the background keeping recent messages loaded. Especially with all the gif files I've been sending

    I am trying to figure out how to clear my massage backlog on Messages for Mavericks OS. I believe a lot of space is taken up by this running in the background keeping recent messages loaded. Especially with all the gif files I've been sending. Is there a way to select all and deleter? Please help! Can't find anyone who looks to do the same just lots of manuals for using the app on iphones and ipads.
    Thanks

    I am trying to figure out how to clear my massage backlog on Messages for Mavericks OS. I believe a lot of space is taken up by this running in the background keeping recent messages loaded. Especially with all the gif files I've been sending. Is there a way to select all and deleter? Please help! Can't find anyone who looks to do the same just lots of manuals for using the app on iphones and ipads.
    Thanks

  • Need to find out a way to figure out how DB2 connect to Oracle and data mirroring etc.

    Hi, Gurus,
    I just take over a project which source is ICOMS as400 db2 database. Seems data mirro CDC is used to replicate from DB2 to oracle.
    I am very new to this datamirror CDC , plus I am new to figure out how db2 connect to oracle, is that through db link or what? or is there tnsnames entry?
    I would like anybody in this forum can point me to the right direction.
    Thanks in advance.

    user9233598, if mirroring/replication from DB2 to Oracle already exists then question is what product is being used?  If the product has already been purchased then I do not think it is very likely that management is going to want to purchase another product so I do not see how extra-cost Golden Gate or other Oracle Gateway features apply if those are not currently in use.  If Golden Gate or the Oracle Transparent Gateway are in use then you already have your answer
    Oracle supports ODBC/JODBC and the replication application on the AS400 likely uses these features or a thick Oracle client as the interface to Oracle.
    HTH -- Mark D Powell --

  • I have an apple iphone 4 that I want to download audio books from my library onto it.  I cannot figure out how to do that.  The iphone does not show up on my mac laptop as a connected device.  Does this kind of download have to run through itunes?  Thanks

    I have an apple iphone 4 that I want to download audio books from my library onto.  I cannot figure out how to do that.  The iphone does not show up on my mac laptop as a connected device.  Does this kind of download have to run through itunes?  Thanks

    Yes it is done through iTunes. The iPhone will never show up in Finder as a device. The following is general information on iTunes sync: http://support.apple.com/kb/HT1386 and the following is a previous discussion where the post by Andreas Junge helped others that had a problem syncing audiobooks: https://discussions.apple.com/message/20052732#20052732

  • Can't figure out how to use home sharing

    Since the latest couple iTunes updates, my family and I can not figure out how to use home sharing. Everyone in our household has their own iTunes, and for a long time we would just share our music through home sharing. But with the updates, so much has changed that we can no longer figure out how to use it.
    I have a lot of purchased albums on another laptop in the house, that im trying to move it all over to my own iTunes, and I have spent a long time searching the internet, and everything. And I just can't figure out how to do it. So.... how does it work now? I would really like to get these albums from my moms iTunes, onto mine. I would hate to have to buy them all over again.
    If anyone is able to help me out here, that would be great! Thanks!

    The problem im having is that after I am in another library through home sharing, I can't figure out how to select an album and import it to my library. They used to have it set up so that you just highlight all of the songs you want, and then all you had to do was click import. Now I don't even see an import button, or anything else like it. So im lost... I don't know if it's something im doing wrong, or if our home sharing system just isn't working properly.
    Thanks for the help.

  • Something was hidden in a download and now these double green underlined hyperlinks show up everywhere, and pop ups too whenever I click on ANYTHING. I can't figure out how to find it and get rid of it.

    Something was hidden in a download and now these double green underlined hyperlinks show up everywhere, and pop ups too whenever I click on ANYTHING. I can't figure out how to find it and get rid of it.

    You installed the "DownLite" trojan, perhaps under a different name. Remove it as follows.
    Malware is constantly changing to get around the defenses against it. The instructions in this comment are valid as of now, as far as I know. They won't necessarily be valid in the future. Anyone finding this comment a few days or more after it was posted should look for more recent discussions or start a new one.
    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    /Library/LaunchAgents/com.vsearch.agent.plist
    Right-click or control-click the line and select
    Services ▹ Reveal in Finder (or just Reveal)
    from the contextual menu.* A folder should open with an item named "VSearch" selected. Drag the selected item to the Trash. You may be prompted for your administrator login password.
    Repeat with each of these lines:
    /Library/LaunchDaemons/com.vsearch.daemon.plist
    /Library/LaunchDaemons/com.vsearch.helper.plist
    /Library/LaunchDaemons/Jack.plist
    Restart the computer and empty the Trash. Then delete the following items in the same way:
    /Library/Application Support/VSearch
    /Library/PrivilegedHelperTools/Jack
    /System/Library/Frameworks/VSearch.framework
    Some of these items may be absent, in which case you'll get a message that the file can't be found. Skip that item and go on to the next one.
    From the Safari menu bar, select
    Safari ▹ Preferences... ▹ Extensions
    Uninstall any extensions you don't know you need, including any that have the word "Spigot" in the description. If in doubt, uninstall all extensions. Do the equivalent for the Firefox and Chrome browsers, if you use either of those.
    This trojan is distributed on illegal websites that traffic in pirated movies. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect much worse to happen in the future.
    You may be wondering why you didn't get a warning from Gatekeeper about installing software from an unknown developer, as you should have. The reason is that the DownLite developer has a codesigning certificate issued by Apple, which causes Gatekeeper to give the installer a pass. Apple could revoke the certificate, but as of this writing, has not done so, even though it's aware of the problem. This failure of oversight is inexcusable and has compromised the value of Gatekeeper and the Developer ID program. You can't rely on Gatekeeper alone to protect you from harmful software.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • I cannot figure out how to make the text larger on an incoming email.  The finger method doesn't work and I cannot find any toolbar with which to do it.  I could find nothing in settings also.  Plese help and thank you.

    I cannot figure out how to make the text larger in a received email.  The finger method doesn't work and I can find no tool bar as I can for composing emails.  I can find nothing in settings.  Please help and thank you in advance.

    Hi there,
    Download a piece of software called TinkerTool - that might just solve your problem. I have used it myself to change the system fonts on my iMac. It is software and not an app.
    Good wishes,
    John.

  • If I open a photo in "preview", multiple photos open. I just want to open one, but can't figure out how to do it.

    I keep multiple photos in a desktop folder to be quickly accessed by using Preview. But when I try to open ONE photo, it opens multiple photos. Can't figure out how to display just the single one that I select.  OS 10.7.2

    This is the resume feature of Lion. The last state of the application is saved when quitting (i.e last pictures viewed in Preview, last videos viewed in Quicktime etc).
    You can switch it off for Preview by copy and pasting the following in to the terminal application
    defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false

  • I have a new iPhone 5S.  While trying to learn about it, I accidentally recorded a voice memo with no content.  I cannot now figure out how to get rid of it.  There is a banner across the top of my phone with this memo which I don't want.  Help!

    I have a new iPhone 5S.  While trying to learn about it, I accidentally recorded a voice memo with no content.  I cannot now figure out how to get rid of it.  There is a banner across the top of my phone with this memo which I don't want.  I have deleted it from iTunes but cannot get it off the phone.  Help!

    The banner usually indicates that the memo is "Paused." If you go back into voice memos, touch the word "Done" beside the big red pause button, give it a name, then it will show in a list. Touch the memo in the list then touch the trash can icon that should appear.

  • Importing cd's and suddenly can't see the recently added folder, have been unable to figure out how to re-display it, know the songs are going somewhere

    Was importing cd's and suddenly can't see recently added folder, been unable to figure out how to re-display it, know the songs are going somewhere

    See Restore Original Smart Playlists.
    tt2

  • How do I use my iPhone to connect to the Internet. I down loaded safari v5.1.7 for my PC. I have added my iPhone to my computer but I can't figure out how to setup a hotspot or configure a network so my PC can access my phones data plan. Please help.

    And how am I supposed to answer my own question?

    I can't figure out how to respond so ill go this route. I can't seem to find the button/place to which I can choose, to turn on a hot spot. I have been through every option and searched to no avail. Could it be that my iPhone 4 is not hotspot capable as I was led to believe by the apple sales associate? Is there an app I can find to make my phone a wifi hotspot? So I can get on the Internet to view the pages I want that require adobe which this piece of **** software monger won't even support?

  • How do I use GarageBand as a amp/speaker to listen to my Electronic Drum set? I have a MIDI-USB cord already but I can't figure out how to listen to my set through the software using my computer speakers?

    How do I use GarageBand as a amp/speaker to listen to my Electronic Drum set? I have a MIDI-USB cord already but I can't figure out how to listen to my set through the software using my computer speakers?

    If you want to listen to the sounds of your drum set, you should use an audio cable and connect it to the computer's line-in, then create a real instrument track.
    If you use a Midi/USB interface, you'll have to create a software instrument track and select one of GB's drumsets as the instrument. Hopefully your drumset's midi notes are mapped to the right sounds in GB.

  • I gifted a ringtone to my sister that I purchased from the iTunes store, and it is on her phone, but we can't figure out how to get it moved to her ringtones.  Can anyone help?

    I gifted a ringtone to my sister that I purchased from the iTunes store, and it is on her phone, but we can't figure out how to get it moved to her ringtones.  Can anyone help?

    Edit > Preferences.  Select the check box for Ringtones, this will add them to the listing in iTunes. 
    Not sure that really answers your question though.

  • I'm new to Mac and cannot figure out how to upload photo's from my iPhoto library to eBay for the purpose of selling. Can anyone help?

    I'm a seller on eBay and very new to Mac. I just started to list an item when I got to the area of uploading  pictures of an item to my listing. I cannot figure out how this is done. I downloaded pictures from my camera to iPhoto and they apear not only in my iPhoto library but in an eBay folder/album I created. When I go to upload photos I cannot find my photos in either the Library or the eBay album. I've tried using both the basic uploader and and standard uploader choices provided by eBay.

    While running iPhoto you'll need to select the pictures you want to use for eBay and then select Export from the File menu. The Export Dialog box has several options and I believe the second option is File Export - that's the option you want to choose. Now you can select the picture quality, size, and export. The file selector will appear so you can indicate the folder you want the pictures to be exported into. Now you can take the next step, sending them to eBay.

  • I am having trouble setting up icloud it keeps sending me back to install instructions and I'm just getting frustrated. So far I'm not liking the new itunes I can't figure out how to  look at my duplicate music like I used to.

    I can't sign on to icloud. It says I need an icloud account. I click the help option it send me back to the same page. I reinstall it nothing.
    Download the iCloud Control Panel.
    To enable iCloud on your Windows PC, first set up iCloud on your other devices, then install the iCloud Control Panel for Windows (Windows Vista with Service Pack 2 or Windows 7 required).
    ok I can't seem to set up iCloud on any device I don't understand... Ive already installed it three times.
    Turn on iCloud.
    From the Windows Start menu, choose iCloud Control Panel.
    Enter the Apple ID you used to create your iCloud account and select the iCloud services you’d like to enable.
    For mail, contacts, and calendars, you can use iCloud.com or Outlook 2007 or later.
    there is no iCloud control panel but I click on i cloud. Then entere the Apple ID you used to create your iCloud account - WHAT!!!!? where is this I keep trying to find out how to create and iCloud account but I keep getting these stupid directions!!!
    Enable automatic downloads.
    To enable automatic downloads for your music, apps, and books, open iTunes > Edit > Preferences > Store and select Music, Apps, and Books.* (Requires iTunes 10.5 or later.)
    - This is the only step that makes sense and already did it...
    Turn on iCloud for the rest of your devices.
    To get the most out of iCloud, set it up everywhere.
    This is soooo frustrating!!!!
    Also I want to be able to look at duplicate songs on my itunes but after I downloaded the new version I can not figure out how to get that back. If the duplicate setting isn't in the new itunes I want the old version back.

    Did you ever resolve the iCloud problem.I am in the same position and its driving me mad!!! If you have a link to an solution I would appreciate it.

Maybe you are looking for