Problem displaying the image

I am having a trouble with display an image. My image is put in the base directory of my workspace and my IDE is Eclipse. However, I just can't get the image to display...
It is at the bottom of the code...
package ca.carleton.comp3004.client.ui;
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import javax.imageio.*;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import ca.carleton.comp3004.client.model.Model;
import ca.carleton.comp3004.util.AppUtils;
import ca.carleton.comp3004.util.UiUtils;
public class GamePanel extends JPanel
     private JPanel bottomStuff;
     private JScrollPane cardPane;
     private JButton requestCards;
     private JPanel centerStuff;
     private JPanel[] playerStuff;
     private JLabel[] playerName;
     private JLabel[] playerNumCards;
     private JLabel[] playerScore;
     private JPanel topStuff;
     private JLabel unoCode;
     private JLabel timeLabel;
     private JButton leave;
     private Image board = null;
     //Icon BoardImage = new ImageIcon("C:\Users\tzaid\Desktop\steve stuff\Johnny_Workspace\GameBoard.png");
     //private ActionListener buttonlistener;
     private Model model;
     private class CardRequestListener implements ActionListener {
        public void actionPerformed(ActionEvent theEvent) {
              AppUtils.invoke(new Runnable()
                 public void run()
                      model.requestCards();
     private class CardButtontListener implements ActionListener {
        public void actionPerformed(ActionEvent theEvent) {
             final int cardIndex = Integer.parseInt(theEvent.getActionCommand());
             AppUtils.invoke(new Runnable()
                public void run()
                     model.playCard(cardIndex); //****note: extract cardNum
     private class LeaveListener implements ActionListener {
        public void actionPerformed(ActionEvent theEvent) {
             AppUtils.invoke(new Runnable()
                public void run()
                     model.leave(); //****note: not in protocol yet
     // actions
     CardRequestListener myCardRequestListener = new CardRequestListener();
     CardButtontListener myCardButtonListener = new CardButtontListener();
     LeaveListener myLeaveListener = new LeaveListener();
    public GamePanel(Model model)
         this.model = model;
         createComponents(this);
     * Creates the components.
    private void createComponents(JPanel container)
         container.setLayout(new BorderLayout());
        // chat panel
        CreatePanels();
        container.add(centerStuff, BorderLayout.CENTER);
        container.add(bottomStuff, BorderLayout.SOUTH);
        container.add(topStuff, BorderLayout.NORTH);
      //  Graphics g = new Graphics();
      //  g.drawImage(board, 0, 0, null);
     * Creates the chat panel for chat room functionality.
     * @return A panel containing chat room controls.
     * @see JPanel
    private void CreatePanels()
         topStuff = new JPanel();
         unoCode = new JLabel("UNO Code: ");
         timeLabel = new JLabel("Time: ");
         leave = new JButton("Leave Game");
         leave.addActionListener(myLeaveListener);
         topStuff.setLayout(new BorderLayout());
         topStuff.add(unoCode, BorderLayout.WEST);
         topStuff.add(timeLabel, BorderLayout.EAST);
         topStuff.add(leave, BorderLayout.NORTH);
         topStuff.setBorder(BorderFactory.createLineBorder(Color.black));
         //******note: need to specify size*****
         int size = 5;
         centerStuff = new JPanel();
         playerStuff = new JPanel[size];
         playerName = new JLabel[size];
         playerNumCards = new JLabel[size];
         playerScore = new JLabel[size];
         centerStuff.setLayout(new FlowLayout(FlowLayout.CENTER, 40, 40));  //need to change later so is around table
         for(int i = 0; i<size; i++){
              playerStuff[i] = new JPanel();
              playerStuff.setLayout(new BorderLayout());
          playerName[i] = new JLabel("no name" ); //****get player name here
          playerNumCards[i] = new JLabel("0");
          playerScore[i] = new JLabel("0");
          playerStuff[i].add(playerName[i], BorderLayout.NORTH);
          playerStuff[i].add(playerNumCards[i], BorderLayout.CENTER);
          playerStuff[i].add(playerScore[i], BorderLayout.SOUTH);
          playerStuff[i].setBorder(BorderFactory.createLineBorder(Color.black));
          centerStuff.add(playerStuff[i]);
     bottomStuff = new JPanel();
     cardPane = new JScrollPane();
     requestCards = new JButton("Request Cards");
     requestCards.addActionListener(myCardRequestListener);
     bottomStuff.setLayout(new BorderLayout());
     bottomStuff.add(requestCards, BorderLayout.WEST);
     bottomStuff.add(cardPane, BorderLayout.CENTER);
     bottomStuff.setBorder(BorderFactory.createLineBorder(Color.black));
public GamePanel()
     setPreferredSize(new Dimension(790,572));
     setMaximumSize(getPreferredSize());
     setMinimumSize(getPreferredSize());
     setSize(getPreferredSize());
     try
board= ImageIO.read(new File("GameBoard.png"));
getGraphics().drawImage(board, 0, 0, null);
     catch (IOException e)
     e.printStackTrace();
/* private JPanel createMessageListPanel()
JPanel messageListPanel = new JPanel(new BorderLayout());
JScrollPane scrollPane = new JScrollPane(messageList = createMessageList(),
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setAutoscrolls(true);
messageListPanel.add(scrollPane);
messageListPanel.setBorder(new TitledBorder("Messages"));
return messageListPanel;
* Creates message list.
* @return A text area to store messages in.

Look like a bad video card. Are you eligible for Apple's Repair extension programs?

Similar Messages

  • Problem Displaying an Image in a JScrollPane

    Hi All,
    I've placed a Toolbar at the bottom of a JFrame and above the toolbar I placed a JTabbedPane. In one of the tabs I want to display a full sized image.The size of the image that I want to display using a scroll pane is 595x842 pixels. Now the problem is that when I display the image in the scroll pane the bottom toolbar is overlapped with the scrollpane. I don't want to resize the image as it is spoiling the image quality.I used the below code
    JPanel imagepagepanel=new JPanel()
        protected void paintComponent(Graphics g)
              js=new JScrollPane();
              Point p = js.getViewport().getViewPosition();
              g.drawImage(demoicon.getImage(), p.x, p.y, null);
    mytabbedpane.addTab("View Image",js); //add the scrollpane to the tabI even tried using a label to display the image in the tabbedpane and I've got the same overlapping problem.
    I am able to embed the default browser in my application using JDIC API and the image display is fine in the browser without overlapping the bottom toolbar. But I don't want to use a web browser to display the image.
    It would be of great help if anyone could suggest a solution to the overlapping problem. I want the scroll pane to work similar to a web browser while displaying a large sized image.
    Thanks in advance.

    Override the paintComponent method to just draw the
    image at 0, 0, w, h.
    The rest is not needed, to say the least.Here's an easier way
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import java.awt.*;
    import java.io.File;
    import java.io.IOException;
    public class ImageInTabbedScrollTest extends JFrame {
        public ImageInTabbedScrollTest() {
            buildGUI();
        private void buildGUI() {
            JPanel mainPanel = (JPanel) getContentPane();
            mainPanel.setLayout(new BorderLayout());
            JTabbedPane tabbedPane = new JTabbedPane();
            try {
                Image image = ImageIO.read(new File("images/terrain.jpg"));
                ImageIcon icon = new ImageIcon(image);
                JLabel label = new JLabel(icon);
                JPanel panel = new JPanel(new GridLayout(0,1,5,5));
                panel.add(label);
                JScrollPane jsp = new JScrollPane(panel);
                tabbedPane.addTab("Image",jsp);
                JPanel anotherPanel = new JPanel();
                JLabel label2 = new JLabel("Second Panel");
                anotherPanel.add(label2);
                 label2.setFont(new Font("San Serif",Font.BOLD, 40));
                tabbedPane.add("Label",anotherPanel);
                mainPanel.add(tabbedPane, BorderLayout.CENTER);
                JToolBar tBar = new JToolBar();
                tBar.add(new Button("OK"));
                tBar.add(new Button("Maybe"));
                tBar.add(new Button("No"));
                mainPanel.add(tBar, BorderLayout.SOUTH);
                  } catch (IOException e) {
                e.printStackTrace();
        public static void main(String[] args) {
            Runnable runnable = new Runnable() {
                public void run() {
                    ImageInTabbedScrollTest testFrame = new ImageInTabbedScrollTest();
                    testFrame.setSize(new Dimension(600,600));
                    testFrame.setLocationRelativeTo(null);
                    testFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
                    testFrame.setVisible(true);
            SwingUtilities.invokeLater(runnable);
    }

  • How to display the image which in KM folder using url iview

    Hi Friends
    How to display the image, which is under KM folder structur using the url iview.
    i trying using url iview url as  \document\testfolder\abc.jpg as url for the iview.
    but its now working .. so please help me how to slove this problem
    If is not the correct way then please suggest me best way to achive this.
    Thanks
    Mukesh

    Hi Mukesh,
    I think this may work,
    1, Create a HTML Layout.
        You can put your image wherever  u want with HTML Codes.
        Check this, [Article|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3915a890-0201-0010-4981-ad7b18146f81] & [Help|http://help.sap.com/saphelp_nw04/helpdata/en/cc/00c93e9b2c3d67e10000000a114084/frameset.htm]
        With this, u can use the standard KM commands also.
    2, U need to use KM Navigation iView for this rather than KM Doc iView.
    3, In the Nav iView, u can use &rndLayoutSet=nameOfUrHTMLLayout to force the view with this new layout.
    Regards
    BP

  • I want to display the image with the help of servlet by specifying the url

    hi all,
    I am getting the Image from the Server to the Servlet (when i am using the physicalAddress ie c:/programfiles/......)it was getting the image but at the same time it was not displaying the image when i am using the URL address(ie http://localhost:8080/....)it was not displaying the image.
    I don't know what the problem is...what is the problem?
    can anybody give me the suggestion for fixing that.
    thanks in advance
    lakshman

    Hi,
    Invoice you will have the Purchase Order no. Display the purchase order through ME23N and at the item details you can find the GRN No. Or double click on the purchasing doc no. system will display the PO.
    Thanks
    VK

  • Windows could not display the images available for installation

    I am trying to perform unattended installation of windows which I created with Windows AIK. When I add answer file on USB's with windows installation root I get "windows could not display..." message. Problem is there even when there are just a
    few simple lines (oobe, microsoft international core-WinPe).
    I replaced install.wim file of standard windows installation iso with customized install.wim and then created catalog file with windows system image manager.
    Kind people of world, please help!

    Hi bugili,
    Could you help us post the complete error information, it will more helpful when we locate the issue. I am not quite understand “add answer file on USB's with windows
    installation root”, do you mean the answer file and install file on the external device? Please try to confirm this image has the same Security permission with
     others image in WDS image share folder,  the WDS default image location is like
    x:\RemoteInstall\Images.
    If it not work please post the WDS error log,
    How to enable logging in Windows Deployment Services (WDS) in Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, and in Windows Server 2012
    http://support.microsoft.com/kb/936625/en-us
    The simlar thread:
    Windows could not display the images available for installation.
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/07fe03dd-9798-4583-8d0b-dc963c95434c/windows-could-not-display-the-images-available-for-installation?forum=winserversetupMore
    information:
    How to Add a Boot Image to WDS Server
    https://social.technet.microsoft.com/wiki/contents/articles/11643.how-to-add-a-boot-image-to-wds-server.aspx
    I’m glad to be of help to you!
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • I've just bought a Macbook Pro 15" and I'm trying to use Photoshop, but the resolution its displaying the images at for 100% are too small. I have to design for the web, so need to be intricate with detail, but I'm finding it adjusts the resolution of the

    I've just bought a Macbook Pro 15" and I'm trying to use Photoshop, but the resolution its displaying the images at for 100% are too small. I have to design for the web, so need to be intricate with detail, but I'm finding it adjusts the resolution of the image right down. (I mean you can see the image clearly, but it's too small to edit). When I look at Safari and see a web page at 100% it's clear, but the same page displayed in Photoshop CC appears 50% of the size (even though it says it's 100%)   If I move the application window to another screen it adjusts it correctly  – leaving all the pallettes, menus and tools correctly sized as they are on the retina display   Is there some way to adjust the way Photoshop CC displays images so it is more consistent with what you actually see?   There doesn't seem to be any answer on the Adobe forum, so hopefully someone here can shed some light.  MacBook Pro with Retina display, 15", OS X Yosemite (10.10.2), Photoshop CC 2014

    I tested both ways. With "open in low resolution" ckecked the size of the images is cool, but it is low-resolution including Photoshop appearance.
    If "open in low resolution" is unckecked the appearance is good but the very small size.
    See the image below. It has 650 x 732 px, 72 dpi. The font of the text "Neste aniversário ..." is with 18pt.

  • Problems displaying an image on Adobe Reader 8.1.2

    Hi guys,
    We are trying to display a JPG image in an InteractiveForm. So, we set an Image (StaticImage) to be loaded using the following Formcalc script on Page Initialize event:
    StaticImage1.value.image.href = $record.ImageURL
    On our last project, we could display a JPG image with Adobe Reader 6 (with some alert messages), 7 and 8 (7 and 8 fully functional). But in this one, the same solution doesn't work. The unique difference between both solutions is the URL format. Last project displays an image based on a normal URL ("http://app.client.com/photo/1234.jpg"), and in the current project we create a PNG or JPG image based on a JFreeChart, generating an URL to access it ("http://server1:54321/webdynpro/resources/vendor.com/..(long)../graph43211234.jpg").
    When we load it using a computer with Adobe Reader 7.0.x installed, the bellow message is displayed requesting an action:
    "Acrobat is attempting to connect to the site:
    http://server1:54321/webdynpro/resources/vendor.com/..(long)../graph43211234.jpg
    If you trust the site click "Allow", otherwise click "Block".
    Possible actions: Block, Allow and a check "Remember my action for the site: server1"
    Allowing the connection, the images are displayed. But, in a machine with Adobe Reader 8.1.2 installed, sometimes it asks for permission to access the URL, sometimes not. And, in both cases, in this version it doesn't display the images...
    Can anyone shed any light on this? Also, is there a way to block this annoying message?
    Regards,
    Douglas Frankenberger
    P.S.:
    1 - The Image is not marked as Embedded. This option don't seems to make any difference, as on our last project the StaticImage was not flaged as Embed, but the JPG file was embeded in the PDF anyway...
    2 - Interactive Form display type: native. Mode: updateDataInPDF
    3 - In current project, when we set the same image the we had set on the old project, it loads successfully. Also, the generated JFreeChart image is fully accessible when displayed directly in IE using its URL.
    4 - Versions:
      - Client: Windows XP Professional
      - NWDS 7.0.10
      - Adobe Livecycle 7.0.50519.0
      - Adobe Reader: 7.0.8, 7.0.9 and 8.1.2

    Hi Amita.
    We already tried it (checked / unchecked), but it seems to make no difference. There is a strange behavion on this:
    - When I set it checked, on a computer disconnected from the web and running Adobe Reader 7.0.9, it asks for permission to access a resource (as I said before). In this case, even disconnected, it shows up my image independent of allowing/blocking the access to the external resource. In other words, it is embedded (I think...), but continues asking for access anyway.
    - The same scenery above, but using Adobe Reader 8.1.2 instead of 7.0.9.... sometimes it asks for permission, sometimes not. But in both cases, it doesn't display the images...
    Regards,
    Douglas Frankenberger

  • How to display the Image in PDF report by using iText Report

    Hi
    Im trying to display the image which is very big one.
    This is my code
    Document document=new Document();
    PdfWriter.getInstance(document,new FileOutputStream("imagePDF.pdf"));
    document.open();
    Image image = Image.getInstance ("1.bmp");
    document.add(new Paragraph("Images in PDF"));
    document.add(image);
    document.close();
    But the image "1.bmp" is displayed partially. Its not spanning to the next page.
    Can anyone help me to solve this one?
    Thanks in Advance
    dhilip

    Do you actually want the image to span multiple pages? I am not sure that will be possible without splitting the image; the itext mailing list would be the place to ask.
    You could make the the page size big enough for the image using Document.setPageSize()

  • Display the images in excel using jsp

    Hi
    I am unable to display the images in excel using jsp. I can display the data. but cannot display the images. It is simply showing the icon without the image. Is there any way to display the images. Pls give some sample code to display the images in excel.
    Thanks in advance.

    Presumably whoever created the images in that Excel document just put links to somewhere on their hard drive. Those links don't mean anything when you put the document on somebody else's computer, which is what you are doing. At least, that is my guess.
    You could spend some time looking at the Excel file to see how the images were put in there. Or you could ask the person who put the images in there.

  • Displaying the image stored in Blob column

    Hi all,
    I'm trying to print the report with an image. I've stored the image in a Blob column and the format of the image is Jpg.
    I'm using the Reports 10g(10.1.2.0.2). When I'm trying to print the report, I'm getting an error Rep-62203. I want to know whether there are any settings which i need to set to display the image item. I mean to say that are there any registry settings.
    Regards,
    Alok Dubey
    Edited by: Alok Dubey on Dec 1, 2008 12:55 PM

    Hi all,
    I'm trying to print the report with an image. I've stored the image in a Blob column and the format of the image is Jpg.
    I'm using the Reports 10g(10.1.2.0.2). When I'm trying to print the report, I'm getting an error Rep-62203. I want to know whether there are any settings which i need to set to display the image item. I mean to say that are there any registry settings.
    Regards,
    Alok Dubey
    Edited by: Alok Dubey on Dec 1, 2008 12:55 PM

  • For the last 2 days whenever I try to upload photos from my iPhoto page to facebook I get an error message: Bad Image There was a problem with the image file.  I haven't knowingly changed any settings on iPhoto or facebook. Can anyone help, please ?

    I need help with uploading photos from iPhoto to facebook. I could do it till 2 days ago. Now any new photo I try to upload gives me an error message:
    Bad Image
    There was a problem with the image file. 
    Please help.

    Can you drag it to the Desktop?

  • Displaying the images in Page 0

    I have uploaded an image wich is attached to a specific application. Now in the Page 0 of that application, I created an HTML region to display the image by specifying the region source as <img src=#IMAGE_PREFIX#dissertation.JPG/>. The application has separate image as logo.
    But when executing, the image is not displaying.
    Deb

    Hi Deb,
    Try either #APP_IMAGES# or #WORKSPACE_IMAGES# instead of #IMAGE_PREFIX# (which is used for images in the /i/ folder on the server). Also note that the filename is case-sensitive.
    Andy

  • Not able to display the image on the popup.

    hi,
    my requirement is: i have command link on the form.which on clicked should display a popup and with in that popup a image should be shown. I have stored that image in the form of byte array.
    On clicking the link i am able to show the popup.But,not able to display the image on the popup.
    thanks in advance.
    Srikanth.V

    Hi,
    how do you access the image? Put yourself in our shoes and look at your question and then add the missing information. E.g. does the image show if loaded on a page itself and not a popup ?
    Frank

  • Trying to Display the image

    Hi Steve/anyone
    I am trying to display the image upload and Display using the "Oracle Fusion Developer Guide" page 404 Working with Oracle Multimedia Types by Frank Nimphius and Lynn Munsinger. I tried to replicate the solution in a sample app. My upload works as said. But when i try to browse I dont see the image and i get the following error in the background. Please help. All the steps mentioned have been done
    ! Edit Images.jspx
    <af:inputFile value="#{bindings.Image.inputValue}" simple="true"
    id="if1">
    <binding:convertOrdDomain bindingRef="#{bindings.Image}"/>
    </af:inputFile>
    2 Browse Images.jspx
    <af:panelLabelAndMessage label="#{bindings.Image.hints.label}"
    id="plam1">
    <af:media contentType="#{bindings.Image.inputValue.media.mimeType}"
    source="#{bindings.Image.inputValue.source}" id="m2"/>
    </af:panelLabelAndMessage>
    <af:outputText value="#{bindings.Image.inputValue.media.width}" id="ot3"/>
    java.lang.NullPointerException
         at oracle.ord.html.OrdPlayMediaServlet.renderContent(OrdPlayMediaServlet.java:386)
         at oracle.ord.html.OrdPlayMediaServlet.deliver(OrdPlayMediaServlet.java:264)
         at oracle.ord.html.OrdPlayMediaServlet.doGet(OrdPlayMediaServlet.java:205)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFil

    Error showing images using Servlet OrdPlayMediaServlet

  • How can i call this file path into my bsp-html  to display the images?

    Hi
    I have a file path for an image like c:/test_logo.bmp.
    How can i call this file path into my bsp-html  to display the images?
    moosa

    Try this...
    Can i have  sample code in BSP-HTML to display images?

Maybe you are looking for

  • ASU-process POST Upgrade Step on SQL database

    Hi All, To check this message in the right format kindly click on reply first then click on quote original icon (""). I am performing an upgrade from R/3 4.7 to ERP 6.0 SR3, while doing upgrade sapup asking me To perform the manual application specif

  • Infinity and wireless router issues

    Hi Folks, Thanks for taking the time to read this, if anyone has any similar issues or resolutions to the situation feel free to chip in.. We had Infinity installed a while back and noticed some intermittent connection problems, the issue was that wi

  • After sp1- R2 upgrade, Clients cannot open Software center

    Hi I am in a bit of a bind..  We upgraded from SP1 to R2 (not CU2 just the r2 for starters) All went well and all clients in our organization have been upgraded.  Unfortunately I've discovered that the software center on the clients can no longer loa

  • Adobe Illustrator CS6 Update (version 16.0.3) Installation failed. Error Code: U44M1P7

    ARRRRRGGGGHHH!!! I can't update Illustrator CS6 to 16.0.3, I have this error code: U44M1P7 and now I can't run current version (16.0.2)! OSX 10.8.2

  • Host Computer won't show on MBA Remote Disc

    I need to install iWork on to my MBA and I'm trying to use the DVD sharing option... On my host computer (an imac) I have opened the system preferences>sharing and clicked the DVD or CD sharing box, as well as the Ask me before allowing other to use