JAVA Image Icon and JButton resizing problem
Hi everyone,
I am stuck on a JAVA problem again.
I want to figure out how to do a ImageIcon resize.
Here is my following code:
Code :
ImageIcon imageClickForMovies = new ImageIcon("clickForMovies1.GIF");
JButton buttonClickForMovies = new JButton(imageClickForMovies);
If anyone can explain to me how to resize the ImageIcon and the Jbutton, that would be great. By the way, I am a very simple-minded person. So, please explain instructions carefully, so that it is in an understandable manner for me.
- Nathe
Re: JAVA ImageIcon and JButton resizing problem -- please go easy on me. :)?
Hello Nathe,
What type of layout are you using? The different layouts will effect how you resize these components.
Here is a really good tutorial on layouts that leads onto how to size swing components and set their position:
A Visual Guide to Layout Managers (The Java™ Tutorials > Creating a GUI with JFC/Swing > Laying Out Components Within a Container)
Here is a quick method you can try first:
Code :
JButton button = new JButton ("Click me");
button.setSize(100,100);