problem in handling images
I need to display image (passport size) when clicked on browse
button . I've created a JFileChoose to browse files and used the
following code to display image in JFrame . Its only the part of my
actual coding .
[code]
JFileChooser fileChooser = new JFileChooser();
int returnValue;
returnValue =
fileChooser.showOpenDialog(Design.this);
if (returnValue ==
JFileChooser.APPROVE_OPTION)
{
File file;
file = fileChooser.getSelectedFile();
String st=file.toString();
JLabel a = new JLabel();
iicon=new ImageIcon(file.getPath());
a.setIcon(iicon);
gbc.gridx=2;
gbc.gridy=0;
gbc.gridheight=3;
gbc.gridwidth=3;
gbc.insets=new Insets(10,60,20,40);
a.setPreferredSize(new Dimension(100, 100));
panel6.add(a,gbc);
}
[/code]
Now I am facing several problems .
1. I need a frame or a border around the image. The border should
always appear even if no image is selected.
2. when image appears in the assigned grid , it displaces other
elements near by it. So I need to stop that .
3. when I again browse after displaying an image then other image
appears at the back of previous image.So how can
I dispose the previous image.
4.Let there be a frame with details of students with their photo . Now
I need to save all things in database . So how should I save image .
Would saving path will be Ok or there are any other method I need to
know .
Please help.Still learning JAVA:)