Displaying image in JPanel and scroll it through JScrollpanel

Can any one will help me,
I need to draw a image in a JPanel and, this JPanel is attached with a Jscrollpanel.
I need to scroll the this JPanel to view the image.

Here is my code for that
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class PicPanel extends javax.swing.JPanel implements WindowListener{
/** Creates new form PicPanel */
public PicPanel() {
initComponents();
// this.setOpaque(true);
JFrame myFrame = new JFrame("Panel Tiler");
myFrame.addWindowListener( this );
myFrame.setSize(new Dimension(1000,300));
setPreferredSize(new Dimension(1000,300));
Container cp = myFrame.getContentPane();
cp.add( this, BorderLayout.CENTER );
tk = Toolkit.getDefaultToolkit();
im =tk.getImage("smple.jpg");
     jPanel1.im=im;
// jPanel1.setSize(new Dimension(1000,300));
myFrame.pack();
myFrame.show();
jPanel1.repaint();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
     jPanel1=new JPanelC();
jScrollPane1 = new javax.swing.JScrollPane(jPanel1);
setLayout(new java.awt.GridBagLayout());
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
jScrollPane1.setOpaque(false);
     gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridheight = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.ipadx = 378;
gridBagConstraints.ipady = 298;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
add(jScrollPane1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.ipadx = 372;
gridBagConstraints.ipady = 280;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
add(jPanel1, gridBagConstraints);
public static void main(String[] args)
new PicPanel();
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e)
// myFrame.dispose();
System.exit(0);
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowActivated(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
private JPanelC jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private Icon iiBackground;
private Toolkit tk;
private Image im;
class JPanelC extends javax.swing.JPanel{
public Image im;
public void paintComponent(Graphics g){
          //super.paintComponent(g);
if(im!=null)
               imageobserver io = new imageobserver();
     System.out.println(im.getHeight(io));
     if(im.getHeight(io)!=-1)
setSize(im.getWidth(io), im.getHeight(io));
g.drawImage(im,0,0,null);
     // setOpaque(false);
super.paintComponent(g);
class imageobserver implements java.awt.image.ImageObserver{
public boolean imageUpdate(Image img, int infoflags, int x, int y,int width, int height) {
          if ((infoflags & java.awt.image.ImageObserver.ALLBITS) != 0) {
repaint();
return false;
//repaint();
return true;
Here i need to scroll the image in the panel but it is not working out.

Similar Messages

  • Display image in JPanel without saving any file to disk

    Hi,
    I am fetching images from database. I am saving this image, display in JPanel and delete it. But this is not actually I want.
    I wish to fetch this image as stream , store in memory and display in JPanel without saving any fiel in disk.
    I wonder if it is Possible or any used implementation that I can use in my project. Any idea or experienced knowledge is enough.
    Thanks

    In what format is the image coming to you from the database? If it's an InputStream subclass, just use javax.imageio.ImageIO:
    InputStream in = getImageInputStream();
    BufferedImage image = null;
    try {
       image = ImageIO.read(in);
    } finally {
       in.close();
    // ... Display image in your JPanel as you have beenIf you receive the image as an array of bytes, use the same method as above, but with a ByteArrayInputStream:
    byte[] imageData = getImageData();
    ByteArrayInputStream in = new ByteArrayInputStream(imageData);
    BufferedImage image = null;
    try {
       image = ImageIO.read(in);
    } finally {
       in.close();
    // ... Display image in your JPanel as you have been

  • Two problems with displaying images in JPanel

    Hi,
    I need to display some small rectangular images inside a JPanel. These images also need to be componenents as they will have listeners associated with them. I have never had any experience with images, so I might totally be down the wrong path. I was thinking of just creating a class which extends JComponent, and using the graphics drawImage method. However, I don't want each image component to have to know exactly where to draw the image associated with itself. Rather, I want the JPanel which holds all of the images to know how to lay them out.
    Is there an easier way to use images?
    Which brings me to my second problem. I want these images to overlap each other, so that only a small portion of each is showing (this way I can fit more on the screen), then when the user clicks on one, I can show more of it.
    Unfortunately, I don't know of any layout managers which will allow me to overlap components. I could use the drawImage method mentioned above, but like I said, I would like to try to not have each image object try and figure out its location.
    any help is greatly appreciated. Thanks!

    Hi
    there is a better way ; it is called a JLabel ;-)
    JLabel myJLabel = new JLabel(new ImageIcon("img/myLogo.gif"));for your second problem, don't use any layout manager like in this code :
    myJPanel.setLayout(null);
    myJPanel.add(myJLabel);
    myJLabel.setBounds(new Rectangle(x, y, width, height);hope it helps
    Nico

  • Having trouble displaying image in JPanel

    I want to display an image in jpanel making it to scale to the size of the panel.
    And later i should be able to draw on that image , i am really new to all this , but i have to finish it soon.
    This is the code i am compiling and getting error
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class LocaterClient extends JFrame
         JPanel panel;
         public LocaterClient()
              super("LocaterClient");
              panel = new JPanel();
              panel.setSize(374,378);
              panel.setOpaque(false);
              panel.setVisible(true);
         getContentPane().add(panel);
         /*JFrame f = new JFrame();
         f.setSize(374,378);
         f.getContentPane().add(panel);*/
         public void paintComponent(Graphics g)
              super.paintComponent(g);
              ImageIcon img = new ImageIcon("World_MER.jpg");
              ImageIcon fillImage = new ImageIcon(img.getImage().getScaledInstance
    (getWidth(), getHeight(),Image.SCALE_REPLICATE));
              g.drawImage(fillImage.getImage(), 0,0, this);
         public static void main(String args[])
              LocaterClient lc = new LocaterClient();
              lc.setDefaultCloseOperation( EXIT_ON_CLOSE );
              lc.pack();
              lc.setVisible(true);
    This is the error i am getting
    LocaterClient.java:24: cannot resolve symbol
    symbol : method paintComponent (java.awt.Graphics)
    location: class javax.swing.JFrame
    super.paintComponent(g);
    ^
    1 error
    If i remove super.paintComponent(g); line it compiles and runs but i get a tiny panel without the image.
    PLease help me , i am not evn sure is this is the procedure should i follow , because i should be able to draw on that image later on .
    Please provide me with some sample code.

    import javax.swing.*;
    import java.awt.*;
    public class ImagePainter extends JPanel{
      private Image img;
      public ImagePainter(){
        img = Toolkit.getDefaultToolkit().getImage("MyImage.gif");
      public void paintComponent(Graphics g){
        g.drawImage(img,0,0,getSize().width,getSize().height);
      public static void main(String[]args){
        JFrame frame = new JFrame();
        frame.getContentPane.add(new ImagePainter());
        frame.setSize(500,500);
        frame.show();

  • Need to display image on JPanel

    Hello
    I am trying to implement a graphical version of the Knights Tour. I am done with the algorithm part of the problem itself. I am having problem with displaying the chess board. Although seemingly straightforward the images will not display on the JPanel. Below is a sample of what I am trying to do. Can anyone explain why the code does not work even though it seems okay. Thanks and best regards.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    public class test extends JFrame { 
    public test(){ 
    panel pane = new panel();
    getContentPane().add(pane);
    public static void main(String[]args){   
    test tst = new test();
    tst.setSize(500,500);
    tst.show();
    public class panel extends JPanel{   // inner class
    private Image img;
    private ImageIcon icon;
    public panel(){
    icon = new ImageIcon("cross.gif");
    img = icon.getImage();
    public void paintComponent(Graphics g)
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D)g;
    System.out.println("I am here");
    g.drawImage(img,40,40,this);
    }

    package com.lc.util.swing ;
    import java.awt.Color ;
    import java.awt.Graphics ;
    import java.awt.Image;
    import java.awt.Insets;
    import java.awt.Dimension ;
    import java.awt.image.ImageObserver ;
    import javax.swing.JPanel;
    import javax.swing.border.Border;
    * Panel displaying an {@link Image}.
    * <ul>
    * <li>8 positions,</li>
    * <li>
    * can stretch image for filling the whole available area, or diminish
    * its size if too large in width or height,
    * </li>
    * <li>respects borders (as defined by
    * {@link javax.swing.JComponent#setBorder( javax.swing.border.Border ) JComponent.setBorder}
    * </li>
    * </ul>
    * @author Laurent Caillette
    * @version $Revision: 1.1.1.1 $ $Date: 2002/02/19 22:12:04 $
    public class JImagePanel extends JPanel {
    public JImagePanel() {
    imageObserver = this ;
    * Constructeur assignant une image.
    public JImagePanel( Image image ) {
    this() ;
    setImage( image ) ;
    private Image image ;
    private ImageObserver imageObserver ;
    public void setImage( Image image ) {
    this.image = image ;
    adjustPreferredSize();
    public void setBorder( Border newBorder ) {
    super.setBorder( newBorder ) ;
    adjustPreferredSize() ;
    private void adjustPreferredSize() {
    if( image != null ) {
    int w = image.getWidth( imageObserver ) ;
    int h = image.getHeight( imageObserver ) ;
    Border border = getBorder() ;
    if( border != null ) {
    Insets insets = border.getBorderInsets( this ) ;
    if( insets != null ) {
    w += ( insets.left + insets.right ) ;
    h += ( insets.top + insets.bottom ) ;
    Dimension dim = new Dimension( w, h ) ;
    this.setPreferredSize( dim ) ;
    private int placement = CENTER ;
    public int getPlacement() { return placement ; }
    public void setPlacement( int placement ) {
    if( ( placement < CENTER ) || ( placement > STRETCH ) ) {
    throw new IllegalArgumentException( "Unsupported placement value" ) ;
    this.placement = placement ;
    public void paint( Graphics gr ) {
    // x of Image to draw
    int x ;
    // y of Image to draw
    int y ;
    // width of Image to draw
    int iw ;
    // height of Image to draw
    int ih ;
    // thickness of left border
    int bl = 0 ;
    // thickness of upper border
    int bt = 0 ;
    // thickness of right border
    int br = 0 ;
    // thickness of lower border
    int bb = 0 ;
    // width of drawable area
    int pw = this.getWidth() ;
    // height of drawable area
    int ph = this.getHeight() ;
    // Handle borders
    Insets insets = null ;
    Border border = getBorder() ;
    if( border != null ) {
    insets = getBorder().getBorderInsets( this ) ;
    if( insets != null ) {
    bl = insets.left ;
    br = insets.right ;
    bb = insets.bottom ;
    bt = insets.top ;
    pw = pw - bl - br ;
    ph = ph - bt - bb ;
    // Always display background, for supporting transparency.
    super.paint( gr ) ;
    if( image != null ) {
    iw = image.getWidth( imageObserver ) ;
    ih = image.getHeight( imageObserver ) ;
    if( ( placement == STRETCH ) ||
    ( iw > pw ) ||
    ( ih > ph )
    gr.drawImage(image, bl, bt, pw, ph, imageObserver ) ;
    } else {
    iw = image.getWidth( imageObserver ) ;
    ih = image.getHeight( imageObserver ) ;
    switch( placement ) {
    case CENTER :
    x = ( pw - iw ) / 2 ;
    y = ( ph - ih ) / 2 ;
    break ;
    case NORTH :
    x = ( pw - iw ) / 2 ;
    y = 0 ;
    break ;
    case NORTHEAST :
    x = pw - iw ;
    y = 0 ;
    break ;
    case EAST :
    x = pw - iw ;
    y = (ph - ih ) / 2 ;
    break ;
    case SOUTHEAST :
    x = pw - iw ;
    y = ph - ih ;
    break ;
    case SOUTH :
    x = ( pw - iw ) / 2 ;
    y = ph - ih ;
    break ;
    case SOUTHWEST :
    x = 0 ;
    y = ph - ih ;
    break ;
    case WEST :
    x = 0 ;
    y = ( ph - ih ) / 2 ;
    break ;
    case NORTHWEST :
    x = 0 ;
    y = 0 ;
    break ;
    default :
    throw new IllegalArgumentException(
    "Unsupported placement value" ) ;
    // Add border offset
    x += bl ;
    y += bt ;
    gr.drawImage( image, x, y, this ) ;
    public final static int CENTER = 0 ;
    public final static int NORTH = 1 ;
    public final static int NORTHEAST = 2 ;
    public final static int EAST = 3 ;
    public final static int SOUTHEAST = 4 ;
    public final static int SOUTH = 5 ;
    public final static int SOUTHWEST = 6 ;
    public final static int WEST = 7 ;
    public final static int NORTHWEST = 8 ;
    public final static int STRETCH = 9 ;

  • Displaying image in Dashabord and Answers

    I have already put the image to the following folders:
    C:\OracleBI\web\app\res\s_oracle10\images
    And
    C:\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10
    The presentation service was restarted.
    The report refers to the image as : fmap:images/your_namename.gif
    The dash refers to the image as : fmap:impages/your_gif.gif
    However the image is not displayed (only a red cross is available in the) in the report /dashboard.
    can anyone please help.. thanks!

    Hi check the below link, i have updated the step in detail
    Re: Add new image in Conditional Column Format
    Contents:
    Try the two solution for this, go to
    *1. This will use to call the images using fmap keyword*
    <directory>:\OracleBI\web\app\res\s_oracle10\images
    And
    <directory>:\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10\images
    folder copy your images (gif/jpg) in both the folders (images must be copied in both folders with same name).
    Restart the ocj4_admin and BI presentation services.
    You can refer the image by giving the following format fmap:images/youimagename.gif
    *2. This will use to display images in the images browser*
    <directory>:\OracleBI\web\app\res\s_oracle10\meters
    And
    <directory>:\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10\meters
    Step i) Create a folder in the above two path with same name (i have taken MyImages)
    Step ii) Copy your images in one subfolder like below (i have created a subfolder called setA)
    <directory>:\OracleBI\web\app\res\s_oracle10\meters\MyImages\setA
    And
    <directory>:\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10\meters\MyImages\setA
    Step iii) Leave one image in the MyImages folder with the name of index.gif. This will show in the left side legend of the image browser.
    Now restart your oc4j_admin and bi presentation services.....
    h1. Note:_
    Must clear the browser cache and temprory internet files. Sometimes the changes are not get reflected even the services are restarted.
    Hope this helps, let me know if you need more

  • Osmf Flash Player will not display images in safari and chrome

    In OSMF player, I am using  image to display as thumbnail before playing video.
    Image is displaying properly in IE and Firefox but I am getting error in safari and chrome.
    Error of flash player:
    ArgumentError: Invalid parameter passed to method
        at org.osmf.traits::LoadTrait/setBytesLoaded()
        at org.osmf.elements.loaderClasses::LoaderLoadTrait/onContentLoadProgress()
    ArgumentError: Invalid parameter passed to method
        at org.osmf.traits::LoadTrait/setBytesLoaded()
        at org.osmf.elements.loaderClasses::LoaderLoadTrait/loadStateChangeStart()
        at org.osmf.traits::LoadTrait/setLoadState()
        at org.osmf.traits::LoadTrait/onLoadStateChange()
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at org.osmf.traits::LoaderBase/updateLoadTrait()
        at Function/<anonymous>()
    Please help me in resolving this issue. This error occurs with some specific image url's only

    <table width="969" border="1">
      <tr>
        <td colspan="3"><object id="Portfolio" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="500" height="450">
          <param name="movie" value="Flash/Portfolio.swf" />
          <param name="quality" value="high" />
          <param name="wmode" value="opaque" />
          <param name="swfversion" value="9.0.45.0" />
          <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
          <param name="expressinstall" value="Scripts/expressInstall.swf" />
          <param name="LOOP" value="false" />
          <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
          <!--[if !IE]>-->
          <object type="application/x-shockwave-flash" data="Flash/Portfolio.swf" width="500" height="450">
            <!--<![endif]-->
            <param name="quality" value="high" />
            <param name="wmode" value="opaque" />
            <param name="swfversion" value="9.0.45.0" />
            <param name="expressinstall" value="Scripts/expressInstall.swf" />
            <param name="LOOP" value="false" />
            <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
            <div>
              <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
              <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
            </div>
            <!--[if !IE]>-->
          </object>
          <!--<![endif]-->
        </object></td>
      </tr>

  • Having trouble displaying images on a page in APEX through IE.

    I'm trying to conditionally display images (used as toggle buttons) in a tabular report in APEX. This is for our Benefits application where an employee can include or exclude his/her dependents from the plan. For each row, in one column I want to show only 'Include' button if an individual is not already a member, and in another column show only 'Remove' button if already included. I'm using the button images as links and passing information to a page process.
    I was able to come up with the SQL query which works perfectly fine in Firefox. But the images won't display in Internet Explorer. Does anyone have any idea how to make this work in IE?
    Below is my query. This code will display 'Include in plan' image only if the member is not already added to the plan. If 'Y' is the result of the query, then the member is already included and no image is displayed. Otherwise display the image. Pass the member_id to an application item and process the record in a Before Header process.
    select elected_member_id, member_type, last_name, first_name, middle_name, gender,date_of_birth,student_flag,trunc(months_between(sysdate ,date_of_birth)/12) AGE,
    decode((select 'Y'
    from eben_elected_plan_info epi
         where plan_name not in ('Delta', 'Vision', 'HEALTH_FLEX', 'DEP_FLEX')
         and epi.elected_member_id = emi.elected_member_id
         and transaction_type <> 'END'), null,'<a href="f?p=&APP_ID.:70:&SESSION.::::F_APP_MEMBER_INCLUDE:'||elected_member_id||'<img src="&WORKSPACE_IMAGES.include.png"></a>') elected_member_id_include,
    elected_member_id elected_member_id_exclude
    from eben_elected_members_info emi
    where emp_person_id = :f_app_person_id
    and member_type <> 'Employee'

    I was able to resolve this issue by creating the SQL statement from scratch in IE. It then recognized the images.

  • Displaying Images in Results and Product Modules?

    Hi folks, 
    I am confused on two issues.    When I do a search or insert a product list module into a page, it is displaying as text only and not as images with text, as it appears in the insert option menu:
    http://screencast.com/t/RHNmcGFY
    I'm sure I'm doing something basic wrong, but I want to display the product list  with images.
    http://joden.businesscatalyst.com/edwardian-jewelry
    Also,  when my client tried to do this:  E-Commerce>Products>Actions :  Insert into web page,  the module it created on the home page was blown apart in CSS by the   <div class="featuredslider" id="products-featured">  even though we placed the module outside that div.
    http://joden.businesscatalyst.com/
    On the home page, I ended up creating a (unsuccessfully) specialized ul  with the classes of the normal  display layout : http://joden.businesscatalyst.com/antique-jewelry
    but that won't work if she wants to update the page from time to time.   What she wants to do is display not the catalog thumbmail for a New Items catalog, but a mini product list for brand new items in the New Items Catalog.
    Thanks for the help. 
    Jeff

    I thought these forums were for people who didn't know how to do something to learn from those who did.
    Part of learning is learning whether to do something, not just how to do it. I see people on these forums all the time wanting to do some really stupid thing that's going to screw up their system or tick someone off. Would I be doing them a service if I did not try to point out such mistakes?
    What I am looking for is a way to convert the Pages document into a better format for emailing. html would be great.
    Unfortunately (or fortunately if you have the same view of HTML e-mail that I do), Mail does not make it easy to edit HTML e-mails. Although a rich text message is actually HTML, I don't honestly know how to edit the HTML itself. But, again, you're going to have much more success printing the Pages document to a PDF and uploading that to a web site, then e-mailing the link. You can't predict how another e-mail client is going to display anything other than plain text.

  • Display image using JPanel

    i have got buffered image from webcam using jmf. i want to display it on JPanel.
    i override paint() but it doesn't display as it captures
    when i maximize window it then displays
    urgent help needed

    The bounds of your JPanel may be incorrect. You should try the setBounds(int x, int y, int width, int height) method on it.
    Please past your code for more help :p

  • Simple and efficient way to display image on jpanel

    AOA
    What may be the simple and efficient way
    to display a strored jpg image on a jpanel in an application.
    i will appreciate more than one ways.
    thanks

    JPanel panel = new JPanel() {
         public void paintComponent(Graphics g) {
                   g.drawImage(......);
    };

  • Problem displaying image in jpanel

    Hi,I have posted this on the applet board, but I think its also a general programming problem, so apologies if it isn't relevant to this board, just say so and I'll remove it!
    I've got an applet that receives a variable from a PHP page as a parameter. The variable is "map1.png" the map this variable refers to sits in the same folder as the applet.
    I want to use this variable along with getDocumentBase() to create a URL which will then be used to display an image within a jPanel called mapPane.
    the code I currently have is:
    // get image url
    String mapURL = getParameter("mapURL");
    //set variable for image
    Image map_png;
    // set media tracker
    MediaTracker mt;
    //initialise media tracker     
    mt = new MediaTracker(this);
    map_png = getImage(getDocumentBase(),mapURL);
    // tell the MediaTracker to kep an eye on this image, and give it ID 1;
    mt.addImage(map_png,1);
    // now tell the mediaTracker to stop the applet execution
    // until the images are fully loaded.
    try
    mt.waitForAll();
    catch (InterruptedException e) {}
    // draw image onto mapPane
    mapPane.getGraphics().drawImage(map_png, 200, 200, null);
    Currently the Parameter is being passed into the applet (i've written it out within the applet) but the image is not being displayed. Does anyone have any suggestions about what I'm doing wrong?
    Cheers
    Steve

    hi,
    No, don't get any exceptions, the Java Console has a message:
    <terminated>JavaImageEditor[Java Applet]C:\Program Files\Java\jre1.6.0\bin\javaw.exe
    Cheers
    Steve

  • Problems displaying image in JPanel

    Hi, I've got an applet that receives a variable from a PHP page as a parameter. The variable is "map1.png" the map this variable refers to sits in the same folder as the applet.
    I want to use this variable along with getDocumentBase() to create a URL which will then be used to display an image within a jPanel called mapPane.
    the code I currently have is:
    // get image url
            String mapURL = getParameter("mapURL");
            //set variable for image
            Image map_png;
            // set media tracker
            MediaTracker mt;
            //initialise media tracker             
            mt = new MediaTracker(this);
            map_png = getImage(getDocumentBase(),mapURL);
            // tell the MediaTracker to kep an eye on this image, and give it ID 1;
            mt.addImage(map_png,1);
            // now tell the mediaTracker to stop the applet execution
            //  until the images are fully loaded.
            try
                 mt.waitForAll();
            catch (InterruptedException  e) {}
            // draw image onto mapPane
            mapPane.getGraphics().drawImage(map_png, 200, 200, null);Currently the Parameter is being passed into the applet (i've written it out within the applet) but the image is not being displayed. Does anyone have any suggestions about what I'm doing wrong?
    Cheers
    Steve

    Hello,
    after an update of the graphics card driver to the newest just released version the problem has vanished.
    Regards

  • How to display image at jpanel in application GUI

    i wana load an image from given location to my GUI when application starts.
    according to my perception this code should load image but its not working.
    Will any body kindly help me and point out the "reasons" for not working following piece of code from my application.
    public class MainFrame extends JFrame
    JPanel jPanel1 = new JPanel();
    JPanel jPanel2 = new JPanel();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    Image image = Toolkit.getDefaultToolkit().createImage("c:\\form-3.jpg");
    javax.swing.JScrollBar jScrollBar1 = new JScrollBar();
    BorderLayout borderLayout1 = new BorderLayout();
    public MainFrame()
    try
    jbInit();
    } catch (Exception ex)
    ex.printStackTrace();
    public static void main(String[] args)
    MainFrame mainFrame = new MainFrame();
    private void jbInit() throws Exception
         //jbInit() defined here
    public void paintComponent(Graphics g)
    // jPanel1.getGraphics().drawImage(image,0,0,jPanel1);
    Graphics2D g2D = (Graphics2D) g;
    BufferedImage bi = (BufferedImage) createImage(getWidth(),getHeight());
    bi.createGraphics().drawImage(image, 0,0, jPanel1);
    // g.drawImage(image,0,0,jPanel1);
    public void jButton2_mouseClicked(MouseEvent e)
         public void jButton1_mouseClicked(MouseEvent e)
    this.dispose();
    System.exit( 0 );
    /////////////////////////////////////////////////////////////////////////////

    this works OK
    (stripped of everything unrelated to your question)
    import javax.swing.*;
    import java.awt.*;
    class MainFrame extends JFrame
      Image image = Toolkit.getDefaultToolkit().createImage("test.gif");
      public static void main(String[] args)
        MainFrame mainFrame = new MainFrame();
        mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        mainFrame.setSize(200,200);
        mainFrame.setVisible(true);
      public void paint(Graphics g)//<-----heavyweight component
        super.paint(g);
        g.drawImage(image,50,50,this);
    }

  • Some sites do not display images, eg ebay and link from Trek bike

    the images on ebay will not load when selecting an item. Trek bike"dream giveaway contest" sit does not display "game" image. Just installed new Hard drive Mac OD 10.4.1
    == URL of affected sites ==
    http://

    See [[Images or animations do not show]] and http://kb.mozillazine.org/Images_or_animations_do_not_load

Maybe you are looking for

  • Exchange 2010 Autodiscovery & Outlook Anywhere kind of but really not working

    This is driving me nuts. We have a single Exchange Server 2010 running (everything is on one box). It works fine internally (all Outlook clients can see and grab the login info from the user login). OWA works from outside, mail delivers nicely. My pr

  • Portal is not displayed correctly

    Hi, I had Browser Lab and Firebug installed and tried to capture the screen on a web page from intranet. The page consisted of 3 x 2 portals, 3 rows and 2 columns. On the result displayed, the portals were displayed sequentially row by row. Kindly ad

  • Laptop frozen

    I was able to use my laptop last night and shut down, then when i tried to turn it on the next day it gets stuck with the hp logo on the screen and seems like it is trying to load/open but remains stuck that way. It will do that for a few seconds the

  • I'm getting this error. what is the fix??

    I'm getting this error when trying to use the email setup on Verizon.  it keeps crashing?  please advise.

  • Mitigation controls - mitigating reports

    Hi all, I have a question regarding the frequency field in Reports tab of mitigating controls (RAR). What is the purpose of the frequency field. If you set this to 1, does that mean that the control is to be executed daily? Does the system send a mai