How to add a Graphic image to an Jbutton other than the Icon image......or is there any way to make Jbutton graphical like putting textures on it...????
Printable View
How to add a Graphic image to an Jbutton other than the Icon image......or is there any way to make Jbutton graphical like putting textures on it...????
What do you mean "other than the icon image"? What have you tried?
button=new JButton(new IconImage(*.*));
i have tried this code....but this code place a very small size pic on the JButton.
but i want JButton to look more graphical like putting some texture graphics on it.
I recommend you give this a read: How to Use Buttons, Check Boxes, and Radio Buttons (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
Then create an SSCCE that demonstrates exactly what you're trying, as well as maybe a mock-up of what your goal is.
Solved...
:(y):
thanx so much for the help....
as i posted earlier that i want to put some texture on the JButton...
but if i put some texture on Jbutton using "button=new JButton(new IconImage(*.*));"
it hides the Caption on jbutton...
but by using "button.setHorizontalTextPosition(AbstractButton.C ENTER);"
it will center the caption on Jbutton.
now i can put any texture or any graphical image on JButton without hiding the caption.