Results 1 to 2 of 2

Thread: initilizing ImageIcon

Hybrid View

  1. #1

    Default initilizing ImageIcon

    hi guyz,

    at the moment, in my application i am creating icons with the following code

    Icon icon = new ImageIcon(getClass().getResource("icon.png"));

    these images are kept in the classpath. How can i create them through spring IOC.

    plz help.

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,853

    Default

    You can do the following:

    Code:
    <bean id="icon" class="javax.swing.ImageIcon">
      <constructor-arg type="java.net.URL" value="classpath:/path/to/icon.png"/>
    </bean>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •