Zolf
asked on
resize image
hello there,
I get my image into a Jframe from the database which workes fine.but now my problem is the images are of different sizes.how can i adjust the JFrame according the image.
public static void main(String[]args)
{
Frame frame = new DBImage();
Toolkit toolkit = Toolkit.getDefaultToolkit(
Dimension scrnsize = toolkit.getScreenSize();
//frame.setSize( (int) scrnsize.getWidth(),(int)s
frame.setSize(700,100);
frame.show();
}
cheers
zolf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try
Dimension size = frame.getSize();
int width = size.width;
int height = size.height;
frame.setSize(new Dimension(width, height));
Dimension size = frame.getSize();
int width = size.width;
int height = size.height;
frame.setSize(new Dimension(width, height));
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> frame.setSize(new Dimension(width, height));
and this should be different, set to the frame you want, otherwise you will resize the same frame :) Didn'ty wake up completely yet :)
and this should be different, set to the frame you want, otherwise you will resize the same frame :) Didn'ty wake up completely yet :)
SOrry! My first answer has a silly error. Of course i meant
Change
frame.setSize(............ .......... .......... ......);
to
frame.pack();
Change
frame.setSize(............
to
frame.pack();
:-)
frame.show();
to
frame.pack();