Hopefully easy, passed object to constructor, need for event

Ok, the current scope of my program is currently two frames, in two files, Login.java and Select.java (if you have not been following my neverending question saga)
I create an instance of Select from within the Login file, and i pass to the constructor of select, the Login object created, so Select can have access to what was entered in the text field of Login via a getName function, that works.
Now i want to have the "Back" button in Select close the select frame, and re-open the Login frame ie setVisible(false) and setVisible(true) respectivly...
Now once before, i noticed if i tried to make the visibility false of Login, from within the file that i created that Login object, i would get odd errors. So i figure if i want Select to close itself, i would pass it the object that Login created of Select.
But, the event code for the button has no idea what i passed to the constructor of Select (the event code for the button IN select)
So how would i go about letting my lil button know what i passed to the constructor of the class that it is in?
I assume this is an easy question, at least i hope so
Here is some relevent code:
// from Login.java, within the event for pressing "next" after validating the name within the text field.
selectframe = new Select(loginframe, selectframe);
selectframe.setSize(500, 350);
selectframe.setTitle("Select the midget");
selectframe.setVisible(true);
// Select.java
public Select(Login passed, Select selectpass)
          passed.setVisible(false);  //works fine...
          // GUI code
public void actionPerformed(ActionEvent f)
      if (f.getSource() == jbtBack)
           System.out.println("Back pressed");
           selectpass.setVisible(false);  //Error: selectpass is undefined
           passed.setVisible(true);  //Error. passed is undefined

import java.awt.*;
import java.awt.event.*;
public class ClassA extends Frame implements ActionListener
     public ClassA() {
          setTitle("ClassA");
          addWindowListener(new WindowAdapter()     {
               public void windowClosing(WindowEvent e) {
                    System.exit(0);
          clb = new ClassB(this);
          createFrame();
     private void createFrame() {
          setSize(300, 200);
          Button b = new Button("OK");
          b.addActionListener(this);
          add(b);
          show();
     public void actionPerformed(ActionEvent ae) {
          clb.frame2();
     public static void main(String args[]) {
          new ClassA();
     private ClassB clb;
class ClassB extends Frame implements ActionListener
     ClassA cla;
     public ClassB(ClassA passed) {
          cla = passed;
     void frame2() {
          setTitle("ClassB");
          setSize(300, 200);
          setLocation(300, 200);
          cla.setVisible(false);
          Button b = new Button("OK");
          b.addActionListener(this);
          add(b);
          show();
     public void actionPerformed(ActionEvent ae) {
          setVisible(false);
          cla.setVisible(true);
          return;
}These two classes each display a single button. When one is clicked, its frame becomes invisible and the other frame appears.
Mark

Similar Messages

  • Use HTTP Session to pass Object from Web Dynpro for Java to JSP page

    Is it possible to get a handle on the HTTP Session object from within a Web Dynpro application? I want to place a Java object in there that can be retrieved by a JSP page.
    Thanks in advance.

    Hi Tom Cole,
       You can try this. i am not sure if this will work or not.
    HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
    You can also try this.
    IWDRequest mm_request = WDProtocolAdapter.getProtocolAdapter().getRequestObject();
    HttpServletRequest request = (HttpServletRequest)mm_request.getProtocolRequest();
    IWDRequest basically wraps the HttpServletRequest. if you are using NW04s then the getProtocolRequest() may not be available.
    Regards,
    Sanyev

  • Hopefully easy question that I can't for the life of me figure out

    I accidentally removed the ethernet pane in the network panel of system prefs.
    Now, when I click the button to add it back, it gives me the option for "ethernet 2," implying the first one is still…something.
    How to I just get that default panel back?
    More specifically, is there a way I can just reset my network prefs to default?
    thanks, hope to hear.
    -Griffin Wade

    Create it as Ethernet 2, then rename it via the action button next to the plus & minus signs.

  • Error in "Wait for event" step

    Hi,
    I try to use a wait for an event (CREATED) on a delegated subtype to business object KNB1.
    Container element in the wait step is empty at the time of creation of the runtime wait item but I know what the key of the container element has to be so my idea was to set in a check funktion module in trx. SWEINST and filter out irrelevant events.
    But when the waitstep is to be created, the workflow goes into error: WL 442 No valid object for the container element.
    Should this not be possible?
    Any suggestions for another solution?
    I have also tried to instantiate the object before the wait for event step - but since the object does not exist in the database yet - method GENERIC.INSTANTIATE goes in error, too.
    WAS 700 sp 11 with ERP 6.0 but also tried on a 620 with 4.7
    Thanks,
    Regards,
    Claus Lücking

    Hi Mark,
    Yes, you are right - I am waiting for an event on a object not yet created:
    I am waiting for a customer to be created in FI via change documents (table KNB1). Since the customer is going to be created in a company code that has a one-to-one reference to the sales organization where it is created first, I know the key of FI customer to be created.
    Example: A Customer 23 is created in sales area 1000-01-01 and the workflow is triggered via an event KNVV.CREATED. Then I would like to wait for event KNB1.CREATED for customer 23 in company code 1000.
    Thanks,
    Claus.

  • How to get a method to call the correct passed object in the constructor

    I have 2 constructors for a certain object:
    public class ABC{
    //variables
    private DEF def;
    private GHI ghi;
    public ABC(DEF def){
    this.def = def;
    someMethod();
    public ABC(GHI ghi){
    this.ghi = ghi;
    someMethod();
    }Now, this someMethod() references / calls a method from the 2 classes passed in the constructor say def.getSome() and ghi.getSome().
    Depending on which constructor is used, it should call the respective xxx.getSome(). Do I need to write 2 someMethod()s or is there a way that one method will call the proper xxx.getSome() ?
    Thanks.....

    Hi
    Following the example may be help to you call correct method,
    // Interface QuizMaster
    public interface QuizMaster {
         public String popQuestion();
    // Class StrutsQuizMaster
    public class StrutsQuizMaster implements QuizMaster{
         public String popQuestion() {
              return "Are you new to Struts?";
    // Class SpringQuizMaster
    public class SpringQuizMaster implements QuizMaster{
         public String popQuestion() {
              return "Are you new to Spring?";
    // Class QuizMasterService
    public class QuizMasterService {
         QuizMaster quizMaster;
         public QuizMasterService(SpringQuizMaster quizMaster){
              this.quizMaster = quizMaster;
         public QuizMasterService(StrutsQuizMaster quizMaster){
              this.quizMaster = quizMaster;
         public void askQuestion()
              System.out.println(quizMaster.popQuestion());
    // QuizProgram
    public class QuizProgram {
         public static void main(String[] args) {
              // Option : 1
    // StrutsQuizMaster quizMaster = new StrutsQuizMaster();
    // Option : 2
    SpringQuizMaster quizMaster = new SpringQuizMaster();
              QuizMasterService quizMasterService = new QuizMasterService(quizMaster);                    
              quizMasterService.askQuestion();
    here you can create object of StrutsQuizMaster or SpringQuizMaster and pass into the QuizMasterService object constructor, base on the object correct method will be called.

  • So i got the update on my ipod touch 5th gen and when i got it it asked me for my old itunes acount and password, except i no longer have that info for the back up and it wont let me by pass at all, i need a way to just restart it

    so i got the update on my ipod touch 5th gen and i got asked me for my old itunes acount and password so i can get the back up from icloud, except i no longer have that info for the back up and it wont let me by pass at all, i need a way to just restart it

    You need to recovery and use it. Sounds like you are running into:
    iCloud: Find My iPhone Activation Lock in iOS 7
    Is there a way to find my Apple ID Name if I can't remember it?
    Yes. Visit My Apple ID and click Find your Apple ID. See Finding your Apple ID if you'd like more information.
    How do I change or recover a forgotten Apple ID Password?
    If you've forgotten your Apple ID Password or want to change it, go to My Apple ID and follow the instructions. SeeChanging your Apple ID password if you'd like more information.

  • Need for implementing Objects By Filter (OBF) method in ACE

    Hi All,
    i wanted to understand the significance of the OBF method in ACE. Can i implement my logic only using Actor from User (AFU) and Actor from objects (AFO). Does it impact the performace if OBF is not implemented. Please provide you inputs on this.
    Regards,
    Sudha

    Hi Nithish.,
    Thanks for explanation. Yes i understood the purpose of OBF. Let me tyr explain my doubt with an example.
    I have to determine acces for one-order objects having a specific custom  transaction type say ZABC.
    In OBF i will fetch all the one order objects where the transaction type is ZABC. This output of OBF will serve as input to my AFO.
    In AFO, i willl again fetch the same objects. I will loop through the output of OBF method for every object and check if the object fetched in AFO is present in output table of OBF. If yes then proceed further in determinig the actor for that objec. Repeat this process in a loop for every object in OBF.
    If my above understanding is correct, what is need for having specific  OBF method when I can directly write the logic of fetching one order object of transaction type ZABC in my AFO and dertermine the actors for them. without having to loop thourgh the outpu of OBF.
    Regards,
    Sudha

  • What User authorization objects needed for connecting to SAP from xMII?

    We eneter a SAP user and password for connecting to SAP from xMII to retrieve the metadata of the incoming IDocs.
    When I specify a user with SAP_ALL user profiles, the IDocs are received properly in xMII. If I specify a user with privileges to run only certain transactions, IDocs are not received in xMII.
    What user authorization objects are needed for this user to connect to SAP from xMII?
    Thanks,
    Sara

    Sam,
    I turned on the SAP System trace for this user and figured out the following auth. objects are required for receiving IDocs in xMII:
    C_TCLA_BKA
    S_RFC
    S_CTS_ADMI
    B_ALE_MAST
    S_IDOCDEFT
    The following auth. object is required for making JCO call to SAP from xMII:
    C_AFRU_AWK
    Thanks,
    Sara

  • What is the need for calling default constructor by JVM?

    What is the need for calling default constructor by JVM? why the JVM should intiializes default values to the data
    fields if the constructor is not there in our class?

    mahar wrote:
    What is the need for calling default constructor by JVM? Huh? The JVM does not need to call the default constructor. It needs to call a constructor.
    You decide which one by the way you use "new".
    why the JVM should initialize default values to the data fieldsHuh?
    ... if the constructor is not there in our class?Huh? The default constructor is always there. It may be private but it is still there.

  • Close reference needed for step object reference open? If so, how?

    Hello,
    We are using an activex method call to open an object reference to a step and programatically rename it.  This is done many many times during our test run, thousands.  We ran into an "out of memory" problem we had never seen before during a 72 hour test run, and in hunting down any possible memory leaks, I am wondering if a corresponding close is needed for the step reference open we are doing, and how.  I have hunted around the different methods/properties, and can't seem to find if there is a step reference close.  I have attached the specify module screen of the activex call which opens the step reference.
    Thanks for any replies
    David Jenkinson
    Message Edited by david_jenkinson on 06-11-2007 05:07 PM
    Attachments:
    step reference specify module.png ‏25 KB

    Hi David,
    Setting a reference to nothing in TestStand will close it. However, if you are assigning a new value to the local it also frees the memory associated with the original value, making it so you don't need to assign it to nothing. I don't believe the source of the leak is in this step.
    Test Engineer - CTA

  • I am thinking of buying a iPad but my main desktop machine uses Windows 7 and MS Office.  How easy or difficult is it to transfer data files between the iPad and Windows?  Are there obvious problems or the need for some form of conversion programs?

    I am thinking of buying a iPad but my main desktop machine uses Windows 7 and MS Office.  How easy or difficult is it to transfer data files between the iPad and Windows?  Are there obvious problems or the need for some form of conversion programs?
    Many thanks for any advice.
    David

    You don't need conversion programs, iTunes can copy most of your content over to the iPad via the file sharing section, and some apps also support Dropbox, email attachments, transfer via your wifi network. There are a number of apps that you can get that support Microsoft office file (microsoft don't make an app versions of their software) e.g. from Apple there are Pages (word support), Numbers (excel) and Keynote (powerpoint), and from third-parties there are apps such as Documents To Go and QuickOffice HD

  • What privileges needed for producing explain plan for other user's object ?

    Hi there,
    What privileges needed for producing explain plan for other user's object (tables) ?
    Cheers
    Soheil

    Experiment: (public plan table exists)
    create user bob identified by bob;
    grant create session to bob;
    connect bob/bob
    start sample_plan
    If will error off on the table being read in the plan
    connect dba_or_privileged_user
    grant select on the referenced_table(s) to bob;
    connect bob/bob
    start sample_plan
    It will now work providing a public plan table exists or you give bob create table and create a bob.plan_table
    I ran the experiment on Oracle version 9.2.0.6 running on AIX 5.3. Select privilege on all referenced tables in the explained SQL must exist
    HTH -- Mark D Powell --

  • Passing object as parameter in JSF using h:commandLink tag

    Hi ,
    I have a scenario in which i need to pass objects from one jsp to another using h:commandLink. i read balusC article "Communication in JSF" and found a basic idea of achieving it. Thanks to BalusC for the wonderful article. But i am not fully clear on the concepts and the code is giving some error. The code i have is
    My JSP:
    This commandlink is inside a <h:column> tag of <h:dataTable>
    <h:commandLink id="ol3"action="ManageAccount" actionListener="#{admincontroller.action}" >
                   <f:param id="ag" name="account" value="#{admincontroller.account}" />
                   <h:outputText id="ot3" value="Manage Account" rendered="#{adminbean.productList!=null}" />
                   </h:commandLink>
    Also a binding in h:dataTable tag with the  binding="#{admincontroller.dataTable}"
                      My Backing Bean:
    public class CompanyAdminController {
              private HtmlDataTable dataTable;
              private Account account=new Account();
    public HtmlDataTable getDataTable() {
            return dataTable;
    public Account getAccount() {
             return this.account;
    public void setAccount(Account account) {
              this.account = account;
          public void action(){
                account= (Account)this.getDataTable().getRowData();
           } faces-config.xml
    <navigation-rule>
        <from-view-id>/compadmin.jsp</from-view-id>
        <navigation-case>
          <from-outcome>ManageAccount</from-outcome>
          <to-view-id>/manageAccount.jsp</to-view-id>
        </navigation-case>
      </navigation-rule>
    <managed-bean>
              <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.forrester.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>account</property-name>
                   <property-class>com.model.Account</property-class>
                   <value>#{param.account}</value>
             </managed-property>
         </managed-bean>My account object:
    public class Account {
    string name;
      public String getName()
        return this.name;
      public void setName(String name)
           this.name=name;
      }I need to display #{admincontroller.account.name} in my forwarded jsp. But I am not sure whether the code i wrote in commandlink is correct. I get an error if i use <f:setActionListener> . No tag "setPropertyActionListener" defined in tag library imported with prefix "f"
    Please advise.
    Edited by: twisai on Oct 18, 2009 11:46 AM
    Edited by: twisai on Oct 18, 2009 11:47 AM
    Edited by: twisai on Oct 18, 2009 11:48 AM

    Yes.. iam removed the managedproperty from faces-config. But still i get the null pointer exception on main jsp itself and i am taken to second jsp manageaccount.jsp. Did you find anything wrong in my navigation case in the action method??
                                     public String loadAccount(){
               Account account = (Account)this.getDataTable().getRowData();
                return "ManageAcct";And also can you please answer this question i have
    The AdminController is the backing bean of 1st JSP and manageAccontController is the backing bean of forwarded JSP .
    Can i put this action method and dataTable binding in a 2nd manageAccontController backing bean instead of AdminController. But if i do that way dataList binding in h:dataTable tag will be in first JSP backing bean and dataTable binding to 2nd JSP. Not sure how to deal with this.
    {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Is There an Easier Way to Save a PDF for Perfect Binding?

    I've always had this problem whenever I do a booklet or magazine that will end up perfect bound: I have my document setup in CS6 with "facing pages" so I can easily design spreads with images and backgrounds that span both pages. Usually, when it prints, it's saddle stitched, so I don't mind if the inside edge has contents from the other page since they will print next to each other anyway. When I've done perfect bound booklets in the past, I've always unchecked "facing pages" and manually duplicated and moved the image that span the entire spread to cover both pages. However, I'm currently working on a 48-page magazine and I really don't feel like doing this... specifically for fear of missing something and overlooking it so that it prints wrong.
    Here are some examples:
    This first one obviously has one background image that spans both pages of the spread
    However, when I try to separate the pages. My same right-hand page now has no background. A good majority of the magazine is laid out this way.
    Similarly, this spread with 2 full-page ads have no bleed on the inside margin for proofing purposes. If it were saddle stitched, I wouldn't give a second thought I'd just let the auto bleed pull image from the other ad. Who cares? They're going to be right next to each other anyway. But, since we're going the perfect-bound route, I need for each ad to have full bleed on all 4 sides. Is it just my neuroticism? The inside edge will be glued amongst 47 other pages. Will anyone ever notice that sliver of white, black, and red from the Sarge ad nestled in the spine when they're viewing the Sunrise Detox ad is the cutting is off?
    I know you can do the "shuffle pages" thing to help with the ads, but I'm just hoping there's an easier way; a checkbox... something! C'mon, Adobe! You're #1 in the design industry and it's so difficult to work around the facing-pages-full-bleed issue. I know I'm not very advanced with my InDesign experience. But if after several years, many booklets, a few magazines, and a couple version upgrades, I'd like to think I would've found an easier way to do this. You know, kinda like how your new liquid pages features. That would be tremendous if something similar could be implemented for people in printing to quickly change between design spreads, proof spreads, and printing single pages!
    Thanks in advance for any help!!
    ~Coral

    If you have facing pages, you have to set up the document with facing pages that is what is it for. If you have a spreadwide design as above, keep the spreads together. There is not even one reason not to do so.
    Only for wire-O-bindings might a different workflow useful, but also with facing pages documents and only when the left page and the right page have not a spread wide design:
    //// I did one mistake, I created a doument with a right binding, but it would work the same way with left binding.)
    1. Create a document with Facing Pages.
    2. Select the Spread in the Page Panel (Window > Page Panel) and in the panel’s flyout menu deselect "Allow Selected Spread to Shuffle". The spread’s page number will appear in brackets.
    3. Select a single page of the spread and drag it to the side until a vertical bar appears.
    4. Now you have the result.
    Left and right pages have their own spread and will have a bleed around each page without taking information from the other page.

  • Memory leak problem while passing Object to stored procedure from C++ code

    Hi,
    I am facing memory leak problem while passing object to oracle stored procedure from C++ code.Here I am writing brief description of the code :
    1) created objects in oracle with the help of "create or replace type as objects"
    2) generated C++ classes corresponding to oracle objects with the help of OTT utility.
    3) Instantiating classes in C++ code and assigning values.
    4) calling oracle stored procedure and setting object in statement with the help of setObject function.
    5) deleted objects.
    this is all I am doing ,and getting memory leak , if you need the sample code then please write your e-mail id , so that I can attach files in reply.
    TIA
    Jagendra

    just to correct my previous reply , adding delete statement
    Hi,
    I am using oracle 10.2.0.1 and compiling the code with Sun Studio 11, following is the brief dicription of my code :
    1) create oracle object :
    create or replace type TEST_OBJECT as object
    ( field1 number(10),
    field2 number(10),
    field3 number(10) )
    2) create table :
    create table TEST_TABLE (
    f1 number(10),f2 number (10),f3 number (10))
    3) create procedure :
    CREATE OR REPLACE PROCEDURE testProc
    data IN test_object)
    IS
    BEGIN
    insert into TEST_TABLE( f1,f2,f3) values ( data.field1,data.field2,data.field3);
    commit;
    end;
    4) generate C++ classes along with map file for database object TEST_OBJECT by using Oracle OTT Utility
    5) C++ code :
    // include OTT generate files here and other required header files
    int main()
    int x = 0;
    int y = 0;
    int z =0;
    Environment *env = Environment::createEnvironment(Environment::DEFAULT);
    Connection* const pConn =
    env->createConnection"stmprf","stmprf","spwtrgt3nms");
    const string sqlStmt("BEGIN testProc(:1) END;");
    Statement * pStmt = pConn->createStatement(sqlStmt);
    while(1)
    TEST_OBJECT* pObj = new TEST_OBJECT();
    pObj->field1 = x++;
    pObj->field2 = y++;
    pObj->field3 = z++;
    pStmt->setObject(1,pObj);
    pStmt->executeUpdate();
    pConn->commit();
    delete pObj;
    }

Maybe you are looking for

  • Password protected PDF files not opening in Android

    Hi I was trying to open my credit card statement on my Android Galaxy S2 I9100 phone. Although it looks like that the Adobe reader 10.0.2 version (Build 40862) is capable of opening  Password protected files but I got an error "The document cannot be

  • Can't edit HTML snippets

    Hello there, This is around the third time I ask about this issue. I installed Leopard with iLife '08, and later (after I started having the problem) installed iLife '09. What happens is, when I try to add an HTML snippet, I am presented with a blank

  • PAR files need to be used

    hi can anyone specify the PAR files that need to be modified to customize the registration page thanks in advance regards yoga

  • Cannot launch application to open a file from jdev extension

    Hello: I use the following code to let my application to open a file: String[] cmd = new String[3]; cmd[0] = "cmd.exe" ; cmd[1] = "/C" ; cmd[2] = "myfile.pdf; Process p = Runtime.getRuntime().exec(cmd); p.waitFor(); It worked fine if it was in a main

  • CSS 11501: NAT all ports?

    Hi, I have just a little experience with a CSS 11501, so this may be a dumb question. I created a service and content rule for a FTP server behind the CSS. This works fine, the public address is translated to the private address etc. But what i reall