Announcement Announcement Module
Collapse
No announcement yet.
initilizing ImageIcon Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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>

    Comment

    Working...
    X