H
halfpeaw
I am creating a new custom JTextField object. I am overwriting my
existing getText() method inside of it. The problem I am having is I
don't know to get the text from the actual text field while I'm in my
new getText() method. I tried casting my object but that didn't work.
so my overall code looked something like this:
public Class CustJTextField extends JTextField {
private int length;
CustJTextField(int length) {
this.length = length
}
public String getText() {
String text = ((JtextField)this).getText()
if (text.length() > length) {
return null;
}
return text
}
}
Thats a much simpler form of what I'm coding, but you should be able to
get the idea. Unfortunately calling the getText method with in my
custom GetText method, ends up with a stack overflow error. Is there
some way to reference the base method? Thanks for any help you guys
can provide
existing getText() method inside of it. The problem I am having is I
don't know to get the text from the actual text field while I'm in my
new getText() method. I tried casting my object but that didn't work.
so my overall code looked something like this:
public Class CustJTextField extends JTextField {
private int length;
CustJTextField(int length) {
this.length = length
}
public String getText() {
String text = ((JtextField)this).getText()
if (text.length() > length) {
return null;
}
return text
}
}
Thats a much simpler form of what I'm coding, but you should be able to
get the idea. Unfortunately calling the getText method with in my
custom GetText method, ends up with a stack overflow error. Is there
some way to reference the base method? Thanks for any help you guys
can provide