Results 1 to 8 of 8
- 06-28-2012, 06:34 PM #1
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
- 06-28-2012, 06:45 PM #2
Re: how to add an graphic or an image to a Jbutton?
What do you mean "other than the icon image"? What have you tried?
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 07-02-2012, 04:41 PM #3
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
Re: how to add an graphic or an image to a Jbutton?
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.dk
- 07-02-2012, 04:49 PM #4
Re: how to add an graphic or an image to a Jbutton?
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.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 07-02-2012, 05:12 PM #5
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
Re: how to add an graphic or an image to a Jbutton?
Solved...
.gif)
thanx so much for the help....dk
- 07-02-2012, 07:14 PM #6
Re: how to add an graphic or an image to a Jbutton?
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 07-03-2012, 03:45 AM #7
- 07-03-2012, 10:45 AM #8
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
Re: how to add an graphic or an image to a Jbutton?
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.dk
Similar Threads
-
JButton States Set to Pictures From Image Editor
By wired-in=p in forum New To JavaReplies: 10Last Post: 08-21-2011, 04:33 AM -
Changing Image Icon of a JButton at run time, NOT state dependent
By jjlin12 in forum New To JavaReplies: 7Last Post: 07-12-2011, 04:19 PM -
image on a JButton...how??
By Habib in forum AWT / SwingReplies: 2Last Post: 02-27-2011, 06:56 PM -
changing JButton image upon clicking
By Logical in forum AWT / SwingReplies: 2Last Post: 12-21-2010, 02:53 AM -
adding Image to JButton
By mayhewj7 in forum New To JavaReplies: 3Last Post: 03-31-2009, 03:39 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks