Inheritance problems

I'm trying to work out a problem with a project I'm working on that uses inheritance.
the superclass consists of a prebuild GUI using swing, when more then one class enherits from the superclass for some reason its like they are sharing the subclass, any changes to the GUI done in one subclass affects the other, so if I add a JScrollPane to the Container from the inherited class it stayes after the window is closed AND its there when the other subclass runs.
What I want is for both subclasses to have their own instances of the subclass, or in other words I don't want the changes done in one subclass to affect the other subclass, is this possible?
My best guess is that instead of getting their own copy of the subclass they are sharing the same one so when one subclass does any changes the other reflects those changes because they are working with the exact same instance of the superclass. I have an idea of what my problem is I just don't know how to stop it from hapening.

It seems to me you are very confused as to how your inheritance tree works and from your description there is a clear design fault. It may well be you are diasy-chaining your classes and have got design in a fart with logic and flow - ie:
class A{ // superclass
class B extends A{} // so if B is an application GUI
class C extends B{} // C gets messed up
class D extends C{} // and application GUI D gets knackered too
This type of design rarely works well (if at all). You need to literally go back to the 'drawing board' and consider what you're trying to do with good design principles.
I'm not sure anyone here can really help you with this unless you give a detailed description of what you're trying to do (not code), though from what I CAN gather it should be something like;-
class AllComponentsFrame{}
/* class AmendedComponentsFrame1 extends AllComponentsFrame{} // maybe? */
class FinalGUI1 extends AllComponentsFrame{}
class FinalGUI2 extends AmendedComponentsFrame1 {}

Similar Messages

  • Multiple Inheritance problem persists in Interfaces

    Hi,
    I tentatively made a program and found that multiple inheritance problem of C++ persists even with interfaces. Although this is definetely a special case but I want to know what is this problem known as( i know that this is perhaps known as diamond problem in C++). And is there a way out of this thing.
    interface one
         int i=10;
    interface two
         int i=20;
    interface z extends one,two
    public class xyz implements z
         public static void main(String [] a)
         System.out.println(i);
    }O/P
    D:\Education\Java\JavaStudyRoom\Applets>javac xyz.java
    xyz.java:16: reference to i is ambiguous, both variable i in one and variable i
    in two match
    System.out.println(i);
    *^*
    *1 error*
    Thanks for replying

    suvojit168 wrote:
    I tentatively made a program and found that multiple inheritance problem of C++ persists even with interfaces. Although this is definetely a special case but I want to know what is this problem known as( i know that this is perhaps known as diamond problem in C++). And is there a way out of this thing. This is not the so called diamond inheritance problem. What you have here is an ordinary name clash. And as has been noted you can resolve it by qualifying which constant you're referring to, like
    System.out.println(one.i);
    For the diamond inheritance problem to apply both the one and the two interfaces would need to inherit a common ancestor (that's how the diamond is formed). Furthermore the common anscestor would need to carry implementation which would then be inherited two ways, once via one and once via two. This is the diamond inheritance problem Java is avoiding by allowing single inheritance of implementation only.
    P.S. My previous post was posted my mistake.

  • EJB 3.0 Inheritance problem

    I have to persist classes Cat, BullDog and StBernard:
    class Animal {
    private int animalId;
    private String name;
    private String dtype;
    class Dog extends Animal {
    private int dogId;
    private String furColor;
    class BullDog extends Dog {
    private int bullDogId;
    private int fightCount;
    class StBernard extends Dog {
    private int stbernardId;
    private int livesSaved;
    class Cat extends Animal {
    private int catId;
    private String preferredCatFood;
    }Planned inheritance strategy is joined table strategy. There is no problem mapping and persisting Cat and Dog tables into database, but I cannot find a way how to annotate StBernard and BullDog classes to persist them. Is it possible at all?

    do you know any official doc or reference where I can find statement, that such inheritance is not possible? i.e. only one level inheritance is allowed in JPA? Will check @SecondaryTable to see if it is helpful or not.
    @SecondaryTable This annotation is used to specify a secondary table for the annotated entity class. Specifying one or more secondary tables indicates that the data for the entity class is stored across multiple tables.@SecondaryTable is not for me :(
    Edited by: marekst on Feb 7, 2008 6:36 AM

  • XML mapping inheritance problem; missing class indicator field

    Hi!
    I am currently working on a project which involves mapping a large domain model on a XSD schema. For this we use Toplink 10.1.3.1 which is mostly great. But now I have a problem while wanting to use class inheritance.
    In my XSD I have the following defined
    <xs:complexType name="Traject">
         <xs:sequence>
              <xs:element name="SoortTraject" type="SoortTraject"/>
         </xs:sequence>
    </xs:complexType>
    <xs:complexType name="SpecialTraject">
         <xs:complexContent>
              <xs:extension base="Traject">
                   <xs:sequence>
                                 [some elements] 
                   </xs:sequence>
              </xs:extension>
         </xs:complexContent>
    </xs:complexType>My XML is an implementation of this XSD and looks like this
    <Trajecten>
            <Traject xsi:type="SpecialTraject">
                     [implementation of the elements]
             </Traject>
    </Trajecten>My domain model corresponts to the XSD, so there is a Traject object and an inherited SpecialTraject object.
    In the mapping I used the Advanced properties->inheritance on both descriptors telling the Traject descriptor that it was the 'Root Parent Descriptor' ('Use class indicator field' -> 'use XML Schema Type attribute', 'Use class indicator dictionary') and the SpecialTraject what it Child Descriptor was ('Traject').
    When I test my mapping it always results in the same error (no matter how I configure this inheritance mapping). It says :
    [TOPLINK-44] missing class indicator field
    Descriptor: XMLDescriptor(Traject --> [])What am I doing wrong? Does anybody know a sollution?
    Best regards,
    Jouke Stoel
    Developer

    This is the changed XML descriptor file. When I deploy the file it automaticly overrides the old file so it ain't possible that I was still using the wrong file
    <toplink:class-indicator-mappings>
        <toplink:class-indicator-mapping>
            <toplink:class>Traject</toplink:class>
            <toplink:class-indicator xsi:type="xsd:string">Traject</toplink:class-indicator>
        </toplink:class-indicator-mapping>
        <toplink:class-indicator-mapping>
            <toplink:class>SpecialTraject</toplink:class>
            <toplink:class-indicator xsi:type="xsd:string">SpecialTraject</toplink:class-indicator>
        </toplink:class-indicator-mapping>
    </toplink:class-indicator-mappings>I have posted the stacktrace but I had to translate a bit because my exception was in Dutch :)
    Locale is a great invention
    Exception [TOPLINK-44] (Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.DescriptorException
    Exception description: Missing class indicator field of database row [UnmarshalRecord()].
    Descriptor: XMLDescriptor(Traject --> [])
         at oracle.toplink.exceptions.DescriptorException.missingClassIndicatorField(DescriptorException.java:887)
         at oracle.toplink.internal.ox.QNameInheritancePolicy.classFromRow(QNameInheritancePolicy.java:84)
         at oracle.toplink.internal.ox.XMLRelationshipMappingNodeValue.processChild(XMLRelationshipMappingNodeValue.java:13)
         at oracle.toplink.internal.ox.XMLCompositeCollectionMappingNodeValue.startElement(XMLCompositeCollectionMappingNodeValue.java:62)
         at oracle.toplink.ox.record.UnmarshalRecord.startElement(UnmarshalRecord.java:352)
         at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1288)
         at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:336)
         at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:303)
         at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:205)
         at oracle.toplink.internal.ox.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:189)
         at oracle.toplink.internal.ox.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:147)
         at oracle.toplink.ox.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:228)
    .

  • Object Inheritance problem between projects

    Hi,
    I have two projects lets say project1 and project2. From project1 I instanciate processes of project2 as subflows. In addition I have one bpm object in project1 (lets say object1) that inherits from a bpm object in proyect2 (lets say object2). So project1 depends on project2 to make this inheritance happen. When I call the subflow I pass the object1 and as inherits from object2 there is no problem (input argument). For the output argument I have to cast from object2 to object1. And here is where I have a classcastexception. If all the processes are in the same project it works fine and there is no exception. But when splitting in two projects it fails. Seems that it is something related to the folder structure in the catalog that should be the same for both projects and that is the reason why it does not work, but as one project depends to the other I can not put the same folder structure in both catalogs because in the dependant project it is duplicated.
    Has anybody can give me an idea on how to solve this?
    Thank you very much in advance
    Kind regards

    Nobody can help me with this issue?,any help is much appreciated, the excpetion I get is:
    An operation exception occurred while running an automatic item. Details: An instance in Process '/Prueba#Default-1.0' could not be notified. Caused by: Process execution engine execution error. Caused by: The method 'CIL_otherProjectOtherProjectIn' from class 'Novartis.Prueba.Default_1_0.Instance' could not be successfully executed. Caused by: Cannot convert an object with type xobject.BaseModule.BaseObject to class xobject.DependantModule.DependantObject fuego.papi.exception.CannotStoreNotificationException: An instance in Process '/Prueba#Default-1.0' could not be notified. at fuego.server.AbstractProcessBean.receiveNotification(AbstractProcessBean.java:2791) at fuego.server.iec.LocalIPCHandler.sendNotification(LocalIPCHandler.java:79) at fuego.server.execution.microactivity.DefaultSendNotificationExecutionHandler.sendNotification(DefaultSendNotificationExecutionHandler.java:103) at fuego.server.execution.microactivity.EndMicroActivity.execute(EndMicroActivity.java:69) at fuego.server.execution.microactivity.MicroActivityEngineExecutionHandler.executeActivity(MicroActivityEngineExecutionHandler.java:57) at fuego.server.execution.ImmediateActivity.execute(ImmediateActivity.java:42) at fuego.server.execution.DefaultEngineExecution$AtomicExecutionTA.runTransaction(DefaultEngineExecution.java:304) at fuego.transaction.TransactionAction.startBaseTransaction(TransactionAction.java:470) at fuego.transaction.TransactionAction.startTransaction(TransactionAction.java:551) at fuego.transaction.TransactionAction.start(TransactionAction.java:212) at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:123) at fuego.server.execution.DefaultEngineExecution.executeAutomaticWork(DefaultEngineExecution.java:62) at fuego.server.execution.EngineExecution.executeAutomaticWork(EngineExecution.java:42) at fuego.server.execution.ToDoItem.executeAutomaticWork(ToDoItem.java:251) at fuego.server.execution.ToDoItem.run(ToDoItem.java:536) at fuego.component.ExecutionThread.processMessage(ExecutionThread.java:775) at fuego.component.ExecutionThread.processBatch(ExecutionThread.java:755) at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:142) at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:134) at fuego.fengine.ToDoQueueThread$PrincipalWrapper.processBatch(ToDoQueueThread.java:450) at fuego.component.ExecutionThread.work(ExecutionThread.java:839) at fuego.component.ExecutionThread.run(ExecutionThread.java:408) Caused by: fuego.papi.impl.EngineExecutionException: Process execution engine execution error. at fuego.server.execution.DefaultEngineExecution.executeWithoutComponentImmediate(DefaultEngineExecution.java:202) at fuego.server.execution.EngineExecution.executeWithoutComponentImmediate(EngineExecution.java:95) at fuego.server.AbstractProcessBean.receiveNotification(AbstractProcessBean.java:2757) ... 21 more Caused by: fuego.lang.ComponentExecutionException: The method 'CIL_otherProjectOtherProjectIn' from class 'Novartis.Prueba.Default_1_0.Instance' could not be successfully executed. at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:519) at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:273) at fuego.fengine.FEEngineExecutionContext.invokeMethodAsCil(FEEngineExecutionContext.java:219) at fuego.server.execution.EngineExecutionContext.runCil(EngineExecutionContext.java:1277) at fuego.server.execution.microactivity.ComponentExecutionMicroActivity.runCil(ComponentExecutionMicroActivity.java:126) at fuego.server.execution.microactivity.ComponentExecutionMicroActivity.execute(ComponentExecutionMicroActivity.java:84) at fuego.server.execution.microactivity.MicroActivityEngineExecutionHandler.executeActivity(MicroActivityEngineExecutionHandler.java:57) at fuego.server.execution.ImmediateActivity.execute(ImmediateActivity.java:42) at fuego.server.execution.DefaultEngineExecution$AtomicExecutionTA.runTransaction(DefaultEngineExecution.java:304) at fuego.transaction.TransactionAction.startNestedTransaction(TransactionAction.java:527) at fuego.transaction.TransactionAction.startTransaction(TransactionAction.java:548) at fuego.transaction.TransactionAction.start(TransactionAction.java:212) at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:123) at fuego.server.execution.DefaultEngineExecution.executeWithoutComponentImmediate(DefaultEngineExecution.java:199) ... 23 more Caused by: java.lang.ClassCastException: Cannot convert an object with type xobject.BaseModule.BaseObject to class xobject.DependantModule.DependantObject at fuego.util.Conversion.cast(Conversion.java:99) at Novartis.Prueba.Default_1_0.Instance.CIL_otherProjectOtherProjectIn(Instance.xcdl:1) at Novartis.Prueba.Default_1_0.Instance.CIL_otherProjectOtherProjectIn(Instance.xcdl) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:512) ... 36 more
    The strange thing is that if all the processes are in the same project everything works fine but once I split in two projects it raises the exception.
    Thank you very much

  • Java ME 3.0 Web Services Stub Generator  Inheritance problem

    Hello,
    I have a problem with that relates to inheritance.
    Suppose I have abstract class User and class Member that extends class User.
    Suppose I have web service MyService:
    @WebService
    public class MyService {
    public User getUser(int id) {
    // do something
    When the server returns a Member instance instead of User I receive a MarshalException at the Client.
    The reason is " Invalid Element in Response:" + Member field that isn't part of User.
    I am using Java Me SDK 3.0 wscompile stub generator.
    I have also checked it with GlassFish stub generator wsimport and there the problem didn't appear.
    Ideas ?
    Thanks in advance,
    Raanan

    Seems like you are missing a necessary jar-file in your forms-classpath. Check the libraries attached to your project in Jdeveloper and add them to the path.

  • Inheritance problem with parent class calling child class

    I have a problem with inheritance with a parent class calling a child class method. Below is the example pseudocode code and my problem:
    public abstract class A {
        protected void function1 ( ) { }
        protected void function2 () {
             //calls function1();
             function1();
    public abstract class B extends A {
        protected void function1 ()  {
             // do stuff
    public class C extends B {
        protected void function1 ()  {
            // do stuff
            super.function1 ();
    }I have an object instance of class C created and its function2() is invoked.
    My problem is, while in function2(), which belongs to abstract class A and the method call to function 1() is called, the call invokes the function1() of class B. Shouldn't the call invoke function 1() of class C instead? And then function1() of class B will be called after due to the super.function1(). It's not behaving like I thought it would.
    Edited by: crono77 on Jan 10, 2008 8:13 PM

    Nevermind, i found my error :)

  • Inheritance problem

    I have a super class and two subclass which is extend the super class. I add a mouse handler in one of the subclass. The problem is that the other subclass also affect by the mouse handler. How can i avoid that??
    here is the code
    public abstract class SketchView extends JPanel implements Observer, Constants, ActionListener, Printable, Pageable
    public SketchView(Sketcher theApp, SketchModel sketcherModel)
    this.sketcherModel = sketcherModel;
    this.theApp = theApp;
    public class DocView extends SketchView
    public DocView(Sketcher theApp, SketchModel sketcherModel)
    super(theApp, sketcherModel);
    MouseHandler handler = new MouseHandler();
    addMouseListener(handler);
    addMouseMotionListener(handler);
    class MouseHandler extends MouseInputAdapter
    public class ReportView extends SketchView
    public ReportView(Sketcher theApp, SketchModel sketcherModel)
    super(theApp, sketcherModel);
    I only add mouse handler in the DocView class, but the ReportView also have the mouse event. how can i fix this problem? pls help

    To: remu
    Thank for your reply.
    Following is the origanal code
    public abstract class SketchView extends JPanel implements Observer, Constants, ActionListener, Printable, Pageable
    public SketchView(Sketcher theApp, SketchModel sketcherModel)
    this.sketcherModel = sketcherModel;
    this.theApp = theApp;
    public static class DocView extends SketchView
    public DocView(Sketcher theApp, SketchModel sketcherModel)
    super(theApp, sketcherModel);
    MouseHandler handler = new MouseHandler();
    addMouseListener(handler);
    addMouseMotionListener(handler);
    class MouseHandler extends MouseInputAdapter
    public static class ReportView extends SketchView
    public ReportView(Sketcher theApp, SketchModel sketcherModel)
    super(theApp, sketcherModel);
    Before remove the static, my program can run, but the ReportView have the mouse event too. After i remove the static, i can't compile my program. The error is
    SketchFrame.java:460: not an enclosing class: SketchView SketchView view = new SketchView.ReportView(theApp, sketch);
    ^
    .\Sketcher.java:137: not an enclosing class: SketchView
    view[internalFrameCount] = new SketchView.DocView(this, sketch[internalFrameCount]); // Create the view
    ^
    2 errors
    is it possible that the static cause the problem??

  • Window inheritance problem, implementation question

    This is a multi-part message in MIME format.
    --------------F5AF60803BB8EFA34C8D4288
    Content-Type: multipart/alternative;
    boundary="------------24CDBE5DFBEC0C4205C15C80"
    --------------24CDBE5DFBEC0C4205C15C80
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: 7bit
    Hi!
    I have a window inheritance and implementation question. I'm using
    Forte 3.0.J.1.
    I have a super (base) window with a PushButton on it. I want to
    handle the Click event of the button in this super window therefore
    I create an event handler.
    <MyBtn> : PushButton
    I create a sub window inheriting from the previous super window.
    I put some data widgets on it and group all of them (the inherited
    button as well) into a GridField. When I set the mapped type of the grid
    the name of the inherited PushButton widget changes:
    <MainGrid.MyBtn> : PushButton
    When I run the application I get a SystemException with the
    message:
    Attempt to register an event on a NIL object (qqds_C_FieldWidget, 10).
    Traceback:
    SuperWindow.EH at line 0
    SubWindow.Display at line 5
    C++ Method(s)
    UserApp.Run at offset 105
    It is quite understandable that in runtime there is no widget called
    <MyBtn>
    and the event handler of the super class fails.
    But what I don't know : after specifing a mapped type of a GridField why
    changes
    the name of those widgets that haven't got mapped type e.g.: PushButton,
    PictureButton etc.
    How to solve this situation?
    I made a sall example which i send in attachment.
    Thanks for any help and advice in advance...
    Attila Racz Lufthansa Systems
    Hungary
    BUD LSYH
    E-mail: [email protected] .-``'.
    Tel.: (36 1) 431-2910 .` .' Mazsa ter 2-6.
    Fax : (36 1) 431-2977 _.-' '._ H-1107 Budapest,
    Hungary
    --------------24CDBE5DFBEC0C4205C15C80
    Content-Type: text/html; charset=us-ascii
    Content-Transfer-Encoding: 7bit
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    <tt>    Hi!</tt><tt></tt>
    <p><tt>I have a window inheritance and implementation question. I'm using</tt>
    <br><tt>Forte 3.0.J.1.</tt><tt></tt>
    <p><tt>I have a super (base) window with a PushButton on it. I want to</tt>
    <br><tt>handle the Click event of the button in this super window therefore</tt>
    <br><tt>I create an event handler.</tt><tt></tt>
    <p><tt>&lt;MyBtn> : PushButton</tt><tt></tt>
    <p><tt>I create a sub window inheriting from the previous super window.</tt>
    <br><tt>I put some data widgets on it and group all of them (the inherited</tt>
    <br><tt>button as well) into a GridField. When I set the mapped type of
    the grid</tt>
    <br><tt>the name of the inherited PushButton widget changes:</tt><tt></tt>
    <p><tt>&lt;MainGrid.MyBtn> : PushButton</tt><tt></tt>
    <p><tt>When I run the application I get a SystemException with the</tt>
    <br><tt>message:</tt><tt></tt>
    <p><tt>Attempt to register an event on a NIL object  (qqds_C_FieldWidget,
    10).</tt>
    <br><tt>      Traceback:</tt>
    <br><tt>          SuperWindow.EH
    at line 0</tt>
    <br><tt>          SubWindow.Display
    at line 5</tt>
    <br><tt>          C++ Method(s)</tt>
    <br><tt>          UserApp.Run
    at offset 105</tt><tt></tt>
    <p><tt>It is quite understandable that in runtime there is no widget called
    &lt;MyBtn></tt>
    <br><tt>and the event handler of the super class fails.</tt><tt></tt>
    <p><tt>But what I don't know : after specifing a mapped type of a GridField
    why changes</tt>
    <br><tt>the name of those widgets that haven't got mapped type e.g.: PushButton,</tt>
    <br><tt>PictureButton etc.</tt><tt></tt>
    <p><tt>How to solve this situation?</tt>
    <br><tt>I made a sall example which i send in attachment.</tt><tt></tt>
    <p><tt>Thanks for any help and advice in advance...</tt><tt></tt>
    <p><tt>---------------------------------------------------------------------------</tt>
    <br><tt> Attila Racz                                    
    Lufthansa Systems Hungary</tt>
    <br><tt>                                                
    BUD LSYH</tt>
    <br><tt>E-mail: [email protected]      
    .-``'.</tt>
    <br><tt>Tel.: (36 1) 431-2910               
    .`   .'     Mazsa ter 2-6.</tt>
    <br><tt>Fax : (36 1) 431-2977           
    _.-'     '._    H-1107 Budapest, Hungary</tt>
    <br><tt>---------------------------------------------------------------------------</tt>
    <br><tt></tt> </html>
    --------------24CDBE5DFBEC0C4205C15C80--
    --------------F5AF60803BB8EFA34C8D4288
    Content-Type: application/x-zip-compressed;
    name="Inh.zip"
    Content-Transfer-Encoding: base64
    Content-Disposition: inline;
    filename="Inh.zip"
    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
    --------------F5AF60803BB8EFA34C8D4288--

    import javax.swing.JOptionPane;
    public class Test{
         public static void main(String[] args)
              String newItem = "Item";
              float newSerial = 4234;
              float newCode = 3424;
              int newBase = 1000;
              boolean YesWarranty = true;
              boolean NoWarranty = true;
              Machinery test1 = new Machinery(newItem, newCode, newSerial, newBase, YesWarranty, NoWarranty);
              JOptionPane.showMessageDialog(null, "Item: " + test1.getItem() + " Serial: " + test1.getSerial() + " Code: " + test1.getCode()
              + " Warranty: " + test1.IncludeWarranty() + " No Warranty: " + test1.ExcludeWarranty()+ " Base: " + test1.getPrice());
    }Tested with this and it seems to be ok?
    Changed my final code too because it seemed to always add the 10% whether YesWarranty was true or false, so made it
              if (TrueWarranty==true) //There is a warranty, it returns the base price plus 10%
                   return (base+((base/100)*10));May have posted here too early if it does work, but there is another part so if ive trouble with that il be back :P
    Edited by: dave_the_bear on 16-Nov-2010 07:17
    Changed base to double and used the *0.1 method

  • CSS inheritance problem

    Hi all, I have a CSS problem. Consider the following markup:
    <p class="bigText">
    some big text
    <span>some more text</span>
    </p>
    and the following css:
    .bigText{
    font-size:50px;
    Ok. Now, I want the text inside the span, to be styled just
    like normal text on the page, that is,
    to inherit the font size declared in the body:
    body{
    font-size:??px;
    The catch is that I do not know what the text size of the
    body is (that's customizable by the user).
    I just want the span inside the .bigText p to be the same
    size than what the body says, whatever it
    says...
    Is that possible?
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    An Ingenious WebSite Builder:
    http://sitelander.com

    DUH! "right" = "write"
    Walt
    "Walt F. Schaefer" <[email protected]> wrote in
    message
    news:f8ltil$f6c$[email protected]..
    > Could you right your HTML this way:
    >
    > <p><span class="bigText">
    > some big text</span>
    > some more text
    > </p>
    >
    > I think that does what you want and it seems (to me)
    simpler.
    >
    > --
    >
    > Walt
    >
    >
    > "(_seb_)" <[email protected]> wrote in message
    > news:f8lsd9$dus$[email protected]..
    >> Hi all, I have a CSS problem. Consider the following
    markup:
    >>
    >> <p class="bigText">
    >> some big text
    >> <span>some more text</span>
    >> </p>
    >>
    >> and the following css:
    >>
    >> .bigText{
    >> font-size:50px;
    >> }
    >>
    >> Ok. Now, I want the text inside the span, to be
    styled just like normal
    >> text on the page, that is, to inherit the font size
    declared in the body:
    >>
    >> body{
    >> font-size:??px;
    >> }
    >>
    >>
    >> The catch is that I do not know what the text size
    of the body is (that's
    >> customizable by the user).
    >> I just want the span inside the .bigText p to be the
    same size than what
    >> the body says, whatever it says...
    >>
    >> Is that possible?
    >>
    >>
    >>
    >> --
    >> seb ( [email protected])
    >>
    http://webtrans1.com | high-end web
    design
    >>
    >> An Ingenious WebSite Builder:
    http://sitelander.com
    >
    >

  • MappedSuperclass inheritance problem

    Using Oracle TopLink Essentials - 2006.6 (Build 060608)
    Here is the hierarchy:
    @MappedSuperclass
    public abstract class AbstractEntity implements Serializable, Persistable {
    @Version
    @Column(name="VERSION")
    private Integer version;
    @Entity
    @TableGenerator(name = "event", table = "ID_GEN", pkColumnName = "GEN_KEY", valueColumnName = "GEN_VALUE", pkColumnValue = "EVENT_POID", allocationSize = 1)
    @Table(name = "EVENT")
    @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn(name = "EVENT_TYPE")
    public abstract class Event extends AbstractEntity {
    @Entity
    @DiscriminatorValue(value = "APPOINTMENT")
    public class Appointment extends Event {
    Results in the following exception
    Exception Description: Multiple writable mappings exist for the field [EVENT.VERSION]. Only one may be defined as writable, all others must be specified read-only.
    What am I missing? I am using field annotations, I do not override the version on any subclass nor add any further annotation for VERSION, where in the heck is it getting a second mapping?
    This does not occur when using Toplink essentials v2 b56. However I am unable to query for the Appointments in the DB using find(Appointment.class,1).
    Thanks.

    Ignore the reference to search for the Appointment class. That was a separate issue.

  • Default visibility interface inheritance problem

    I have these constructs:
    package bar;
    public interface A {
    void Foo()
    package bar;
    public class B extends C implements A {
    void Foo() {
    This produces following compile error:
    Cannot reduce the visibility of the inherited method from A. The error does not occur if I make B::Foo() public.
    Why does the error occur?
    Thanks in advance,
    -Lev

    the default visability for interfaces are public for methods and public static final for variables. The
    default modifier for classes are packager-scope and variables are non-static, non-final by default.
    For this reason and others I prefer to state explicitly what modifiers I expect the methods and variables to have.... and believe me, you're not the only one ;-)
    lazyness is often leading to omitting modifiers, wiseness always recommends to be as explicit as possible.

  • Inheritance problem: base class does not see stage instances

    I'm writing a series of Search windows for an application. I create the FLA files on the stage, each has 3 simple buttons: next_btn, prev_btn, and close_btn. Those all have event listeners which call findNext(), findPrev() and closeWin() respectively. Each search window looks for different things, some with a text box and some with a combo, etc.
    So I have a base class com.search that extends Sprite and adds the eventListeners at startup (actually, on addedToStage). Like this:
    function isAddedToStage(evt:Event){
       next_btn.addEventListener("click",findNext);
       prev_btn.addEventListener("click",findPrev);
       close_btn.addEventListener("click",closeWin);
    Then I write the appropriate find functions in each derived class.
    For example, I have
    package com {
         import com.search;
         class searchText extends search {
    In my FLA file, I set the class to com.searchText.
    But when I compile and run the window, I get runtime errors:
    ReferenceError: Error #1065: Variable next_btn is not defined.
    at com::search()
    at com::searchtext()
    If I add the event listeners in the derived class rather than the base, it works fine. But that seems to defeat the purpose of inheritance, plus it infers that I won't be able to derive new classes/swfs from those derived classes.
    So the question is, how does one reference objects created on the stage from a base class of that document's class?

    Found it. After messing around with trying dynamic classes and overriden functions that returned the desired button (that worked, but was ugly.)
    Simply and silly once you know how.
    You have to explicitly reference the stage objects (or any newly declared methods or properties) in the derived class as members of "this" in the base class - so:
    class Search {
    function isAddedToStage(evt:Event){
       this.next_btn.addEventListener("click",this.findNext);
       this.prev_btn.addEventListener("click",this.findPrev);
       this.close_btn.addEventListener("click",closeWin);
    function closeWin(e:Event){
    and then create the buttons on stage in the FLA using the derived class.
    You can also declare the event handling functions in the base class as empty functions and then override them in the derived classes. Or fill in the functions in the base class to throw a runtime error, and then override - that's as close to an abstract class as you can get, I think.

  • Inheritance problem first part compiles, but can't get the rest to compile.

    Here is the assignment :Lab #8, Objects, Inheritance and Polymorphism
    Purpose of Lab: Be able to:
    Write a Java program that defines, loads, and uses an array of objects.
    Create objects of classes.
    Understand the notion of polymorphism.
    Write superclasses and subclasses.
    Create objects of superclasses and subclasses.
    Instructions:
    1. Write an Abstract Data Type called Animal. Include two instance variables in this class: a String for name and an integer for age. Write a constructor method that takes two arguments and a second constructor that takes no arguments. Write get and set methods for each of the two instance variables. Write a toString method which displays the values of the instance variables for any object of type Animal. Write a speak method that takes no arguments, returns nothing and displays ?Arg! Arg!? on the monitor.
    2. Write a second class called Duck, a subclass of class Animal. Add an additional instance variable to those inherited from Animal: an integer called feathers (this variable is used to store the number of feathers that a particular Duck object has). Write a constructor that takes three arguments and another constructor that takes no arguments. Provide set and get methods for the feathers instance variable. Override the toString method to display the values of all instance variables belonging to a Duck type of object. Override the speak method to display a value of ?Quack! Quack!?.
    3. Write a third class called Cow, also a subclass of class Animal. Add an additional instance variable to those inherited from Animal: an integer called spots (this variable is used to store the number of spots feathers that a particular Cow object has). Write a constructor that takes three arguments and another constructor that takes no arguments. Override the toString method to display the values of all instance variables belonging to a Cow type of object. Override the speak method to display a value of ?Mooo! Mooo!?.
    4. Finally, enter, compile and execute the Farm class shown below. Make sure that all of your classes (Animal, Duck, Cow and Farm) are in the same folder. Compile all of the classes. Run the Farm program. Answer the questions below. Here is my code so far: public class Animals{
        private String name;
        private int age;
        public Animals()
        public Animals( String nVal, int ageVal)
            name =nVal;
            age = ageVal;
        public void setN(String nVal)
            name = nVal;
        public String getN()
    return name;
    public void setA( int ageVal)
    age = ageVal;
    public int getA()
        return age;
    public String toString()
        return "\nThe name is" + name +", and the age is" + age + ".";
    public class Duck extends Animals
    private int feathers;
    public Duck()
        super();
        public Duck(String nVal, int ageVal)
        super(nVal,ageVal);
        feathers = feathersVal;
        public void setFeathers(int feathersVal)
        feathers= feathersVal;
        public int getFeathers()
            return feathers;
        public String toString()
        return  "\nThe name is" + super.getN() + ", and the age is" + super.getA()
        + "\n The Duck's feathers are" +feathers+ ".";
    public class Cow extends Animals
        private int spots;
        public Cow(int spots)
            super();
            public Cow(String nVal, int spotsVal)
            super(spots);
                spotsColor = spots;
                public void setSpots(int spots)
            spots= spotsColor;
                public int getSpots();
        public String toString()
            return  "\nThe name is" +super.getN()+ ", and the age is" + super.getA()
            + "\n The Duck's feathers are" +feathers+ "\nThe Cow's spots are" +spots+".";
    import javax.swing.JOptionPane.JOption;
    import javax.swing.*;
    public class Farm
        public static void main( String[] args );
        Animals[]farmAnimals = new Animals[4];
                farmAnimals[0] = new Animals("Animals", 3);
                farmAnimals[1] = new Duck("Duck","green,grey feathers");
                farmAnimals[2] = new Cow("Cow", 3, "brown white spots");any help greatly appreciated last assignment of the semester!

    Here is the assignment :Lab #8, Objects, Inheritance and Polymorphism
    Purpose of Lab: Be able to:
    Write a Java program that defines, loads, and uses an array of objects.
    Create objects of classes.
    Understand the notion of polymorphism.
    Write superclasses and subclasses.
    Create objects of superclasses and subclasses.
    Instructions:
    1. Write an Abstract Data Type called Animal. Include two instance variables in this class: a String for name and an integer for age. Write a constructor method that takes two arguments and a second constructor that takes no arguments. Write get and set methods for each of the two instance variables. Write a toString method which displays the values of the instance variables for any object of type Animal. Write a speak method that takes no arguments, returns nothing and displays ?Arg! Arg!? on the monitor.
    2. Write a second class called Duck, a subclass of class Animal. Add an additional instance variable to those inherited from Animal: an integer called feathers (this variable is used to store the number of feathers that a particular Duck object has). Write a constructor that takes three arguments and another constructor that takes no arguments. Provide set and get methods for the feathers instance variable. Override the toString method to display the values of all instance variables belonging to a Duck type of object. Override the speak method to display a value of ?Quack! Quack!?.
    3. Write a third class called Cow, also a subclass of class Animal. Add an additional instance variable to those inherited from Animal: an integer called spots (this variable is used to store the number of spots feathers that a particular Cow object has). Write a constructor that takes three arguments and another constructor that takes no arguments. Override the toString method to display the values of all instance variables belonging to a Cow type of object. Override the speak method to display a value of ?Mooo! Mooo!?.
    4. Finally, enter, compile and execute the Farm class shown below. Make sure that all of your classes (Animal, Duck, Cow and Farm) are in the same folder. Compile all of the classes. Run the Farm program. Answer the questions below. Here is my code so far:
    public class Animals{
    private String name;
    private int age;
    public Animals()
    public Animals( String nVal, int ageVal) }
    name =nVal;
    age = ageVal;
    public void setN(String nVal)
    name = nVal;
    public String getN()
    return name;
    public void setA( int ageVal)
    age = ageVal;
    public int getA()
    return age;
    public String toString()
    return "\nThe name is"+name+ , and the age is" + age + ".";
    {code}{code}
    {code}{code}
    public class Duck extends Animals
    private int feathers;
    public Duck()
    super();
    public Duck(String nVal, int ageVal)
    super(nVal,ageVal);
    feathers = feathersVal;
    public void setFeathers(int feathersVal)
    feathers= feathersVal;
    public int getFeathers()
    return feathers;
    public String toString()
    return "\nThe name is" + super.getN() + ", and the age is" + super.getA()
    + "\n The Duck's feathers are" +feathers+ ".";
    {code}{code}
    {code}{code}
    public class Cow extends Animals
    private int spots;
    public Cow(int spots)
    super();
    public Cow(String nVal, int spotsVal)
    super(spots);
    spotsColor = spots;
    public void setSpots(int spots)
    spots= spotsColor;
    public int getSpots();
    public String toString()
    return "string1" + variable1 + "string2" + variable2;
    {code}{code}
    {code}{code}
    import javax.swing.JOptionPane.JOption;
    import javax.swing.*;
    public class Farm
    public static void main( String[] args ){
    Animals[]farmAnimals = new Animals[4];
    farmAnimals[0] = new Animals("Animals", 3);
    farmAnimals[1] = new Duck("Duck","green,grey feathers");
    farmAnimals[2] = new Cow("Cow", 3, "brown white spots");
    {code}{code}
    In Duck The compile errors are as follows:java1: cannot find symbol symbol class Duck extends Animals with the caret under A in Animals
    java 13 same as above but for feathers = feathersVal; with the caret under f in feathersVal
    java 25 same error caret under s in both supers
    Cow has 1 error in java 20 class,interface,or enum expected caret under S in String
    Farm a parsing error at last brace but when I add another ending brace i get
    java1 cannot find symbol class JOption caret under period between JOptionPane.JOption
    java 9 cannot find symbol caret under A in Animals[]farm etc also under A in new Animals
    java 10 cannot find symbol caret under D in Duck
    java 12 cannot find symbol caret under C in new Cow

  • ACL Inheritance Problem

    Hi all,
    I want to assign permissions to a folder/document programatically after creating it.But i don't want to inherit the permission from the parent.
    For example, take the hierarchy:-
    Folder_1
        Folder_11
        Folder_12
        Folder_13
    If Folder_11 is first sub-folder to be created programatically, then the permission for Folder_11 share the same ACL for the Folder_1 i.e. parent folder. The permisssion inheritance is not broken even if child folder(Folder_11) ACL are modified.
    My code is somewhat like this.
    ResourceContext context = null;
    context = new ResourceContext(loggedOnUser);
    RID aRid = RID.getRID(folderName);
    IResource resource =
              ResourceFactory.getInstance().getResource(aRid, context);
    ISecurityManager sm =
         resource.getRepositoryManager().getSecurityManager(resource);
    IResourceAcl ra;
    if (sm != null && sm instanceof IAclSecurityManager) {
         IAclSecurityManager asm = (IAclSecurityManager) sm;
         IResourceAclManager ram = asm.getAclManager();
    ram.removeAcl(resource);
         ra = ram.getAcl(resource);
         if (ra == null) {
              ra = ram.createAcl(resource);
    IUMPrincipal user =WPUMFactory.getUserFactory().getUser("testuser");     
    IResourceAclEntry readUsr =ram.createAclEntry(user,false,ram.getPermission(IAclPermission.ACL_PERMISSION_READ),0);
    flag = ra.addEntry(readUsr);

    Even if I was sceptic about this kind of solution, I gave it a chance on yesterday evening, but the final result is still the same.  First two attempts (unbind ports from ACL, add a MAC to ACL, bind ports back to ACL) were fine, but on the third one (bind ports back to ACL a save settings) I got the same error message as before. There's no chance to bind ports back to ACL now, so I have to reset the switch again in the evening.

Maybe you are looking for

  • Event for a change in the cursor legend

    Hi! I need to recognize a change of the cursor properties by the user through the XY-Graph Cursor Legend! (i.e. changing cursor color) There seems to be no event for that in my event structure (although there is a event for changing the plot properti

  • JTable Combobox editor with PrppertychangeListener

    Hello, I need a help from experts. I have a JTable. In the java table i need to have a ComboBox editor for example on the second column. And when i am changing value in the combobox i need to to do some calculations in JTable object. To setup a Prope

  • K7n420 pro - wont restart

     ;( Hi all, i have a weird problem with my new board. any help would be appreciated. system specs amd xp 2200 512 ddr 40 gig barracuda geforce 3 ti 200 64mb card win xp home since building new system, if i try to restart pc, from desktop, it will han

  • Advice on inserting facebook like module into webpage

    Hi, I am trying to add a "facebook like" module into the homepage of my test website (link attached). I have gone into the develop part of my admin console and copied both sections of the code from the facebook developer page following the gudiance f

  • How to run recordset SQL query in FORM DATA event

    How can I run recordset SQL query in FORM DATA event upon clicking on Add button in the document?