Passing parameter between jpanel and jframe

Hi guys,
First time posting, so please be nice! :p
Basically, the problem i'm having:
I have created a JFrame class, which adds some JPanels to itself to start with (basic layout stuff).
This JFrame is created and instantiated in main.java, and just displays the basic stuff that i've added.
On the JFrame are a number of JButtons, and when you click on the JButton each JButton it adds a custom JPanel to the main JFrame. Basically, it provides an easy way to produce a kind of menu system using the JPanels.
The problem i have, is that each time a textbox is clicked inside one of the custom JPanels, i want it to pass the name of the textbox and jpanel back to a method setLastTextBox() in the JFrame class.
I tried:
private void jTextPane1FocusGained(java.awt.event.FocusEvent evt) {
    super.setLastTextBox()
}But super. is not the correct call. I'm sure its something pretty simple but i can't think what it is, and i tried googling it to no avail.
I would be extremely greatful if someone could put me back on the right path!
Thanks,
--Mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Hi, Mark
I hope I understood you rihgt.
I think that you should add Focus Listeners to the text boxes, rather than panels and create a method setLastTextBox(String panelName, String textBoxName)
and just write something like that
textField1.addFocusListener(new FocusAdapter(){
            public void focusGained(FocusEvent e) {
                String textFieldName = ((JTextField)e.getSource()).getName();
                String panelName = ((JTextField)e.getSource()).getParent().getName();
                 setLastTextBox(textFieldName, panelName);
        });    that is if you write this code inside your frame class
otherwise you can get to your frame, by calling the method getParent() and checking its class until its not YourFrameClass (or JFrame) and then just cast it and call the method.
I hope I was clear
Ksenia

Similar Messages

  • Passing parameter between two applets

    hi all,
    i want to pass parameter between two applets. in other words, when user clicks the button; close the running applet, pass parameter to another applet and run another applet.
    now i think that could be, ( creating a parameter table in database, when user click on button write parameters to table and stop active applet and run other applet. when other applet runs in init methot it takes parameter from table). but it will be very indirect way.
    if you have an idea or information, plesae tell me.
    thanks for your interest

    Hi ,
    Plz pay a visit to this wonderful website,
    http://www.rgagnon.com/javadetails/java-0022.html / http://www.rgagnon.com/howto.html
    Best Wishes,
    Gaurav
    PS : Thanks to Real Gagnon. This is all I can do at this stage, but wanted to say you are doing a wonderful job.

  • Passing Parameter between Methods

    I have some problems because i don't really know how to pass parameter between methods in a java class.
    How can i do that? below is the code that i did.
    I want to pass in the parameter from a method called dbTest where this method will run StringTokenizer to capture the input from a text file then it will run storeData method whereby later it will then store into the database.
    How can i pass data between this two methods whereby i want to read from text file then take the value to be passed into the database to be stored?
    Thanks alot
    package com;
    import java.io.*;
    import java.util.*;
    import com.db4o.ObjectContainer;
    import com.db4o.Db4o;
    import com.db4o.ObjectSet;
      class TokenTest {
           private final static String filename = "C:\\TokenTest.yap";
           public String fname;
         public static void main (String[] args) {
              new File(filename).delete();
              ObjectContainer db=Db4o.openFile(filename);
         try {
            String fname;
            String lname;
            String city;
            String state;
             dbStore();
            storeData();
         finally {
              db.close();
         public String dbTest() {
            DataInputStream dis = null;
            String dbRecord = null;
            try {
               File f = new File("c:\\abc.txt");
               FileReader fis = new FileReader(f);
               BufferedReader bis = new BufferedReader(fis);
               // read the first record of the database
             while ( (dbRecord = bis.readLine()) != null) {
                  StringTokenizer st = new StringTokenizer(dbRecord, "|");
                  String fname = st.nextToken();
                  String lname = st.nextToken();
                  String city  = st.nextToken();
                  String state = st.nextToken();
                  System.out.println("First Name:  " + fname);
                  System.out.println("Last Name:   " + lname);
                  System.out.println("City:        " + city);
                  System.out.println("State:       " + state + "\n");
            } catch (IOException e) {
               // catch io errors from FileInputStream or readLine()
               System.out.println("Uh oh, got an IOException error: " + e.getMessage());
            } finally {
               // if the file opened okay, make sure we close it
               if (dis != null) {
                  try {
                     dis.close();
                  } catch (IOException ioe) {
                     System.out.println("IOException error trying to close the file: " +
                                        ioe.getMessage());
               } // end if
            } // end finally
            return fname;
         } // end dbTest
         public void storeData ()
              new File(filename).delete();
              ObjectContainer db = Db4o.openFile(filename);
              //Add data to the database
              TokenTest tk = new TokenTest();
              String fNme = tk.dbTest();
              db.set(tk);
        //     try {
                  //open database file - database represented by ObjectContainer
        //          File filename = new File("c:\\abc.yap");
        //          ObjectContainer object = new ObjectContainer();
        //          while ((dbRecord = bis.readLine() !=null))
        //          db.set(fname);
        //          db.set(lname);
        //          db.set(city);
            //          db.set(state);
    } // end class
         Message was edited by:
    erickh

    In a nutshell, you don't "pass" parameters. You simply call methods with whatever parameters they take. So, methods can call methods, which can call other methods, using the parameters in question. Hope that makes sense.

  • Use context to pass value between JPF and Java Control

    hi,
    Can we use context to pass value between JPF and Java Control? It works if i m using InitialContext in the same machine but i dun think it will works if i put Web server and application server in different machine. Anyone have an idea how to do it?
    I also want to get the method name in the onAcquire callback method. Anyone knows how to do this?
    thks
    ?:|

    Hi.
    Yoy can the next options for make this:
    1. Pass your values in http request.
    example: http://localhost/index.jsp?var1=value1&var2=value2&var3....
    2. You can use a no visible frame (of height or width 0) and keep your variables and values there using Javascript, but of this form, single you will be able to check the values in the part client, not in the server. Of this form, the values of vars are not visible from the user in the navigation bar.
    Greeting.

  • Passing values between jsp and php

    hi there, is it possible to pass values between jsp and
    php? i really need to find out the way if there is
    any. thanks in advance
    -azali-

    Yes, there are a few ways to do this.
    1) Think about using Cookies.
    2) Maybe use a Redirect passing the values in the Query string.
    3) Retain the data in a repository in the back end.
    4) Using Hidden fields within your pages.
    I am sure you can use these Idea's for a base to develop other methods on how to pass values back and forth from JSP -> PHP and vice versa.
    -Richard Burton

  • Pass parameter between programs

    Hi,
    I need to pass one parameter between 3 programs :
    That is the actual flow of my parameter.
    SAPF110V -> RFFOBE_I -> which include ZRFFORI99B)
    get param   <- RFFOBE_I <- set param
    with statments
    SET PARAMETER ID 'ZDBL' FIELD p_doublon.
    GET parameter ID 'ZDBL' FIELD p_doublons.
    But unfortunatly it doesn't work :/  (value of my param = 0)
    I can run the include program in debug because it is run in background...
    I can't use a Ztable
    Any idea to pass value between this flow ?
    Thanks,

    Hello,
    The value which you want to pass between the programs can be stored in the SAP memory space by using the IMPORT and EXPORT to MEMORY ID statement.
    EXPORT <internal table/variable> to MEMORY-ID 'MY MEMORY'.
    Above statement will keep the value in SAP memory by creating a memory named as 'MY MEMORY'.
    IMPORT <internal table/variable> from MEMORY-ID 'MY MEMORY'.
    Above statement will get the value from SAP memory space.
    But while using the above statement please consider that all the three programs should be run in the same session because the Memory that you are using will automatically be cleaned up by the Garbage collector as the session ends.
    Hope it helps.
    Thanks,
    Jayant.
    <<text removed - don't ask for points>>
    Edited by: Matt on Nov 19, 2008 7:48 PM

  • Using Go URL to Pass parameter between dashboard

    Hi All,
    I am trying to pass parameter using GO URL functionality from one dashboard analysis field to another dashboard.
    The navigation is working properly but the parameter is not getting passed, I am not sure why.
    The Called dashboard has a analysis which has IS PROMPTED filter attached to it for the passing filter. I tried various ways to make this work
    Option 1
    In the calling analysis, I am using a Narrative View and inside I have used the below code.
    <a href="saw.dll?Go&Path=/shared/MI/_portal/Client-MI&Page=Supplier%20Detail%20Tab&Action=Navigate&P0=1&P1=eq&P2=Dim%20Supplier.Supplier%20Name%20Current&P3=1+%22STR%20LTD%22"> @2[br/]
    This one navigate but filtering is not happening
    Option 2 (My first preference will be this option)
    Also I tried to provide custom Data Format under the column Properties
    [html]"<font class="nav" onclick=\"JavaScript:GoNav(event, '/shared/MI/_portal/Client-MI/Supplier Detail Tab','Dim Supplier','Supplier Name Current','"@"');\">"@"</font>
    This ends up giving error
    Type mismatch of catalog object /shared/MI/_portal/Client-MI/Supplier Detail Tab -- expected , got .
      Error Details
    Error Codes: UVWDR6UA 
    Also, both the tabs (Called and Calling are under the same Dashboard)
    Can anyone please let me know, were I am making mistake. I tried refereeing Oracle documentation but still no result.
    Thanks

    Looks like you've got it almost right - just an extra unneeded "
    <a href="two.jsp"?ant=<%= ant %>"><%=antName%></a>
    which should render on the page as something like
    My Ant Task
    When you click the link, it should pass that parameter, and you can get it via request.getParameter().

  • Portlet event link to pass parameter between portlets

    Ok list, I followed the documentation Adding Parameters and Events to Portlets
    PDK Release 2 (9.0.2 and later) and tried to make a portlet that pass parameter to another portlet using event link. I created the supposed parameter in the page and made the correct association to the receiving parameter portlet. The case is: The parameter is not caught in the receiving parameter page.
    This is my event link jsp code:
    <%
    String sImgPath = PropertiesReader.getProperty(PropertiesReader.KEY_IMAGES_PATH);
    PortletRenderRequest portletRequest = (PortletRenderRequest)request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    // The portlet definition in provider.xml includes the following:
    // - Event "submit" with event parameters "funcionalidade"
    String eventSubmit = EventUtils.eventName("submit");
    String eventParamFuncionalidade = EventUtils.eventParameter("funcionalidade");
    // Build up the list of parameters for the "submit" event
    NameValuePair[] eventSubmitParams = new NameValuePair[2];
    // Give the 'funcionalidade' event parameter the constant value 'chat'
    eventSubmitParams[0] = new NameValuePair(eventParamFuncionalidade, "chat");
    // The event name must be passed as a parameter on the URL
    eventSubmitParams[1] = new NameValuePair(eventSubmit, "");
    %>
    <TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0">
    <TR><TD><a href="<%=PortletRendererUtil.constructLink(portletRequest,   portletRequest.getRenderContext().getEventURL(), eventSubmitParams, true, true)%>"><IMG SRC="<%= sImgPath + "menuButChat.gif" %>" BORDER="0"></a></TD><TR>
    </TRABLE>
    And this is my receiving parameter jsp code:
    <%
    String sFuncionalidade = "";
    PortletRenderRequest portletRequest = (PortletRenderRequest)request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    // Get the portlet definition - needed to get the public portlet parameters
    PortletDefinition portlet = portletRequest.getPortletDefinition();
    // Get the public portlet parameters
    ParameterDefinition[] parameters = portlet.getInputParameters();
    // Display all values for each of the public portlet parameters
    for (int currParameter = 0; currParameter < parameters.length; currParameter++)
    String name = parameters[currParameter].getName();
    out.println(" <p>name = " + name + "</p> ");
    // Get the parameter values
    String[] values = portletRequest.getParameterValues(name);
    // Display the parameter's values.
    if ( values == null )
    // Null array indicates no values for this parameter.
    out.println(" <p>values i null</p> ");
    else
    out.println(" values nco i null ");
    // Loop through each of the values and display non-null values on a separate line.
    for ( int j = 0; (values != null) && (j < values.length); j++ )
    sFuncionalidade = values[j];
    out.println(" <p>" + sFuncionalidade + "</p> ");
    %>
    And this is my portlet definition in provider.xml:
    <portlet class="oracle.portal.provider.v2.DefaultPortletDefinition">
    <id>3</id>
    <name>MenuColaboracao</name>
    <title>Menu de Colaboragco</title>
    <shortTitle>Menu de Colaboragco</shortTitle>
    <description>Portlet de menu para funcionalidade de Comuicagco e Colaboragco.</description>
    <timeout>10000</timeout>
    <timeoutMessage>Portlet timed out</timeoutMessage>
    <showEdit>false</showEdit>
    <showEditDefault>false</showEditDefault>
    <showPreview>false</showPreview>
    <showDetails>false</showDetails>
    <hasHelp>false</hasHelp>
    <hasAbout>false</hasAbout>
    <acceptContentType>text/html</acceptContentType>
    <renderer class="oracle.portal.provider.v2.render.RenderManager">
    <renderContainer>false</renderContainer>
    <contentType>text/html</contentType>
    <showPage>/menuColaboracao.jsp</showPage>
    <pageParameterName>next_page</pageParameterName>
    </renderer>
         <event class="oracle.portal.provider.v2.DefaultEventDefinition">
         <name>submit</name>
    <description>Use this event to submit the form data to a page</description>
    <parameter class="oracle.portal.provider.v2.DefaultParameterDefinition">
    <name>funcionalidade</name>
    <displayName>funcionalidade</displayName>
    <description>Parbmetro que indica a funcionalidade a ser apresentada.</description>
    </parameter>
    </event>
    </portlet>
    <portlet class="oracle.portal.provider.v2.DefaultPortletDefinition">
    <id>4</id>
    <name>HomeController</name>
    <title>Home Controller</title>
    <shortTitle>Home Controller</shortTitle>
    <description>Portlet que controla a exibigco do jsp correspondente a opgco de menu selecionada.</description>
    <timeout>10000</timeout>
    <timeoutMessage>Portlet timed out</timeoutMessage>
    <showEdit>false</showEdit>
    <showEditDefault>false</showEditDefault>
    <showPreview>false</showPreview>
    <showDetails>false</showDetails>
    <hasHelp>false</hasHelp>
    <hasAbout>false</hasAbout>
    <acceptContentType>text/html</acceptContentType>
    <renderer class="oracle.portal.provider.v2.render.RenderManager">
    <renderContainer>false</renderContainer>
    <contentType>text/html</contentType>
    <showPage>/homeController.jsp</showPage>
    <pageParameterName>next_page</pageParameterName>
    </renderer>
         <inputParameter class="oracle.portal.provider.v2.DefaultParameterDefinition">
         <name>funcionalidade</name>
    <displayName>funcionalidade</displayName>
    <description>Parbmetro que indica a funcionalidade a ser apresentada.</description>
    </inputParameter>
    </portlet>
    Where do I miss ???
    Any help will be appreciated.
    Regards,
    Leandro.

    Leandro,
    Few things which you might want to cross check to see if we are
    on the right track :
    1. Page containing Parameter receiving portlet contains a
    paga parameter mapped on to its public parameter.
    As per your example, parameter receiving page should have a page
    parameter with name - "funcionalidade" - and portlet's corresponding
    parmeter should be mapped to this page parameter. This can be
    done through "Parameters" tab in the Page Properties screen.
    2. Page containing Parameter passing portlet contains proper event
    mapping.
    As per your example, we have an event called "submit". We should
    be able to see "submit" event under "MenuColaboracao" portlet.
    When this event is raised, select which page should receive the event
    data. As soon as a page is selected, this page's public parameters
    are displayed below. Beside that we must be able to see a choice box
    which displays four choices one of which would be "Event Output".
    Map this output to the event parameter.
    Hope it helps.
    -AMJAD.

  • How to  pass data between JDialog and its parent window ?

    Hi,
    I am new to swing. I want to know how pass data between a JDialog and its parent window.
    If you have any information please reply with example code.
    Thank You

    hi Encephalopathic ,
    I was looking for something like as it was given in the link provided by you.
    Thank you for reply It really helped me.

  • Pass parameter between uix page

    Hi, I am new to JDeveloper UIX technologies. I have created two uix page: page1 is built on a view. Page2 is on a table. How do I pass a parameter (customer_id) from page1 to page2?
    Any help is appreciated. Thanks ahead!

    You can get the sample code for your answer here:
    http://otn.oracle.com/sample_code/products/jdev/index.html
    Download sample code with title:
    Passing values between pages
    Or alternatively your can keep the customer_id in the session during ActionForward then passing back the value into a textbox in page 2.
    Code in ActionForward:
    request.getSession().setAttribute("customer_id", value);
    Code in UIX Page 2:
    <textInput text="${sessionScope.customer_id}" name="code2"/>
    Thanks.
    Alex Cheong

  • How to pass parameters between main and sub vi during parallel execution using the VI server technique?

    Hello All,
    I am working with the following example (from previous postings on this
    board) that demonstrates how to run a sub vi in parallel with the main
    vi.  I'd like to pass parameters between the main and sub such as
    the control (delay) and indicator (value) parameters of my subvi
    example.  Does any one know how to do this?  Parallel
    execution is important for me, I cannot just paste the subvi icon into
    my main diagram (two nested while loops...)
    Many thanks,
    Luis
    Message Edited by cascao on 08-16-2005 08:42 PM
    Message Edited by cascao on 08-16-2005 08:42 PM
    Attachments:
    VI_Server_technique.vi ‏32 KB
    SubVI_1.vi ‏19 KB

    cascao wrote:
    Hello All,
    I am working with the following example (from previous postings on this
    board) that demonstrates how to run a sub vi in parallel with the main
    vi.  I'd like to pass parameters between the main and sub such as
    the control (delay) and indicator (value) parameters of my subvi
    example.  Does any one know how to do this?  Parallel
    execution is important for me, I cannot just paste the subvi icon into
    my main diagram (two nested while loops...)
    Many thanks,
    Luis
    Luis, you can use the VI Server methods 'Set Control Value' and 'Get Control Value', as demonstrated in the attached examples.
    -Franz
    Attachments:
    VI Server.zip ‏26 KB

  • Passing parameter between Components

    I have two components in different applications.  One is use to display details to an employee and the other shows a manager a rollup of employee's detail information.  There is a button on each employee in the manager view where the manager can display the employee detail view.  I've part of it working but it is just displaying the loged on user's employee information.  I need help with getting the key across.
    Currently the onInit in the employee controller obtains the user's userid to use as key and does the data inquiry for the detail view.
    I have added the employee window interface controller to the manager component.  The outbound plug on the manager has a parameter on it and I populated it with the employee key.  The inbound plug on the interface contoller has the key -
    How do I get access to this key in the employee detail component? 
    Regards,
    Diane

    Hi Diane,
    I think that a better solution is that you include your component detail in used components in you manager component, with that if you create; atributes, nodes, methods in the interface controller  of your detail controler, you can acces those from your manager controller.
    Regards.

  • Passing parameter spage id and portal language to a report portlet

    Hi,
    how can I pass the page id and portal language to a report portlet so I can filter my query according to that page id and language. See the report query below:
    select <information required> from ana_statistics
    where portal_page = :page_parameter
    and language = :portal_language
    Thanks

    Yes, you can.
    Here is an example.
    Form: on scott.emp table.
    Define the On successful submission of a form as
    go('http://<server>:<port>/servlet/page?_pageid=<page id>&_dad=<dad>&_schema=<schema>&dept='||p_session.get_value_as_NUMBER(
    p_block_name => p_block_name,
    p_attribute_name => 'A_DEPTNO',
    p_index => 1));
    Report: alos on scott.emp table:
    select * from SCOTT.EMP where DEPTNO = :dept
    and define the "before displaying the page" as
    <portal schema>.wwv_name_value.replace_value(
    l_arg_names,
    l_arg_values,
    p_reference_path||'.dept',
    <portal schema>.wwv_standard_util.string_to_table2(nvl(get_value('dept'),10)));
    Put those two portlets on a page, after you submit the form (after Insert, Update, Delete),
    the page will be refreshed and the deptno will be passed to the report.
    Hope this helps.
    This example was built on portal 309.

  • Passing parameter between OAF pages

    Hi,
    Im calling a custom page from a button destination URI property.
    OA.jsp?page=/oracle/apps/ont/orderstatus/webui/INT_SUMM_PAGE&HeaderId={!HeaderId}&retainAM=Y&addBreadCrumb=Y
    When I use {!HeaderId}, null value is passed
    When I use {@HeaderId}, '@HeaderId' is passed as such.
    What is the difference between two formats?

    When you specify URL parameters in your declarative page definitions, you can specify both literal and token-substituted values that obtain their data from associated view object attributes at rendering time
    {!Attr} - encrypts the attribute value while leaving the {!} in the URL (for example, OA.jsp?...&ssn={!SSN}&...). Using OAPageContext.getParameter("ssn") will return the decrypted value.
    {@Attr} - encodes the attribute value while leaving the {@} in the URL (for example, OA.jsp?...&addr={@EmpAdd}&...). Using OAPageContext.getParameter("addr") to get the parameter value will return the decoded value.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Passing parameter between JSF pages

    I need to pass a parameter value between 2 different JSF pages.
    The reason I need to do this is to be able to know which JavaBean (A or B) called the other JavaBean (C).
    Can I somehow set a parameter within the JSF page and retrieve it in the second JSF page for my backing bean to read?
    Thanks in advance.

    A co-worker of mine helped me fix my code to make it work!
    Here is the final solution in case someone else needs to do the same thing in the future:
    In the main JSF page that calls the second JSF page, the following code was added at the beginning of the page in the JavaScript section:
    <% session.setAttribute"className", "CcmReassignEmployeeBean");
    And in the Backing Bean of the second JSF page, the following code was used in the action listener used to transfer the data:
    HttpSession session = (HttpSession) context.getExternalContext().getSession(true);
    String className=(String) session.getAttribute("className");
    It works great! Thanks!

Maybe you are looking for

  • Can I install windows 8 on my iMac so all drivers work?

    Puedo instalar windows 8 en mi imac para que funcionen todos los drivers? whit botcamp

  • Imac w/ Intel Power Problems. Help!

    Power went off in my office, computers are connected to a surge protector. iMac's keep crashing. I remove power to the iMac, wait, both computers reboot fully for about 20 minutes and then crash! help!

  • Wow, cheapest I've seen for a ATI 4870!

    http://cgi.ebay.com/GENUINE-Apple-Mac-Pro-ATI-Radeon-HD-4870-Graphics-CardW0QQitemZ250471463734QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item3a51433b36&trksid=p3286.c0.m14 I was thinking of bidding on this because it's so cheap, like very for a genu

  • How to pass pageFlowScope variable value as bind variable for VO

    Hi, I have one fixed lov (not based on datasource), if i select any value in that lov i want to pass this value to a pageFlowScope variable. After this i want to use this value as bind variable for VO. whenever the vo executes thereafter this bind va

  • Impact of Administrative time in Project plan

    Hi, Currently, I am using Project Server 2007. Can you please explain the impact of Administrative time?  We are thinking whether or not they can use the 'Plan Administrative Time' option within Project Server 2007 in order to indicate when they are