Simple OOP Problem. Help!

This is just a simple OOP problem that i cant decide on a best
implementation for.
im passing an object to an instance of, 'TabbedFrame', which is just
a frame with a Tabbed Pane in it that is holding custom panels.
however, these custom panels need access to the object being
passed to 'TabbedFrame' and to some methods in it.
i cant make them static however so how do i gain access to them?
is my only option to pass the 'TabbedFrame' to each panel?
like - jtabbedpane.add( "Panel 1", new mypanel1(this));
here is code:
new TabbedFrame( DataObject );
public class TabbedFrame{
public TabbedFrame(DataObject do){
this.do = do;
jtabbedpane.add( "Panel 1", new mypanel1() );
DataObject do;
public class mypanel1{
public mypanel1(){
// need access to DataObject of the 'TabbedFrame' object that instantiated
// this 'mypanel1' and to some of its methods
}i would just pass the DataObject to evey panel (there are 12) but
i also need to be able to call methods in the 'TabbedFrame'.
Any help would be appreciated!

Modify mypanel1's constructor:
public class mypanel1{
TabbedFrame tf;
public mypanel1(TabbedFrame tf){
this.tf = tf;
// need access to DataObject of the 'TabbedFrame' object that instantiated
// this 'mypanel1' and to some of its methods
DataObject theDo = tf.getDataObject();
tf.someMethod(); // Call method on the TabbedFrame
}In TabbedFrame:
public TabbedFrame(DataObject do){
this.do = do;
// Modify call to constructor to pass "this" TabbedFrame.
jtabbedpane.add( "Panel 1", new mypanel1(this) );
}

Similar Messages

  • SIMPLE JSP PROBLEM- HELP

    I have a jsp with which is created dynamically from a java class, now as I m navigating around I have few other pages with back button, now everytime I try the back button, the browser or my own, it keeps saying session timeout, and referesh the page. this is my back button.
    input type="button" value="Back" onClick="history.go(-1)" class="unnamed1">
    any ideas why this is happening? I just a little note it happens sometimes and other time its fine.

    Sorry just making some changes to the post: I get Warning: Page has Expired , I need to referesh the page. when i press refresh i get the page back i get the page back> the pages is created from a drop downlist which produced more then one page of result if the user goes to 2nd page and presses the back button to come to the orginal page that when I get the warning.

  • Real simple xslt problem/question

    Hi, i have a real simple xslt problem but i just cant figure out how to do it by looking at various examples on the net. i have a xml document and in it are some elements with a "result" tag name. i want to use xslt to reproduce exactly the same xml document except with an attribute called "id" added to those elements with a "result" tag name. i'm sure that theres a simple solution to it but i just cant figure it out. any helps greatly appreciated, thanks

    Start with the XSLT identity transform (I don't have it handy and it's fairly long, but you should be able to google it up). Add this:<xsl:template match="result">
      <result id="">
        <xsl:apply-templates>
      </result>
    </xsl:template>

  • Another simple classpath problem question

    Hi All
    Yes I know, there are a lots of questions about this matter, but I couldn't found a solution to my problem.
    I have a simple program:
    public class prueba {
            public static void main(String[] args) {
                    System.out.println("Ahi va...");
    }placed in /tmp/javier/prueba.java
    After compiled, I've tried to run it from / and then problems started:
    cd /
    java /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    I said, ok...it could be a classpath problem...then:
    java -cp /tmp/javier/ /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba
    Damn, another try...
    java -cp .:/tmp/javier/ /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    Jesus Christ....may be the last slash....
    java -cp .:/tmp/javier /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    Oh...no.... may be classpath to java classes..
    java -cp .:/usr/java/j2sdk1.4.2_01/lib/jre/:/tmp/javier/ /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    Well, I don't know why this error happens....
    Please, could somebody help me !!!
    Thanks in advance...
    <jl>

    It's not too early to start following the Sun coding
    conventions for Java:
    http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.
    tmlHi
    thanks for your reply.
    Yes, I agree. I use conventions with my programs. But my real problem was with a real application and then I did quickly this simple code to help others to understand the problem and give a fast reply...
    Let me know if that works. (It was fine on my
    machine.) - MODYes it works fine, thanks.... and Damn...Murphys law again, the only option I didn't tried is the solution to my problem... :)
    Thanks again...

  • JDeveloper 3.1 ocijdbc8 problem (help!)

    Hi,
    I am trying to connect to an Oracle databse via JDeveloper 3.1. When I use the menu:
    Tools->Connections->(new window) Edit -> Test connection
    I keep getting an error saying "No ocijdbc8 in java.library.path"
    I am sure this is a simple configuration problem but it just will not go away, no matter where I copy the ocijdbc8.dll file to.
    Can anybody help! I am getting desparate.
    Regards.

    install the Oracle8i client on your machine, and make sure that
    <ORACLE_HOME> is set correctly. (From The Tools->IDE Options and click on the environment TAB ) and select an ORACLE_HOME from the List Box)
    or
    Exit from JDeveloper and edit the jdeveloper.ini file which is located in
    <J Developer Home>\bin.
    Modify the entries:
    JLP=-Djava.library.path=.;%JAVA_ROOT%\bin;%JAVA_ROOT%\jre\bin
    SLP=-Dsun.boot.library.path=.;%JAVA_ROOT%\bin;%JAVA_ROOT%\jre\bin
    to include the Oracle Bin directory. For example:
    JLP=-Djava.library.path=.;%JAVA_ROOT%\bin;%JAVA_ROOT%\jre\bin;D:\ORA8i\BIN
    SLP=-Dsun.boot.library.path=.;%JAVA_ROOT%\bin;%JAVA_ROOT%\jre\bin;D:\ORA8i\BIN
    null

  • My daughter has just bought me an iPad 2 from Dubai and set it all up for me but unfortunately the iMessage function doesn't seem to work. We keep getting messages,when trying to activate it, that there is a network connection problem - help!

    My daughter has just bought me an iPad 2 from Dubai and set it all up for me but unfortunately the iMessage function doesn't seem to work. We keep getting messages,when trying to activate it, that there is a network connection problem - help!

    Thank you both for your responses but my daughter was reassured by the salesman in the iStyle store (official Apple store in the UAE) that iMessages would work but conceded that FaceTime wouldn't. My iTunes account is registered in the uk and my daughter's iPhone has iMessages even though she bought it (and uses it) in Dubai. Can anyone else throw any light on this?

  • I couldn't log into my apple account on my iPad, then i couldn't unlock it resulting in it being disabled, however it's the same as my iPhones password, I then called apple, i was hung up on twice and they said it will cost £70 to fix THEIR problem, help?

    I couldn't log into my apple account on my iPad, then i couldn't unlock it resulting in it being disabled, however it's the same as my iPhones password, I then called apple, i was hung up on twice and they said it will cost £70 to fix THEIR problem, help?

    If you cannot remember the passcode, you will need to restore your device using the computer with which you last synced it. This allows you to reset your passcode and resync the data from the device (or restore from a backup).
    If you restore on a different computer that was never synced with the device, you will be able to unlock the device for use and remove the passcode, but your data will not be present.
    You may have to force iPad/iPod into Recovery Mode
    http://support.apple.com/kb/ht4097

  • IPad syncing problem - HELP!

    iPad sync problem - HELP!  I keep getting this message "...cannot be synced because there is not enough free space to hold all of the items in the iTunes library (additional ...space needed)"  and yet I seem to have plenty of space on the iPad.  This just started today.  I even tried deleting some things to make even more room, but it didn't help.  Any ideas??? 
    I was thinking of restoring, but I've never done it...  should I? 
    thank you!

    Hello florafromnv,
    Welcome to Apple Support Communities.
    The following article addresses how to resolve the issues related to this message:
    iOS: "Not enough free space" alert when trying to sync
    http://support.apple.com/kb/TS1503
    Regards,
    Jeff D.

  • Error in simple oops program

    Hi experts,
    When executing a simple oops program ..i got the following error. Please correct the code.
    "VAR" is not type-compatible with formal parameter "I_DATA".          
          CLASS main DEFINITION
    CLASS main DEFINITION.
      PUBLIC SECTION.
        "// Instance Methods ( Note we use the statement 'METHODS'
        "// to define an instance method )
        METHODS set_data IMPORTING i_data TYPE string.
        METHODS get_data RETURNING value(r_data) TYPE string.
        METHODS print_attribute IMPORTING i_data TYPE string.
        "// Instance Methods ( Note we use the statement 'CLASS-METHODS'
        "// to define a static method )
        CLASS-METHODS set_classdata IMPORTING i_data TYPE string.
        CLASS-METHODS get_classdata RETURNING value(r_data) TYPE string.
        CLASS-METHODS print_classattribute IMPORTING i_data TYPE string.
      PROTECTED SECTION.
        "// Instance Attribute ( Note we use the statement 'DATA'
        "// to define an instance attribute )
        DATA attribute TYPE string.
        "// Static Attribute ( Note we use the statement 'CLASS-DATA'
        "// to define a static attribute )
        CLASS-DATA classattribute TYPE string.
      PRIVATE SECTION.
        "// Instace event ( Note we use the statement 'EVENTS'
        "// to define aN instance event )
        EVENTS event EXPORTING value(e_data) TYPE string.
        "// Instace event ( Note we use the statement 'CLASS-EVENTS'
        "// to define a static event )
        CLASS-EVENTS classevent EXPORTING value(e_data) TYPE string.
        "// For more informations about events see the following example:
        "// ABAP Objects - Creating your First Local Class - Using Events
    ENDCLASS.                    "main DEFINITION
          CLASS main IMPLEMENTATION
    CLASS main IMPLEMENTATION.
      METHOD set_data.
        CONCATENATE 'Instance Attribute value' i_data
                                   INTO attribute SEPARATED BY space.
      ENDMETHOD.                    "set_data
      METHOD get_data.
        MOVE attribute TO r_data.
      ENDMETHOD.                    "get_data
      METHOD set_classdata.
        CONCATENATE 'Static Attribute value' i_data
                                   INTO classattribute SEPARATED BY space.
      ENDMETHOD.                    "set_classdata
      METHOD get_classdata.
        MOVE main=>classattribute TO r_data.
      ENDMETHOD.                    "get_classdata
      METHOD print_attribute.
        WRITE: i_data, /.
      ENDMETHOD.                    "print_attribute
      METHOD print_classattribute.
        WRITE: i_data, /.
      ENDMETHOD.                    "print_classattribute
    ENDCLASS.                    "main IMPLEMENTATION
    DATA: var type char20.
    START-OF-SELECTION.
      "// Calling a Static method (note we don't have a object )
      "// instead we use the <class name>=><method name>.
      main=>set_classdata( 'SDN' ).
      var = main=>get_classdata( ).
      "// Print the var value
      main=>print_classattribute( var ).
      DATA: object_reference TYPE REF TO main.
      CREATE OBJECT object_reference.
      "// - Calling a Instance Method( Note we have to use a object to
      "// access the insntace components of class main )
      "// - Note we're using the statment "CALL METHOD", see looking for
      "// functional & General methods for more informations
      CALL METHOD object_reference->set_data( 'BPX' ).
      var = object_reference->get_data(  ).
      object_reference->print_attribute( var ).
    Thanks in Advance.
    Regards
    Nani

    Hi Nani,
    try changing your data definition for var from CHAR20 to STRING.
    regards,
    Peter

  • Hi when I stream video content to my Tv using Apple from my Ipad3 I find the Ipad goes to sleep after 2/3 minutes and disconects, the only way I have found to stop this is to continually tap the Ipad screen but there has to be a simpler method/ any help

    Hi when I stream video content to my Tv using Apple tv from my Ipad3 I find the Ipad goes to sleep after 2/3 minutes and disconects, the only way I have found to stop this is to continually tap the Ipad screen but there has to be a simpler method/ any help would be most welcome.

    Welcome to the Apple Community.
    Contact the developer of the Air Video app.

  • JDeveloper IDE simple setting problem

    Hi,
    Recently we switched to JDeveloper from Visual Cafe .I have a simple setting problem.How can I set the options so that IDE gives, the core java classes and packages,and our application classes and packeges, prompts in imports as well as in code.Where to set the options.
    eg: when I write
    import java. it should prompt all the pakages.
    Thanks in advance.
    -Gopal
    null

    I am not sure I understand what you are requesting, but ...
    You can configure JDeveloper projects to include various libraries by default.
    This is done by selecting menu Tools | Default Project Properties.../ Libraries tab.
    You should define a library for your classes.
    You can import any of the packages / classes from all the libraries which your project includes.
    It would be incorrect for a tool to automatically add a bunch of import lines at the top of every file because each file should import what it needs and just as importantly, not import what it does not need depending on the component type (e.g. a servlet should not include javax.swing.* ).
    An easy way to import elements into JDeveloper is to type in something like:
    import java.
    // and then type in Ctrl Space
    and this launches the package browser, you can select packages or classes to import.
    You can also do this at the variable declaratiton point such as typing in:
    foo() {
    Frame x
    // Press Control Alt Space
    and this will correctly change the type (Frame) to the type you select in the package browser and add the import statement.
    -John
    null

  • MOVED: KT333 Ultra; fuzzy logic, 1.6xp overclocking problem help !!!!!

    This topic has been moved to Overclockers & Modding Corner.
    KT333 Ultra; fuzzy logic, 1.6xp overclocking problem help !!!!!

    Not that I am an expert o/c but here are some thoughts on the matter.
    My comments are based on my experiences of the KT3 Ultra2 which is basically the same as the Ultra version.
    This mobo does not have the ability to lock the PCI/AGP bus freely from the FSB. However, it does have dividers. At 133 a 1/4 divider kicks in. Above 152FSB the 1/5 divider works, so that at 166 the PCI & AGP buses will be back in sync. If you are o/c your cpu, don't go from 133 to 145, etc since you will be running the PCI/AGP buses further out of whack. Just go to either the mid 150's or to 166 in one jump. The other problem / issue relates to your cpu. From what you say you have one of the old Palominos which are not great o/c's. I would personally o/c your cpu from the BIOS rather than 'Fluffy Logic' which I would tend to stay away from. 
    With a 166FSB cpu a very stable o/c would be 175-177 beyond 180 gets decidedly tricky.
    Hope this helps

  • Itunes keeps closing as soon as i open it and states 'windows has detected a problem' HELP!!!!

    Help!! Itunes keeps closing straight away and message states 'windows has detected a problem' HELP ASAP PLEASE!!!!

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    If you've already tried a complete uninstall and reinstall try opening iTunes in safe mode (hold down CTRL+SHIFT as you start iTunes) then going to Edit > Preferences > Store and turning off Show iTunes in the Cloud purchases. You may find iTunes will now start normally.
    tt2

  • I have installed photoshop elements 12. when I try use the editing features it said that i must login to Adobe to register the product. but each time i try to it said there is a problem. help the problem stated that the internet is not connected, but that

    i have installed photoshop elements 12.
    when I try use the editing features it said that i must login to Adobe to register the product.
    but each time i try to it said there is a problem.
    help
    the problem stated that the internet is not connected, but that is not the case.

    I had the same issue and I'm running Windows 7.  Tried working with technical support for several hours but they were no help.  They just had me doing the same things over and over, offering no real answers.  I finally got fed up and have decided to return my product for a full refund.

  • I can't install the itunes to my windows 7 X86 APPCRASH problem, help me guys

    i can't install the itunes to my windows 7 X86 APPCRASH problem, help me guys??  i don't know what to do..

    Why are you unable to install the iPod Updater? Are you getting an error message? Please be specific.
    Cheers!
    -Bryan

Maybe you are looking for