Hi there,

I believe that a lot of new comers found it hard to use images in JAVA, especially who came from .Net world. So I decided to simplify things out by providing this simple tool.

I call it imageBox to make it sound like VB Picture box. this imageBox is a hacked version of JPanel.

All what I did, is just overriding paint (Graphics g), after that I force it to load the Image file and draw it on the component itself.

ImageBox is a very useful tool; you may add it to netbeans palette. This allows you to change images from design level from imageFile property. note: in current version, just container will be shown, and image will not shown at design time.

to assign the image file you may need to use URL for the path, or a string:

getClass ().getResource (“/imgFolder/imgFile.jpg”)

or

“/imgFolder/imgFile.jpg”

note: it is better to include image files with the project source, you could group them in folder called “img”.

steps to add imagebox into netbeans project:

  1. create a new project with JFrame
  2. add imagebox.java to your project
  3. build your project
  4. drag imagebox.java on JFrame, it will show a box with “X”
  5. go properties -> imageFile, set file path as mentioned above.

Feel free to contact me for any help.

download: imagebox(0.0.6)

download: imagebox(0.0.5)

download: imagebox(0.0.3)example


Related Posts

  1. java imageBox (0.0.6)
  2. my batch Image Converter using java imageIO
  3. convert images using java imageIO
  4. playing music using java audioClip
  5. Web page invoker using java
Print This Post