drawing an image

Who can help me!

I have make an applet with pictures. Now I will make it so that when I clicked on a picture it must be bigger in a new frame.

What I do the picture comes not in the new frame.

I have make under the mouseClicked the rules,

JFrame f = new JFrame();

f.setBounds(0, 0, 300, 400);

f.setTitle("Frame 2");

But what do I write to come a picture into the f.?

Help, help!

[433 byte] By [harriea] at [2007-10-2 21:10:08]
# 1
Addyourframe.add( new ImageIcon("yourpicture") );Stay blessed, ICE
icewalker2ga at 2007-7-13 23:56:06 > top of Java-index,Desktop,Core GUI APIs...
# 2
Its works not.Can you tell me, what I must weitten so the picture comes into the new frame?
harriea at 2007-7-13 23:56:06 > top of Java-index,Desktop,Core GUI APIs...
# 3

Instead of using a JFrame, try using a JDialog. Something like this will work, though you will most likely want to create your own dialog that extends JDialog:

// create the dialog

JDialog d = new JDialog();

// set the layout for the dialog content pane

d.getContentPane().setLayout(new BorderLayout());

// create the image to be displayed from a relative directory to this class

Icon image = new ImageIcon(MyApplication.class.getResource("images/myPicture.gif"));

// create a label (you need a component to add)

JLabel label = new JLabel();

// set the image onto the label

label.setIcon(image);

// add the label to the CENTER of the content pane in the dialog

d.getContentPane().add(label, BorderLayout.CENTER);

// pack and show

d.pack();

d.setVisible(true);

gil_ea at 2007-7-13 23:56:06 > top of Java-index,Desktop,Core GUI APIs...
# 4
An ImageIcon is not a Component and therefore cannot be added. You need to place the Icon onto a Component, such as a JLabel.
gil_ea at 2007-7-13 23:56:06 > top of Java-index,Desktop,Core GUI APIs...
# 5
May BAD Big Time!!! Must have been sleeping when I made this post. Third post should give the op more insight. Sorry if any were misled.> Add> yourframe.add( new ImageIcon("yourpicture")> );
icewalker2ga at 2007-7-13 23:56:06 > top of Java-index,Desktop,Core GUI APIs...
# 6
Gil_e, I have tried it, but its works not. What I do, how I do it.Help me and can you give the hole code so I can see that its works?My English is not so good, but I try.
harriea at 2007-7-13 23:56:06 > top of Java-index,Desktop,Core GUI APIs...
# 7
Please con onebody help me.In an applet I will draw a picture but in a second frame, so the picture is than bigger. I do have fond it.
harriea at 2007-7-13 23:56:06 > top of Java-index,Desktop,Core GUI APIs...
# 8
Can somebody help me?I want loaded a photo in a new JFrame on an applet. When I ckicked which the mouse on a photo than the new frame be bigger.
harriea at 2007-7-13 23:56:06 > top of Java-index,Desktop,Core GUI APIs...