Using Protected Methods, in a Java Library
Hey, there are a set of java image processing classes I want to use.
It is a library online... "JHLabs Java Image processing"...
Download Java Image Processing Classes
The java docs are here...
com.jhlabs.image
For example the class EdgeFilter ... I cant use because the the method that actually does the Edge filtering is a protected method
...
protected int[] filterPixels( int width, int height, int[] inPixels, Rectangle transformedSpace )
....
Same with ErodeFilter etc.. I can make instances of these classes but I cant use its actual necessary function.
That is same with all the image classes that I want to use.
Is there anything I am missing... How can I possibly use this library of classes with the netbeans project that I am doing. (I have imported the jar file library this comes with)
Thanks in advance.
Re: Using Protected Methods, in a Java Library
Typically the access modifier is set for a reason (see http://download.oracle.com/javase/tu...sscontrol.html)...so my guess is that these functions are not meant to be accessed in the way you want to. That being said, given the access levels you could extend the class and access the method from that child class
Edit: This thread has been cross posted here:
http://www.java-forums.org/new-java/40326-using-protected-methods-java-library.html
Although cross posting is allowed,
for everyone's benefit, please read:
Java Programming Forums Cross Posting Rules
The Problems With Cross Posting
See http://www.javaprogrammingforums.com...s-posting.html
Re: Using Protected Methods, in a Java Library
So I make a class that extends the class with the protected method.
And in the class that I'm doing all my image processing stuff I should make an instance of the extended class.
Do you think I should do this?
If I just put extend on the class I can access the method right?
Oh and I didn't know about the cross posting, sorry wont do this again...