Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Utilities  RSS feed

 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application I get an error in this method body:

public void setImage(String path)
{
Image image = Utilities.blockingLoad(path);
mImage = Utilities.makeBufferedImage(image);
}

And, the "imports" are as follows:

import java.awt.Image;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
import javax.swing.text.Utilities;

How can I fix this problem?

Thanks.
 
Campbell Ritchie
Sheriff
Posts: 53773
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What sort of error are you getting? Please provide more details.
 
G Estes
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not see a method Utilities.blockingLoad(String path).

From your example, we do not know what mImage is? I presume it is a class level variable?

I do not see a method Utilities.makeBufferedImage(Image image);

What version of Java are you using?
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't matter which version, because
a) there are no such methods at all in the entire API of Java 6, and
b) why would static methods that work with images be put in javax.swing.text.Utilities, which is a utilities class for text related methods?

I've googled a bit, and I think Abder meant org.ccdtovcd.gui.Utilities

Alternatively, the two methods (including source) can be found at http://www.java2s.com/Code/Java/2D-Graphics-GUI/ImageBouncer.htm and http://cs.nyu.edu/~yap/classes/visual/03s/lect/progs/java2d/Utilities.java.
 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!