Image in Graphic

how can i draw an image in a component
and how can i draw an image instead of a graphic
please help, i'm turning around

Subclass the component you want to "replace".
Override the void paintComponent(Graphics g) method.
paint your previously loaded image using the Graphics reference passed into this function.
e.g. :-
g.drawImage(0,0,image,null);That should do some of what you want.
You also need to consider how you draw the correct image for the current state of the component (e.g. pressed/not pressed, disabled, etc)
What is the difference between an image and a graphic?

Similar Messages

  • How do I add video in my Photoshop images and graphics? I need it to play in Adobe Acrobat when I'm done.

    I designed an electronic press kit and I need the video to play on it. I'm getting the video link from YouTube so I was wondering how to make that happen. I already tried putting the YouTube link behind the video layer so it can be clickable in Acrobat, but when I sent it to the online magazine forum there was a lot of lines in it. I saw this YouTube video on how to do it but it requires ImageReady TUTORIAL-Add video to your Photoshop images and graphics! - YouTube. I don't have the Photoshop to ImageReady button in my PS....HELP! How do I get this done?!?!?

    That tutorial is extremely old. ImageReady was last used in CS2. In other words that program no longer exists.
    Luckily video made its way into photoshop so you can easily import your video into photoshop.
    Instead of an animation panel, it is now called the timeline panel. When the panel first opens it will ask you if you want an animation or a movie. Choosing movie will reduce the number of layers required down to just 2, one for the movie and one for the TV image. Since this is a timeline, you can split the timeline to remove any portion of the video you do not want or need to add an effect to that area of the timeline. Each time you split the video, it will move it to a new layer for you.
    You can still export as an animated gif by using the File>Save As dialog box. or You can export as a movie and choose another video format. Which format and codec you can choose will depend on how many other video apps of Adobe's you also have installed.

  • Importing image or graphic onto working layer?

    I am using Photoshop cs4
    When I work in Flash I can import a image or graphic to the library or directly onto the stage...My question is...Can I do this in photoshop?
    Thank you

    That was easy, Thank you very much.

  • How to moving image or graphic on the JPanel??

    Hi,
    Everybody got any idea to do using mouse listener to click and moving the image or graphic and then to put the object at any coordinate on the JPanel???
    Thank to reply..

    You don't
    You cannot use other countries itunes stores.
    Sorry

  • Draw to an image using graphics object

    ive been trying to this. create a starfield 800px wide and twice the height of the screen 2x600. this image would be scrolling down the screen giving the appearance of moving through space. what i did was create an image the called "starField", and created a graphics object "starFieldObj" to draw dots (stars) to this image.
    is this the correct way to do this? my program seems to work differently depending on where i call "generateStarField()" which draws to "starFieldObj"
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class Alpha1 extends Canvas implements Runnable, MouseMotionListener, MouseListener, KeyListener {
         private Image buffer; //bufer image
         private Graphics gfx;
         private Graphics starFieldObj;
         private Image playerShip;
         private int frames = 60; //frames per second
         private MediaTracker mediaTracker; //tracks loaded images
         private boolean ready; //ready to  start animation
         private int [] keys = new int[256];
         private int playerShipX = 100;
         private int playerShipY = 100;
         private static Random random = new Random();
         private Image starField;
         private int starFieldSpeed = 5;
         private int starFieldX = 0;
         private int starFieldY = -600;
         public static void main(String[] args)
              Alpha1 t = new Alpha1();
              Frame f = new Frame("blah");
              f.setSize(800, 600);
              f.add(t, BorderLayout.CENTER);
              f.show();
              t.start();
              t.requestFocus();
              f.addWindowListener(new WindowAdapter(){
                   public void windowClosing(WindowEvent e){
                        System.exit(0);}});
         public Alpha1()
              addKeyListener(this);
              addMouseListener(this);
              ready = false;
              mediaTracker = new MediaTracker(this);
              playerShip = getToolkit().getImage("testship1.png");
              //starField = getToolkit().getImage("testbg.png");
              //mediaTracker.addImage(playerShip, 0);
              mediaTracker.addImage(starField, 0);
              try {
                   mediaTracker.waitForID(0);
              catch (InterruptedException e) {
                   e.printStackTrace();
         public void start()
              buffer = createImage(getSize().width,getSize().height);
              //starField = createImage(getSize().width,getSize().height * 2);
              gfx = buffer.getGraphics();
              //starFieldObj = starField.getGraphics();
              generateStarfield();
              ready = true;
              new Thread(this).start();
         public void mouseDragged(MouseEvent e)     {}
         public void mouseMoved(MouseEvent e)     
              playerShipX = e.getX();
              playerShipY = e.getY();
         public void mouseReleased(MouseEvent e)     {}
         public void mousePressed(MouseEvent e)     {}
         public void mouseExited(MouseEvent e)     {}
         public void mouseEntered(MouseEvent e)  {}
         public void mouseClicked(MouseEvent e)     {}
         public void keyTyped(KeyEvent keyevent)     {}
         public void keyPressed(KeyEvent keyevent)
              keys[keyevent.getKeyCode()] = 1;
              System.out.println(keyevent.getKeyCode());
         public void keyReleased(KeyEvent keyevent)     
              keys[keyevent.getKeyCode()] = 0;
         public void run()
              while (true)
                   if (isVisible())
                        repaint();
                        updatePositions();
                   }//end if
                   try 
                   { Thread.sleep(1000/frames); }
                   catch (InterruptedException e)
                   { e.printStackTrace(); }
              }//end while
         public void paint(Graphics g) {     /*empty etc*/ }
         public void updatePositions()
              if (keys[38] == 1 & keys[40] == 0) //IF UP IS PRESSED
              { playerShipY -= 3; }
              if (keys[40] == 1 & keys[38] == 0) //IF DOWN IS PRESSED
              { playerShipY += 6; }
              if (keys[37] == 1 & keys[39] == 0) //IF LEFT IS PRESSED
              { playerShipX -= 5; }
              if (keys[39] == 1 & keys[37] == 0) //IF RIGHT IS PRESSED
              { playerShipX += 5; }
              //starFieldY = starFieldY + starFieldSpeed;
              //if (starFieldY == 0)
              //     starFieldY = -600;
              //     System.out.println("dadssa");
         public int getRandom(int from, int to)
              if (from > to)
                   int randTemp;
                   randTemp = from;
                   from = to;
                   to = randTemp;
              return random.nextInt(to-from+1)+from;
         public void generateStarfield()
              starFieldObj.setColor(Color.black);
              starFieldObj.fillRect (0, 0, 800, 600 * 2);
              for (int td=0; td < 900 ; td++) //draw 900x2 dots on 800x1200 image
                        starFieldObj.fillRect (getRandom(1,800), getRandom(1,600), 1, 1);
                        starFieldObj.fillRect (getRandom(1,800) + 800, getRandom(1,600) + 800, 1, 1);
         public void update(Graphics g)
              if (ready)
                   gfx.setColor(Color.black);
                   gfx.fillRect (0, 0, this.getSize().width, this.getSize().height);
                   //gfx.drawImage(starField,starFieldX,starFieldY,null);
                   gfx.drawImage(playerShip,playerShipX,playerShipY,null);
                   //gfx.drawString(Integer.toString(showFps),5,5);
                   g.drawImage(buffer,0,0,null);
    }

    updated code, i cant get starField to be 1200px in height
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class Alpha1 extends Canvas implements Runnable, MouseMotionListener, MouseListener, KeyListener {
         private Image buffer; //bufer image
         private Graphics gfx;
         private Graphics starFieldObj;
         private Image playerShip;
         private int frames = 60; //frames per second
         private MediaTracker mediaTracker; //tracks loaded images
         private boolean ready; //ready to  start animation
         private int [] keys = new int[256];
         private int playerShipX = 100;
         private int playerShipY = 100;
         private static Random random = new Random();
         private Image starField;
         private int starFieldSpeed = 5;
         private int starFieldX = 0;
         private int starFieldY = -600;
         public static void main(String[] args)
              Alpha1 t = new Alpha1();
              Frame f = new Frame("blah");
              f.setSize(800, 600);
              f.add(t, BorderLayout.CENTER);
              f.show();
              t.start();
              t.requestFocus();
              f.addWindowListener(new WindowAdapter(){
                   public void windowClosing(WindowEvent e){
                        System.exit(0);}});
         public Alpha1()
              addKeyListener(this);
              addMouseListener(this);
              ready = false;
              mediaTracker = new MediaTracker(this);
              playerShip = getToolkit().getImage("testship1.png");
              //starField = getToolkit().getImage("testbg.png");
              //mediaTracker.addImage(playerShip, 0);
              mediaTracker.addImage(starField, 0);
              try {
                   mediaTracker.waitForID(0);
              catch (InterruptedException e) {
                   e.printStackTrace();
         public void start()
              buffer = createImage(getSize().width,getSize().height);
              starField = createImage(getSize().width,1200);
              gfx = buffer.getGraphics();
              starFieldObj = starField.getGraphics();
              ready = true;
              new Thread(this).start();
         public void mouseDragged(MouseEvent e)     {}
         public void mouseMoved(MouseEvent e)     
              playerShipX = e.getX();
              playerShipY = e.getY();
         public void mouseReleased(MouseEvent e)     {}
         public void mousePressed(MouseEvent e)     {}
         public void mouseExited(MouseEvent e)     {}
         public void mouseEntered(MouseEvent e)  {}
         public void mouseClicked(MouseEvent e)     {}
         public void keyTyped(KeyEvent keyevent)     {}
         public void keyPressed(KeyEvent keyevent)
              keys[keyevent.getKeyCode()] = 1;
              System.out.println(keyevent.getKeyCode());
         public void keyReleased(KeyEvent keyevent)     
              keys[keyevent.getKeyCode()] = 0;
         public void run()
              generateStarfield();
              while (true)
                   if (isVisible())
                        repaint();
                        updatePositions();
                   }//end if
                   try 
                   { Thread.sleep(1000/frames); }
                   catch (InterruptedException e)
                   { e.printStackTrace(); }
              }//end while
         public void paint(Graphics g) {     /*empty etc*/ }
         public void updatePositions()
              if (keys[38] == 1 & keys[40] == 0) //IF UP IS PRESSED
              { playerShipY -= 3; }
              if (keys[40] == 1 & keys[38] == 0) //IF DOWN IS PRESSED
              { playerShipY += 6; }
              if (keys[37] == 1 & keys[39] == 0) //IF LEFT IS PRESSED
              { playerShipX -= 5; }
              if (keys[39] == 1 & keys[37] == 0) //IF RIGHT IS PRESSED
              { playerShipX += 5; }
              starFieldY = starFieldY + starFieldSpeed;
              if (starFieldY == 0)
                   starFieldY = -600;
                   System.out.println("dadssa");
         public int getRandom(int from, int to)
              if (from > to)
                   int randTemp;
                   randTemp = from;
                   from = to;
                   to = randTemp;
              return random.nextInt(to-from+1)+from;
         public void generateStarfield()
              starFieldObj.setColor(Color.black);
              starFieldObj.fillRect (0, 0, 800, 1200);
              for (int td=0; td < 900 ; td++) //draw 900x2 dots on 800x1200 image
                        starFieldObj.setColor(Color.white);
                        starFieldObj.fillRect (getRandom(1,800), getRandom(1,600), 1, 1);
                        starFieldObj.fillRect (getRandom(1,800) + 800, getRandom(1,600) + 800, 1, 1);
         public void update(Graphics g)
              if (ready)
                   gfx.setColor(Color.black);
                   //gfx.fillRect (0, 0, this.getSize().width, this.getSize().height);
                   gfx.drawImage(starField,starFieldX,starFieldY,null);
                   gfx.drawImage(playerShip,playerShipX,playerShipY,null);
                   //gfx.drawString(Integer.toString(showFps),5,5);
                   g.drawImage(buffer,0,0,null);
    }

  • Crystal Reports 2008 crashes when previewing image with graphic location

    Hi,
    I'm using Crystal Reports 2008 for SAP Business One.  When I try to insert an image with a UNC graphic location (browse to a UNC drive for image) and I preview, Crystal Reports crashes with the following debug info:
    Problem signature:
      Problem Event Name:     APPCRASH
      Application Name:     crw32.exe
      Application Version:     12.1.0.892
      Application Timestamp:     48de4bbc
      Fault Module Name:     cslibu-3-0.dll
      Fault Module Version:     12.4.0.966
      Fault Module Timestamp:     4daed0a1
      Exception Code:     c0000094
      Exception Offset:     0002d7fd
      OS Version:     6.1.7601.2.1.0.272.7
      Locale ID:     1033
      Additional Information 1:     0a9e
      Additional Information 2:     0a9e372d3b4ad19135b953a78882e789
      Additional Information 3:     0a9e
      Additional Information 4:     0a9e372d3b4ad19135b953a78882e789
    Any idea why?  If I trun graphic location off, it works fine.
    The code I'm using to pull image is:
    sapserver\B1_SHR\Bitmaps\Versailles\" & {RSM_Inventory_Images;1.PicturName}
    Thanks.

    Through  Startu2014Run are you able to view the image by choosing the following path ?
    sapserver\B1_SHR\Bitmaps\Versailles\" & {RSM_Inventory_Images;1.PicturName}
    Also try to insert any image which is on your local hard drive and try.  I think this is because, CR is unable to access the images which are on UNC.
    Thanks,
    Sastry

  • Adding image to graphic

    Hi,
    I am trying to add an image instead of a red square to the Performing custom painting demo.
    http://java.sun.com/docs/books/tutorial/uiswing/painting/refining.html
    I have loaded the image into the class, but can't work out how to display it in the graphic.
    It is probably something simple (I hope). Any pointers will be greatly appreciated.
    Attached is the code to the class.
    class NorthPoint{
    private int xPos = 150;
    private int yPos = 200;
    private int width = 100;
    private int height = 100;
    public static void main(String[] args) throws IOException
    // load north point image
    BufferedImage img = ImageIO.read(new File("NorthPoint100.png"));
    Icon icon = new ImageIcon(img);
    JComponent nthPnt = new JLabel(icon);
    public void setX(int xPos){
    this.xPos = xPos;
    public int getX(){
    return xPos;
    public void setY(int yPos){
    this.yPos = yPos;
    public int getY(){
    return yPos;
    public int getWidth(){
    return width;
    public int getHeight(){
    return height;
    public void paintNorth(Graphics g){
    // g.setColor(Color.BLUE);
    // g.fillRect(xPos,yPos,width,height);
    g.setColor(Color.BLACK);
    g.drawRect(xPos,yPos,width,height);

    Use the drawImage method in Graphics. [http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Graphics.html]

  • Images and graphics are not showing in certain emails when using Firefox. They show in Google Chrome.

    Certain emails from f.chtah.com(image info) are not showing graphic or image content. This happens in both gmail and hotmail. If opened in Google Chrome, they show up.
    I had my computer wiped clean last week and everything was showing up ok again until this morning. The same emails are having the problem that was going on for the previous month.
    I make sure that all updates are installed.

    I figured it out. Clear your cookies. The company that hosts the images and the stylesheets updated their domain name- i figured this out in Chrome, it was showing a different URL for the css- http://ebm.cheetahmail.com
    After all the cookies (Privacy Tab in preferences) and reloading the pages the images and stylesheets started working again.
    I hope this helps other folks.

  • HT201317 I've noticed two things that my ipad no longer does, if save an image from graphic art on the internet, it used to save them to photostream, it no longer does, and with all the settings on my photos no longer shared between ipad and pc, like it u

    I've noticed two things my Ipad no longer does, If I save an image from an internet graphic file - facebook or whatever, the photo used to be saved to photostream... it no longer saves it to anywhere. Also having made sure all the boxes are ticked with photostream and ICloud and not knowingly changed anything, photos take with Ipad/photostream no longer end up in icloud and available to other machines eg. windows pc. Anyone got any suggestions?

    Try here:
    iPod touch: Hardware troubleshooting
    iOS: Not responding or does not turn on
    To get the calender and contacts back if you can't get the iPod working is to restore the new iPod from the backup of the old one.

  • Whenever i open any website with fire fox from my laptop,the website will open without images and graphics.what do i do?

    it all started yesterday.i have been enjoying my browsing with firefox up untill yesterday.when ever i come a website using firefox, the website will open but the graphic in the website will appear as plain text and ALL images in the website will not appear.Thus the website will appear as blank with just plain text.in site such as yahoomail and facebook,the text will appear scattered and no image will appear.tried downloading the latest firefox version,but the file could not be install because it is always coming as corrupted file.what do i do?

    I'm having this issue too. But no matter what I do, it doesnt seem to be fixed. The images aren't showing up on my Facebook, but its only the profile pictures. I can turn off my computer, and load it up again, but they still won't show up. And the images show up on other computers and on my phone but they won't show up on my computer. And I can't figure out how to fix it.
    If anyone knows how to fix this, Please help. I wan't to see my friends profile pictures again. Please, Please, Please.... Please!! Help!
    Thanks,
    Zeek

  • Getting maximum quality export for InDesign images or graphics

    I'm extracting the images from an InDesign file for an ePub. I'm doing the ePub creating independant of InDesign, however with images I'm trying to preserve some of the work done by people in the past in formatting the images.
    What I'm finding is that the image is exported the same size as in the InDesign document, the problem with this is that if I zoom into the image it looks pixelated, whereas if I zoom into the original document it's not pixelated at all. Any suggestions on how to modify the following code to get a higher resolution export? While I appreciate that the image size is preserved, I'm wondering at what point in the export the image resolution is scaled down.
    function getImages(){    for(var i = 0; i<app.activeDocument.pages.length; i++){        for(var j = 0; j<app.activeDocument.pages[i].allPageItems.length; j++){            var pageItem = app.activeDocument.pages[i].allPageItems[j];            if(pageItem.constructor.name.match(/pdf|image/i)){                pageItem.exportFile(ExportFormat.PNG_FORMAT,File("~\\desktop\\epub2\\"+app.activeDocument.name.replace(".indd","")+"\\oebps\\images\\"+pageItem.itemLink.name.substring(0,pageItem.itemLink.name.indexOf("."))+".png"),false);                }            }        }    }

    PNG export is done at screen resolution. In CS6, you can try setting the PNG export resolution (that property doesn't seem available in lower versions). If your version is lower than CS6, you could try up-scaling the original before exporting.
    Exporting *an*y page item to PNG converts it to a bitmap, even if the original is pure vector; so you'll *never* get an 'infinitely scaleable' graphic. All you get is a huge bitmap -- and its size increases squarely with an increasing resolution. (Approximately; PNG compression helps a bit, but it won't magically make a larger image a smaller file size than the original.)

  • Images and graphics in PDF turn black upon upload onto a website

    Hi there!
    I have a problem with a pdf file that I have uploaded onto a website in the process of creating a self published book.  It appears fine when I view it as a pdf prior to upload but, once I upload it, some of the images are replaced by black boxes.  This seems to be the case no matter what browser is used. Any ideas of the cause or how this can be fixed?  the pdf is a compilation of a number of student pdf's that I combined into one so, I don't have the original files used to create the pdf (in design, etc).
    thanks for any advice or help that you can offer

    Here is an example PDF, I had to take a screen shot so I could clear out the customer data. This is before we upload it to the investors website. Keep in mind this is a single page out of hundreds that look fine.
    http://imgur.com/4dKQt1H
    This is the after shot. The "fannie mae" logo is "blacked out."
    http://imgur.com/ved34Om

  • IBook author interactive image label: graphic control is locked?

    The interactive image lets you adjust the frame and background, but not the labels nor end the point styles! The ability is there but it is locked! Here's a screen shot showing the 'greyed out' control options. Is there a trick to enable the capability? Or is it on the debug list for the next update? 

    Hello Vita,
    When I was last working with this widget and came across the same issue.
    The only way to try and control it was by adding in character returns to change the height and to stretch the box out by the handles at the left and right of the box itself. But yes it would be great to have more control over the the parameters.
    Regards,
    Nigel

  • Placed image hides graphic objects on master

    Mac OS 10.8 \ ID CS5
    Rectangular frame created on master \ photo corners created in InDesign for each of the four corners
    In the document page when an image is placed in the frame, the image hides the portion of the corners that lie within the frame
    I tried bring to front for corners - no joy - can't seem to send frame to back
    I can copy the corners from the master page and paste in place on the document page - works fine - full corners show with image below
    With 50-75 anticipated pages and about 75 photos, I need a better way. Help, please?
    Message was edited by: FroggyGreen

    Make a new layer (above the current one).
    Go to your Master page and move the elements you want in front to the new layer.

  • Change images and graphic button

    hi experts
    i'd like to know, by the se80, how is possible to change the standard images of SRM 3.0 and also its standard buttons...i'd like to give to the system a "custom look".
    Thanks
    andrea

    hi,
    if you would like to change the login page, this is no longer on the template possible. Please use
    HTM_LOGIN in class CL_SRM_ICF_BASIC_LOGIN. See OSS note 778488.
    You must upload new image in se80 -> internet services -> bbpglobal into MIMES,
    then go to eg. login.html and change sap image to yours.
    (don't forget to publish services after upload)
    Check also this link:
    http://help.sap.com/saphelp_srm50/helpdata/en/60/93b74377a911d2b41c006094b92d37/frameset.htm
    BR,
    Disha.
    Do reward points for useful answers.

Maybe you are looking for