Doc extends PlainDocument problem
-
Hello I am using the following code to use createLeafElement from PlainDocument public class Doc extends PlainDocument { private static final long serialVersionUID = 1L; protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1) { return createLeafElement(parent, a, p0, p1); } } The above class without the createLeafElement() method works fine .But if I add this method I get runtime error saying program not responding. My purpose is to use createLeafElement() method.How can I use it? Thanks Prithaa
-
Hello I am using the following code to use createLeafElement from PlainDocument public class Doc extends PlainDocument { private static final long serialVersionUID = 1L; protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1) { return createLeafElement(parent, a, p0, p1); } } The above class without the createLeafElement() method works fine .But if I add this method I get runtime error saying program not responding. My purpose is to use createLeafElement() method.How can I use it? Thanks Prithaa
0. Wrap code in
<pre>
tags please. 1. What is the exact exception? Try using copy/paste. 2. The method wont work try calling the super implementation:public class Doc extends PlainDocument {
private static final long serialVersionUID = 1L; protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1) { return super.createLeafElement(parent, a, p0, p1); }
}
3. Finally, why override if you are not changing anything?
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
-
0. Wrap code in
<pre>
tags please. 1. What is the exact exception? Try using copy/paste. 2. The method wont work try calling the super implementation:public class Doc extends PlainDocument {
private static final long serialVersionUID = 1L; protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1) { return super.createLeafElement(parent, a, p0, p1); }
}
3. Finally, why override if you are not changing anything?
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
thanks for your advice I dont want to override but the method createLeafElemenmt() and createdefaultroot() are not visible when I want to use them directly. With the following object D1 the methods are not visible. PlainDocument D1 = new PlainDocument(); Thanks for your time
-
thanks for your advice I dont want to override but the method createLeafElemenmt() and createdefaultroot() are not visible when I want to use them directly. With the following object D1 the methods are not visible. PlainDocument D1 = new PlainDocument(); Thanks for your time
The example I gave should work as it calls the protected method on the super class.
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
-
The example I gave should work as it calls the protected method on the super class.
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
-
yes it does do the needful but why are the methods not visible in the subclasses protected methods should be visible in subclasses,is it not? thanks prithaa
Read this[^] to understand access modifiers. If something is protected it is visible within the package and to any sub-classes. By being visible to the sub-classes, it can be called from the class, but not from classes referencing the class.
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
-
Read this[^] to understand access modifiers. If something is protected it is visible within the package and to any sub-classes. By being visible to the sub-classes, it can be called from the class, but not from classes referencing the class.
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
-
0. Wrap code in
<pre>
tags please. 1. What is the exact exception? Try using copy/paste. 2. The method wont work try calling the super implementation:public class Doc extends PlainDocument {
private static final long serialVersionUID = 1L; protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1) { return super.createLeafElement(parent, a, p0, p1); }
}
3. Finally, why override if you are not changing anything?
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
My problem is that,when i enter a numeric value starting with 0 for ex: 0123 then at the time of saving,
it automatically converts this numeric value into something else like 83 or 9 etc.hadoop training in chennai | Oracle DBA Training in Chennai | Informatica Training in Chennai