3

Hello and thank you for your time. I am new to Netbeans and I am using the Netbeans 7.1 RC1 version of Netbeans. The problem I am running into is that I seem unable to add images to the project. I am designing a web app in JavaFX 2.0 and need a jpg picture for my background. I need to know how to add this picture to the Netbeans file system to be able to call it from my program. Any help is appreciated. Thanks again

Artur G Vieira
  • 363
  • 5
  • 16

2 Answers2

4

Easiest way is to put it directly into src folder, they you would be able to refer to it from your JavaFX application by next code:

ImageView iv = new ImageView(new Image(getClass().getResourceAsStream("/image.png")));
Sergey Grinev
  • 34,078
  • 10
  • 128
  • 141
  • Sergey do you ever go to chat? I would like to chat with you for a little while, I have some questions you might be able to answer with ease. I will be on chat all day today. See ya there. – Artur G Vieira Dec 19 '11 at 18:09
0
ImageView iv = new ImageView(new Image(getClass().getResourceAsStream("/image.png")));

it is showing error Image is an abstract class not be instantiated so how we can immplement it help

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
Farhan
  • 11