hi.. i'm doing my final year project using java eclipse and sqlite as database. the problem is i cannot retrived image from database (blob) and displayed in my GUI. please help me.
when i click the song title in the JTable, only png. appear instead of image.
Quite often people try to do too many things at one time. You are trying to add an Image to a JTextField, but no where do you have an Image. Read the Image first, then worry about adding it to something to view it.
Hadijah Mohamad wrote:i'm new with this coding. and i try so many thing. this is one of the code that i try. please help me how to convert string to blob for this case. thanks in advance!
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
sir. i want to fetch the image from JTable to set into JTextField. and the image is stored in sqlite database.
the code is one of the trial code. clear? and i cannot change the image into blob. i hope you really really help me, not judge.
Les Morgan wrote:Quite often people try to do too many things at one time. You are trying to add an Image to a JTextField, but no where do you have an Image. Read the Image first, then worry about adding it to something to view it.
That last big picture you posted looks like a JTable. It's possible to display images in JTable cells, but I don't think that's what you wanted to do so I'm not going to go into that. It isn't especially simple to do.
If I understand correctly, you want that when you select a table row, the image belonging to that row gets displayed in some other component somewhere. At least that's what one of your earlier pictures suggested. Is that correct?
If so, then I suggest you put all of your existing code aside for now and just write a small piece of code which reads a single picture from a single database row and displays it in a single component in a JFrame. That way you don't need to worry about all of the complications involved with whatever you have so far and you can more easily learn how to display images. When you have that working, then you can take your image-displaying code and work it in to your existing code with JTables and so on.
I'd also suggest not using a column of the JTable for the images if you aren't actually planning for them to appear there.