Results 1 to 5 of 5
- 04-12-2012, 09:39 AM #1
Member
- Join Date
- Mar 2012
- Posts
- 18
- Rep Power
- 0
getting Image source in java question
Hi, I'm trying to make a photo gallery in java. Is it possible to get the url or the source of the image when the image is clicked?
The photos extend JButton that is why they are clickable.
If possible can someone give me a hint or an idea on how to make a photo gallery in java? The url is stored in the database. I'm already able to display up to 6 photos but I have no idea how to change the photos after clicking the page number button.
Thank you in advance.Last edited by jumpgirl; 04-12-2012 at 09:47 AM.
- 04-12-2012, 10:32 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: getting Image source in java question
Have the photos button hold the details you want.
There's no reason it couldn't hold an id referring to the relevant row in the database...or even simply hold the URL, so you don't have to go to the db to retrieve that value.Please do not ask for code as refusal often offends.
- 04-12-2012, 10:49 AM #3
Member
- Join Date
- Mar 2012
- Posts
- 18
- Rep Power
- 0
Re: getting Image source in java question
thank you for your answer.
I don't understand how to have the photos hold the details. Can you explain further?
- 04-12-2012, 11:16 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: getting Image source in java question
You said it extends JButton.
So you have already changed how the button works (otherwise why extend it).
Just add whatever data you need to that class you've created.Please do not ask for code as refusal often offends.
- 04-13-2012, 04:20 PM #5
Member
- Join Date
- Mar 2012
- Posts
- 18
- Rep Power
- 0
Re: getting Image source in java question
Thank you! it already worked.
I have another question. Since it is a photo gallery, I need to have page numbers but I don't have any idea how to change the images after clicking a certain page. Can you give me an idea on how to do it?
I stored the images in an array. Thanks in advance.
This a part of my code.
Java Code:public void placeImages(String url){ thumbs[ctr] = new CustomButton(url); if(ctr == 0){ thumbs[ctr].setBounds(30, 90,194,155); thumbs[ctr].addActionListener(clicked0); src0 = url; }.......................so on add(thumbs[ctr]);Last edited by jumpgirl; 04-14-2012 at 10:27 AM.
Similar Threads
-
getting source name of an image
By pietr0 in forum New To JavaReplies: 7Last Post: 12-10-2011, 05:49 PM -
python source to java source converter?
By conor147 in forum New To JavaReplies: 0Last Post: 01-15-2010, 05:14 AM -
MavenJava - browse source code of all open source projects online
By jirkacelak in forum Java SoftwareReplies: 1Last Post: 11-28-2008, 06:27 PM -
A newbie question: How do I take a J2ME open source and create a project
By Anona in forum CLDC and MIDPReplies: 0Last Post: 09-28-2008, 11:02 AM -
[SOLVED] Question about java.awt.image
By byuu in forum AWT / SwingReplies: 18Last Post: 05-13-2008, 04:10 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks