java - What is difference between these two kinds of image loading code? -
these 2 kinds of code below used loading image file:
a)
file sourceimage = new file("filename"); image image = imageio.read(sourceimage); b)
toolkit tk = toolkit.getdeafaulttoolkit(); img=tk.getimage("filename"); what's real difference between these 2 codes ?
imageio.read(file) takes file , newer toolkit.getimage(string) takes filename (and has been part of language longer). also, first 1 provides additional functionality (that is, imageio.read(file) javadoc says in part)
the current cache settings
getusecache,getcachedirectoryused control caching inimageinputstreamcreated.note there no read method takes filename string; use method instead after creating
filefilename.
Comments
Post a Comment