Hey all,
ive been searching for a long time and i want to know how am i suppose to display an image that is stored in the database(SQL) in swings in java.
i inserted the data in the database as a image datatype(i hope thats right),now the thing is i want to display it on a JPanel or a JFrame.
i was thinking of storing it in the ImageIcon and then displaying it in a label, but how do i go about it..i mean can anyone pls help me with the actual code of displaying the image
Any help is appreciated!!Thanks in advance!!
anu6189
0
Newbie Poster
Recommended Answers
Jump to PostWell you could start by this, assuming the image is in the same folder, or you can always add the path
JLabel imageLabel=new JLabel(new ImageIcon("image.*extension*")); imageLabel.setHorizontalAlignment(JLabel.CENTER);
Jump to PostI am not quite farmiliar with database programing in Java. But what does ResultSet return? If it is a path then you would need to include that path in the "image.jpg" area to get the image as in "//path/image.jpg". Otherwise if it returns something else (that I am not sure …
All 6 Replies
joshmo
8
Posting Whiz in Training
anu6189
0
Newbie Poster
anu6189
0
Newbie Poster
joshmo
8
Posting Whiz in Training
kvprajapati
1,826
Posting Genius
Team Colleague
anu6189
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.