We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi All, I have a GUI where I want to display some information from MySQL database. I am able to display text on GTextArea from database. But I need to displaying flag of country on GLabel or GTextArea from same database. could anyone help me.
Thanks to all
Answers
So is your question: "How do I display an image on a GLabel or GTextArea?" ... and does this have anything to do with a database? Are you able to display an image that you didn't load from a database on a GLabel or GTextArea? If so, is your question "how do I get an image from a database?"
It would be much easier to understand your problem if you provided a short code example -- for example, are you using the bezier mysql library?
It is not possible to display an image inside a GTextArea control.
The GLabel control can display either text or an image or both together. There is an example sketch that comes with the library that demonstrates text/icon controls. Also this reference page shows the main methods for load and aligning text and images inside a GLabel control.
I have copied your message here because it is a continuation of the problem described here and any information I provide might help others.
Hi quark, Thank you for your response. I have try to load image from database (MySQL) into a GLabel. But it is not working. Could you help me ? I have attached my code here. Text is loading into GTextArea but image is not loading into GLabel.
Thank you
Unfortunately you don't say what if any error message you got! (Bit like going to the doctors and asking for a diagnosis without telling him the symptoms :-/ )
Having said that the most likely problem is that the getBlob() method does not return a PImage object.
resultSet.getBlob("country_flag") // Does not return a PImage
So you need to covert the binary data returned by getBlob into a PImage first.
Hello. I don't know much about blobs, but you have to copy the image information in a file and then read it with an input stream. There are a lot of examples if you search the internet by something as "java mysql displaying blobs in labels". If you want I can search an apropiated example.