facebook

Adding an ImageIcon to a component

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #285780 Reply

    DougMH
    Participant

    This may be a feature to some. Right now I see it as a bug. Maybe you can explain your methodology on this and I’ll understand it.

    I work on my program at work and at home. Unfortunately in the one case, it’s

    c:/documents and settings/Administrator/workspace/…

    and the other it’s

    c:/documents and settings/hurstd/workspace/…

    When I use the properties to set the icon for a component (JButton in this case), I’m given the choice of using an image within the project or an external image. I usually put all my images in an /images directory within MY project. When I use the MyEclipse dialog to set this image, it puts the fully qualified pathname with the word file: or URL: in front of it. It writes this to the GEN GEN-END area where I’m not supposed to alter it. So, when I take the project home, all that goes away because it can’t find the images (because of the Administrator/hurstd situation I mentioned earlier.

    It seems to me you would put a radio group with both a URL and File button, leave out the file: and/or url: and just allow the user to insert his own path if he desired?

    Again, you may have a perfectly good reason for doing it the way you’ve done and I will await your explanation.

    What I did was remove all the icons (from properties), then inserted them manually with my initializations.

    printBtn.setIcon(new ImageIcon(“images/printer.gif”));
    speedTrendsBtn.setIcon(new ImageIcon(“images/workouts.gif”));
    scratchesBtn.setIcon(new ImageIcon(“images/scratches.gif”));
    .
    .
    .

    It’s my intention to allow my users to run the program from the internet. Would it be better to point them back to the web site for images or download them with the program?

    #285816

    Loyal Water
    Member

    We do support relative path for images.

    What version of Matisse are you working with? Can you give me some information about your project layout as well.

    #285819

    DougMH
    Participant

    I’m using 6.5M1. It’s just a frame with a bunch of JButtons. After clicking on a button to see its properties, then clicking on the … button for icon and selecting External Image, I could edit and did put in

    images/<filename>

    But when I clicked ok the icon field of the properties was empty.

    I see now that I should have selected “Custom Code” from the drop down box of the dialog, then do just when I stated above

    new ImageIcon(“images/printer.gif”)

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Adding an ImageIcon to a component

You must be logged in to post in the forum log in