Results 1 to 12 of 12
Thread: just wanna ask about images...
- 01-21-2009, 06:10 AM #1
Member
- Join Date
- Jan 2009
- Posts
- 31
- Rep Power
- 0
- 01-21-2009, 06:41 AM #2
- 01-21-2009, 07:02 AM #3
Member
- Join Date
- Jan 2009
- Posts
- 31
- Rep Power
- 0
...
Oh, sorry... just tryin to upload it on a button or a label...
something like that...
in other words, how can I upload Images or pictures into a
swing?
- 01-21-2009, 07:21 AM #4
Do you mean how to add a pic to a button/label?
USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
- 01-21-2009, 07:28 AM #5
Member
- Join Date
- Jan 2009
- Posts
- 31
- Rep Power
- 0
..
yeah! yeah! Exactly??? do you know how???
please help???:confused:
- 01-21-2009, 07:31 AM #6
not sure about jpg, why don't u just convert it to gif.
Java Code:JButton jbtOK = new JButton("OK"); jbtOk.setIcon(new ImageIcon("ok.gif")); jbtOk.setPressedIcon(new ImageIcon("pressed.gif")); jbtOk.setRolloverIcon(new ImageIcon("rollover.gif"));Last edited by angryboy; 01-21-2009 at 07:34 AM.
USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
- 01-21-2009, 07:40 AM #7
oh wait wait, i remember. it does work. same thing as gif.
Java Code:jbtOk.setIcon(new ImageIcon("ok.jpg"));USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
- 01-21-2009, 10:31 AM #8
Ans For ur Thread
Hello
you can use jpg and tif ,png image file on button and label directly in ur java swing aplication.However you can 't use BMp image file as tif and jpg.
the reson for problem is BMP format is not a compressed type image.
- 01-21-2009, 10:52 AM #9
hi makpandiyan,
as you said tht java accepts jpg ...
but i didnt think so...i cant read binary data (i e jpg file as binary file) using file reader...do u knw y?
- 01-21-2009, 11:26 AM #10
why not ?
i think it is possiblle..
can u tell briefly?
- 01-21-2009, 11:34 AM #11
why so?
private void uploadphoto(String upload)throws Exception {
//upload will have absolute path
System.out.println("ok "+i);
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("file data "+upload);
System.out.println("After "+upload);
Connection con=DriverManager.getConnection("jdbc:oracle:thin: @MT-TESTORADB:1521:ORACL","xxx", "xxx");
PreparedStatement pstmt = con.prepareStatement ("INSERT INTO temp1 VALUES (?,?)");
File fBlob=new File(upload);
FileInputStream is = new FileInputStream ( fBlob );
pstmt.setBinaryStream (1, is, (int) fBlob.length() );
pstmt.setInt(2,i);
pstmt.executeUpdate();
System.out.println("The End");
con.close();
// TODO Auto-generated method stub
}
this is my program...this accepts only gif format....One Life!!! Y Serious??? :)
- 01-21-2009, 12:16 PM #12
Similar Threads
-
XML Images
By JavaWizz in forum XMLReplies: 1Last Post: 10-17-2008, 10:19 AM -
images
By amith in forum AWT / SwingReplies: 1Last Post: 05-20-2008, 10:54 AM -
Wanna make 5 quick bucks?
By GodiaN in forum Java AppletsReplies: 5Last Post: 01-21-2008, 07:15 PM -
Help with images...
By toby in forum Java AppletsReplies: 1Last Post: 08-04-2007, 05:25 AM -
Images in JSP
By Daniel in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 06-05-2007, 06:01 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks