|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with a panel
I'm trying to create a panel in which I can load a picture and then be able to draw some lines over it I need to be able to zoom in and out and obviously have vertical and horizontal scroll bars... My main problem is that I don't know how to draw the image onto my panel....Other than that I have already been able to draw a lines onto a different panel I just really need help loading the image onto the panel I have no clue how to do this I've been trying to do this for 2 days and I'm stuck fast this is the last part I need to finish but I can't do it...
|
|
#2
|
|||
|
|||
|
Have a look at the java ImageIcon class documentation. Then, you would create a new ImgeIcon object by using the code below:
Code:
ImageIcon myImage = new ImageIcon("myPicture.jpeg");
and then just add the image to the panel like you would add any other object: Code:
panel.add(myImage); |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > Help with a panel |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|