It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Java Forum

Image not displayed

Image not displayed

Postby bakayaro89 on Sat Feb 03, 2007 6:04 pm

Any idea how come i could not open my image into the JPanel?

This is the summary of the codes

JPanel rightPanel = new JPanel();

// method to load images from FileChooser
private void loadImages()
{

int returnVal = fc.showOpenDialog(convertImage.this);
if(returnVal == JFileChooser.APPROVE_OPTION)
{
if(fc.getSelectedFile() == null)
return;
File file = fc.getSelectedFile();
URL url = null;
try
{
url = file.toURL();
}
catch(MalformedURLException mue)
{
System.out.println(mue.getMessage());
}
JLabel label = new JLabel(new ImageIcon(url));

// adding the image to right panel
rightPanel.add(label, gbc);
// cannot find this method revalidate
revalidate();
repaint();
}
}
bakayaro89
 
Posts: 2
Joined: Sat Feb 03, 2007 6:00 pm

Postby bakayaro89 on Sun Feb 04, 2007 11:59 am

http://download251.mediafire.com/jyoo1y ... ugging.zip

This is the files i have.. Compile convertImage.java .. The opened image is printed out but its not displaying on the JPanel

Please ignore my long lines of codes
bakayaro89
 
Posts: 2
Joined: Sat Feb 03, 2007 6:00 pm


Who is online

Users browsing this forum: No registered users and 0 guests