Click here to Skip to main content
15,900,511 members
Home / Discussions / Java
   

Java

 
AnswerRe: How Find and Replace in Text File Pin
Nagy Vilmos11-Feb-11 23:12
professionalNagy Vilmos11-Feb-11 23:12 
Questioncodes for stignography Pin
himanshu111111-Feb-11 2:01
himanshu111111-Feb-11 2:01 
AnswerRe: codes for stignography Pin
Nagy Vilmos11-Feb-11 3:33
professionalNagy Vilmos11-Feb-11 3:33 
AnswerRe: codes for stignography Pin
Luc Pattyn11-Feb-11 3:39
sitebuilderLuc Pattyn11-Feb-11 3:39 
AnswerRe: codes for stignography Pin
RaviRanjanKr28-Feb-11 2:41
professionalRaviRanjanKr28-Feb-11 2:41 
QuestionReading image in java Pin
satizkumar9-Feb-11 0:41
satizkumar9-Feb-11 0:41 
GeneralRe: Reading image in java Pin
Manfred Rudolf Bihy9-Feb-11 4:14
professionalManfred Rudolf Bihy9-Feb-11 4:14 
AnswerRe: Reading image in java Pin
TorstenH.9-Feb-11 22:02
TorstenH.9-Feb-11 22:02 
import java.awt.Image;
import java.awt.Toolkit;

public class NewClass2 {
	public static void main(String args[]){

		Image image = Toolkit.getDefaultToolkit().getImage("D:/usage/a.JPG") ;
		int width = image.getWidth(null);
		int height = image.getHeight(null);
		System.out.println("height"+height);
		System.out.println("width"+width);
	}
}


...simlpy because the image is not found. I have changed the path String.


Image java.awt.Toolkit.getImage(String filename)



getImage
public abstract Image getImage(String filename)
Returns an image which gets pixel data from the specified file, whose format can be either GIF, JPEG or PNG. The underlying toolkit attempts to resolve multiple requests with the same filename to the same returned Image.
Since the mechanism required to facilitate this sharing of Image objects may continue to hold onto images that are no longer in use for an indefinite period of time, developers are encouraged to implement their own caching of images by using the createImage variant wherever available. If the image data contained in the specified file changes, the Image object returned from this method may still contain stale information which was loaded from the file after a prior call. Previously loaded image data can be manually discarded by calling the flush method on the returned Image.

This method first checks if there is a security manager installed. If so, the method calls the security manager's checkRead method with the file specified to ensure that the access to the image is allowed.


Parameters:
filename - the name of a file containing pixel data in a recognized file format.
Returns:
an image which gets its pixel data from the specified file.
Throws:
SecurityException - if a security manager exists and its checkRead method doesn't allow the operation.
See Also:
createImage(java.lang.String)
--------------------------------------------------------------------------------




int java.awt.Image.getWidth(ImageObserver observer)



getWidth
public abstract int getWidth(ImageObserver observer)
Determines the width of the image. If the width is not yet known, this method returns -1 and the specified ImageObserver object is notified later.

Parameters:
observer - an object waiting for the image to be loaded.
Returns:
the width of this image, or -1 if the width is not yet known.
See Also:
getHeight(java.awt.image.ImageObserver), ImageObserver


regards
Torsten
I never finish anyth...

QuestionHow to use GATE? implement the function Pin
lsxlhbsyl5-Feb-11 20:51
lsxlhbsyl5-Feb-11 20:51 
AnswerRe: How to use GATE? implement the function Pin
Richard MacCutchan5-Feb-11 21:28
mveRichard MacCutchan5-Feb-11 21:28 
AnswerRe: How to use GATE? implement the function Pin
TorstenH.8-Feb-11 3:39
TorstenH.8-Feb-11 3:39 
QuestionEncryption of Java-DB connection url?? Pin
Alok Sharma ji4-Feb-11 1:02
Alok Sharma ji4-Feb-11 1:02 
AnswerRe: Encryption of Java-DB connection url?? Pin
TorstenH.4-Feb-11 1:10
TorstenH.4-Feb-11 1:10 
GeneralRe: Encryption of Java-DB connection url?? Pin
Alok Sharma ji4-Feb-11 1:48
Alok Sharma ji4-Feb-11 1:48 
GeneralRe: Encryption of Java-DB connection url?? Pin
TorstenH.4-Feb-11 3:45
TorstenH.4-Feb-11 3:45 
AnswerRe: Encryption of Java-DB connection url?? Pin
Richard MacCutchan4-Feb-11 1:10
mveRichard MacCutchan4-Feb-11 1:10 
GeneralRe: Encryption of Java-DB connection url?? [modified] Pin
Alok Sharma ji4-Feb-11 1:38
Alok Sharma ji4-Feb-11 1:38 
GeneralRe: Encryption of Java-DB connection url?? Pin
Richard MacCutchan4-Feb-11 2:48
mveRichard MacCutchan4-Feb-11 2:48 
AnswerRe: Encryption of Java-DB connection url?? Pin
jschell4-Feb-11 9:46
jschell4-Feb-11 9:46 
GeneralRe: Encryption of Java-DB connection url?? Pin
Alok Sharma ji4-Feb-11 21:12
Alok Sharma ji4-Feb-11 21:12 
GeneralRe: Encryption of Java-DB connection url?? Pin
Richard MacCutchan4-Feb-11 23:34
mveRichard MacCutchan4-Feb-11 23:34 
GeneralRe: Encryption of Java-DB connection url?? Pin
jschell5-Feb-11 7:16
jschell5-Feb-11 7:16 
GeneralRe: Encryption of Java-DB connection url?? Pin
Alok Sharma ji13-Feb-11 19:20
Alok Sharma ji13-Feb-11 19:20 
QuestionHTML forms action attribute getting changed Pin
User 62554643-Feb-11 17:14
User 62554643-Feb-11 17:14 
AnswerRe: HTML forms action attribute getting changed Pin
Richard MacCutchan3-Feb-11 22:26
mveRichard MacCutchan3-Feb-11 22:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.