Trying to pass parameters between GUI classes and methods

Hi All.
I have been working on a rather large final year project in college and it is getting close to the deadline. It looks as though I need to "tidy up" my code as it contains too many static methods, variables and other bad programming habits. My package consists of many different GUI's and classes. Up until now I have been calling different GUI's with guiName.NameOfMethod. I have been told this is bad practice so I am trying to fix this. Also instead of passing parameters correctly I have been creating static variables in my main class and using them. So for example if one class needed to pass a variable to the other I would first myGlobalVariable = X; in the first class. And then the second class can use this. This is also bad, right?
So I guess im really just looking for a good example or tutorial on how to pass parameters between classes and methods, GUI if possible. Here is an example of how my GUI classes look:
public class anotherGUI extends JFrame implements ActionListener {
        private JTextField a, b, c;
        private JButton button1, button2;
        JPanel p, p1;                   
        public anotherGUI() {
            LayOutAnotherGUI();
            setLocationRelativeTo(DnDMain.pictureArray[a]);
            setTitle("Example");
            setVisible(true);
            pack();     
        private void LayOutAnotherGUI(int c) {
     //GUI is layed out here     
        public void actionPerformed(ActionEvent e) {
            Object source = e.getSource();
            if (source == submit)
                clickOK();
        public void clickOK(){
            //Here is where I have been accessing and modifying static global variables.  (But this needs to change).
public void showanotherGUI() {
        new anotherGUI();
}This is more or less how I have been going about creating my GUI's. These are used as pop ups. The user enters a value and then it is closed.
To be honest I have been able to pass a variable correctly from one class to a GUI class but I have still having difficulty. For example in my code above I can pass the variable into this class but I cannot pass it into clickOK(). An this is where it is needed.
Can anyone please help?
I hope I have explained my problem well.
Thanks in advance.

I dont think that is what I need. An example of what I do in my program is:
I have a main GUI with an array of images. There are a number of other small GUI's that appear for certain functions when the user clicks on an image or does some other function. I am trying to pass a value into the GUI class that is used for the smaller "pop up" GUI. So lets say the user has clicked the image in array[12]. Then a GUI is displayed. I need to pass the integer 12 into this class.
Thanks.

Similar Messages

  • Pass parameters between ViewObject 1 and ViewIOject2

    Hi Guys,
    I'm trying pass 1 of 3 parameters of ViewObject1 to ViewObject2, but i'm not getting. In ViewObject1 have following select :
    ViewObject1
    SELECT customer.NAME,
    customer.ID_MESSAGE
    FROM CUSTOMER customer,
    TYPE_DOCUMENT type_doc
    WHERE type_doc.ID_TYPE_DOCUMENT = customer.ID_TYPE_DOCUMENT
    AND type_doc.DS_TYPE_DOCUMENT = :tpDocument
    AND customer.NR_DOCUMENT = :nrDocument
    In ViewObject2 have following select :
    ViewObject2
    SELECT messsage.ID_MESSAGE,
    message.DESCRIPTION ,
    message.ID_CUSTOMER
    FROM MESSAGE message
    where message.ID_message= :idMessage
    Exists Join between ViewObject1 and ViewObject2 , however would like get value :idMessage of parameter in ViewObject1 and pass to :idMessage of ViewObject2
    Is possible in framework ADF pass values of parameters ViewObject1 exposed that are parameters :tpDocument, :nrDocument, :idMessage, to ViewObject2 ?
    Thanks,

    I would have stored the bind variable value in Model layer session and accessed in the diff VO's. In such a approach testing has to be done for activation/passivation also.
    google will help you about activation/passivation in adf.
    Refer to http://andrejusb.blogspot.in/2012/01/how-to-access-session-scope-in-adf-bc.html

  • Passing vector between java class and jsp page

    Hi,
    I think this is similar to the last post but anyways maybe somebody can help us both out bontyh.....I am getting an error saying undefined variable or class when i try to access a Vector which was returned in a class.
    Anyways anyone got any ideas?

    Maybe if you give some more information...

  • Passing parameters between PL/SQL and DLL

    A DLL function is defined as below:
    control (unsigned char **objlist) (objlist is a void array where the control function put the output values
    What kind of Oracle variable can accept this function ?
    Thanks
    Giuseppe La Franca

    Hi Romesh,
    You can use one of the following options...
    1) Use SQL*Plus variables to have your session exit with
    the return code from the stored procedure.
    Please remember that you can exit session with only integer
    values. You need to map these values in UNIX script
    to determine true or false.
    2) Use DBMS_OUTPUT in the stored procedure to print
    True or False only and use PL/SQL block in UNIX script
    to capture the value.
    3) Make your stored procedure a function and capture the
    output into UNIX variable using SELECT statement.(if no DMLs
    are there)
    Hope this helps,
    Good Luck,
    rajkiran

  • 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 parameters between WDA and Iview URL.

    Hi,
    I've a Iview type URL and I want to passing parameters through of code of my WDA. I Know to call a Iview for code  but I don't know passing parameters. I used this method for call the iview:
    CALL METHOD l_portal_manager->navigate_absolute
    EXPORTING
    navigation_target = path
    navigation_mode = if_wd_portal_integration=>co_show_external.
    (path = roles//....idiview).
    Thanks.

    Look at this thread..
    Re: Get URL Parameter Starting With underscore '_' (_sapwiid)
    <i>*Reward each useful answer</i>
    Raja T

  • OBIEE 11G - Issue passing parameters between two reports

    Hi folks,
    I am struggling to pass parameters between two reports in OBIEE 11G.
    My first report contains the following columns: Rolling Year Type (VCHAR), Year(VCHAR), Month(VCHAR), Cost(Double).
    My second report contains the following columns: Rolling Year Type(VCHAR), Year(VCHAR), Month(VCHAR), Category(VCHAR), Cost(Double).
    My requirement is to pass the Rolling Year Type, Year and Month values from report 1 to report 2.
    On the Month column properties of report 1, I have created an Action Link called 'Drill to Category'. I have clicked on 'Navigate to BI Content' and selected Report 2.
    Then on Report 2, I have included three filters: Rolling Year Type is prompted, Year is prompted, Month is promted.
    When I run the report I always get the following error:
    The specified criteria didn't result in any data. This is often caused by applying filters and/or selections that are too restrictive or that contain incorrect values. Please check your Analysis Filters and try again. The filters currently being applied are shown below.
    When I check the cursor cache, the filter values are correct. Does anybody have any idea why Report 2 does not display?
    When I remove the Month filter, the report works correctly.
    I have since changed the third filter to be Month No and although Report 2 does display, it does not pick up the filter on the Month No.
    I initially thought this may have been a caching issue and so I have disabled BI Server Cache but this does not fix my problem.
    This was never an issue on OBIEE 10G as I found it very easy to navigate between two requests.
    Has anyone else experienced problems with passing parameters between two request in 11G?
    Any help appreciated.
    Thanks
    Gavin

    Hi,
    I once tried this kind of requirement(with dashboard prompts though) and hit at similar issue. I later found out that the problem is with the space in the parameter values. Can you please let me know, if the same is the case with you?
    Suppose the parameter passed is "Jan 2010", but the report on the destination takes the value as "Jan" & "2010". Yes, it kind of split the parameter value to two based on space. I think we can notice the filters the destination report got, by enabling filter view.
    In this case, since you pass only value at a time, could you try placing the parameter value anyway in double quotes? I think the Server then will understand it as one value.
    Thank you,
    Dhar

  • Passing parameters between portlets with in the same page

    Hello,
    I have created a Form and a report. The form allows a user to make some selection values, and then upon submit it passes the selected values to the report to query the database. The results from the query are displayed in a new - seperate - window from the form. Is there anyway to disaply the report results on the same page as the form that called the report? I guess I am trying to have a page with 2 portlets (a form, and a report). I want the user to be able to make a selection from the form portlet and pass that selection to the report portlet within the same page.
    Thanks,
    McKell

    Hi I received this info from an OSS named Mahantesh. I thought it was very helpful information for passing portlet parameters between a form and a report within the same page.
    Please check these steps to pass parameter from form to report:
    This article is based on demo tables EMP and DEPT.
    1. Create a report RPT_DEPT using the query 'Select * from dept where deptno= :deptno'
    2. Create a form FRM_EMP based on EMP table.
    3. Edit the form FRM_EMP => 'Formatting and Validation Options' section => click on DEPTNO field
    => Give the value for the 'Link' (under 'Display options') as 'javascript:runrep()' where runrep is the name<br>
    of javascript function that we are going to create later.
    4. In 'Form text' section, in the 'Footer Text' add the code for the runrep function as follows.
    <script>
    function runrep()
    var formObj = document.forms[0];
    var deptno;
    for (var i=0; i < formObj.length ; i++){
    if (formObj.elements.name == 'FORM_EMP.DEFAULT.DEPTNO.01'){
    //FORM_EMP is the form name
    deptno = formObj.elements[i].value;
    break;
    var url="/portal/page?_pageid=38,1,38_31678:38_31787&_dad=portal&_schema=<br>
    PORTAL&deptno=" + deptno;
    //modify the url according to your environment.<br>
    window.location=url;
    }<br>
    </script>
    5. Modify the URL in the above code with your page url on which form and report portlets have been placed.
    6. Goto Page properties => Parameters tab (Parameters and Events option should have been enabled at Pagegroup level).
    7. Create a page parameter and map it with report portlet parameter.
    8. Now run the page, enter deptno or query the form to get the deptno and click on the link next to deptno field. You should get report with corresponding deptno on the page.

  • Passing several fields to various classes and methods?

    Passing several fields to various classes and methods?
    Hi there.
    I have an application that allows a user to define a configuration and save it.
    The user can edit an existing configuration, add a new one, or delete an existing one.
    Once a configuration is selected the user then starts an application that relies on the selected configuration data. Each configuration holds around 60 fields.
    The configuration information is mixed between integers and strings. Around 25 are hidden from the user, and 35 can be modified by the user. The number of fields is not a fixed amount. For example the configuration contains an email-to list and the list for one configuration can have 1 address, and for another could have 10 addresses.
    I have decided to redesign using the Model View Controller concept. I am creating the model to hold the configuration information. I am trying to decide if I should have single get and set methods for each field or if I should create some kind of Object that holds all of one configuration and pass this back.
    The configuration that is selected does not really require the fields to be sorted in any particular order.
    What would you suggest is a good structure to use to pass the configuration information around?
    I have been using the Properties class with an .ini file that can be read and updated.
    Is this efficient? Doesn�t this impact the speed of processing if I have to read a file every time I want to determine what a particular configuration field is?
    Could I just create a class that reads the profile, stores the configuration information for one specific selected config, and then passes the class back to the calling procedure. This would consolidate all the file reading into one class and after that it is held in memory.
    Would it be better to read the configuration information into a collection of some sort , or a vector and pass this back to calling routine?
    public class MyModel {
         //read information to load the field of
         Private MyConfig selectedConfiguration = new MyConfig;
            Private int     selectedField1 = 0;
            /** Constructor */
         MyModel() {
              // open profile, read profile fields the
              selectedConfiguration.field1 = profileField1;  //assume this is 5
                    selectedConfiguration.field2 = profileField2;  //assume this is 10
              selectedConfiguration.field3 = �Test�;
                    field4ArrayOfStrings  = new String[selectedConfiguration.field1 ]
                                                                 [selectedConfiguration.field2];
              selectedConfiguration.field3ArrayOfStrings [0][0] = �First String�
         public class MyConfig(){
         int field1;
         int field2;
         String field3;
         String[][] field4ArrayOfStrings;
         // more stuff here �.
         // selectedConfiguration
         public void setConfiguration(MyConfig p_config) {
              String selectedConfiguration = p_config;
         public String getConfiguration() {
              return selectedConfiguration;
         //The other option is to have get and set for each field
         public void setField1(int field1) {
              String selectedField1 = field1;
         public String getField1() {
              return selectedField1;
    }Slight correction: reference to field3ArrayOfStrings changed to field4ArrayOfStrings.
    Message was edited by:
    tkman

    johndjr wrote:
    I think the term you want is "cross reference".
    Back in the olden days of green bar paper listings and linker maps they used to be quite common. At least they were where I worked.
    I have not seen any cross references in some time.
    java.lang.Object grr_argh_why_I_oughta_you_dirty_rat; // a pretty cross reference

  • How to pass Parameters between two forms

    im trying to do this but i could not find any way for this.
    can any one help me how can i pass parameters between two forms
    in forms4.5. any help will be appreciated
    thanks.
    null

    Global variables can be used, but you can do what the online help
    says ...
    Parameters are passed to called forms by means of a parameter
    list. A parameter list is a named programmatic construct that is
    simply a list of parameter names (called keys) and their values.
    You can pass parameter values to forms invoked by the built-in
    subprograms CALL_FORM, OPEN_FORM, and NEW_FORM. In addition, you
    can pass parameter values to other Oracle tools with the
    RUN_PRODUCT procedure.
    A parameter you include in a parameter list can be either a text
    parameter or a data parameter. The parameter type determines how
    its value is interpreted.
    Text Parameters The value of a text parameter being passed to a
    called product is a CHAR string that can represent the following:
    n a user-defined form parameter defined in a form invoked
    by the CALL_FORM, OPEN_FORM, or NEW_FORM built-in subprograms
    n a command line or user-defined parameter for a product
    invoked with the RUN_PRODUCT built-in subprogram
    Data Parameters The value of a data parameter being passed to a
    called product is always the name of a record group defined in
    the current form. (A record group is a data structure that
    stores records derived from a query or through programmatic
    assignment.) Data parameters are used to pass data to products
    invoked with the RUN_PRODUCT built-in subprogram. You cannot
    pass data parameters to forms.
    The following table shows the structure of a parameter list that
    contains four parameters:
    Key Paramtype Value
    CITY Text_Parameter 'BOGOTA'
    CATEGORY Text_Parameter 'EXPORTS'
    MULTIPLIER Text_Parameter '.0275'
    NEW_DATA Data_Parameter 'RECORD_GROUP8'
    arun reddy (guest) wrote:
    : im trying to do this but i could not find any way for this.
    : can any one help me how can i pass parameters between two forms
    : in forms4.5. any help will be appreciated
    : thanks.
    null

  • How to pass parameters between two xterm windows?

    Hi,
    I would like to know how to pass parameters between two xterm windows where there are two independence processes running on them respectively ? Would appreciate if any one out there can advise me . Thanks.

    Global variables can be used, but you can do what the online help
    says ...
    Parameters are passed to called forms by means of a parameter
    list. A parameter list is a named programmatic construct that is
    simply a list of parameter names (called keys) and their values.
    You can pass parameter values to forms invoked by the built-in
    subprograms CALL_FORM, OPEN_FORM, and NEW_FORM. In addition, you
    can pass parameter values to other Oracle tools with the
    RUN_PRODUCT procedure.
    A parameter you include in a parameter list can be either a text
    parameter or a data parameter. The parameter type determines how
    its value is interpreted.
    Text Parameters The value of a text parameter being passed to a
    called product is a CHAR string that can represent the following:
    n a user-defined form parameter defined in a form invoked
    by the CALL_FORM, OPEN_FORM, or NEW_FORM built-in subprograms
    n a command line or user-defined parameter for a product
    invoked with the RUN_PRODUCT built-in subprogram
    Data Parameters The value of a data parameter being passed to a
    called product is always the name of a record group defined in
    the current form. (A record group is a data structure that
    stores records derived from a query or through programmatic
    assignment.) Data parameters are used to pass data to products
    invoked with the RUN_PRODUCT built-in subprogram. You cannot
    pass data parameters to forms.
    The following table shows the structure of a parameter list that
    contains four parameters:
    Key Paramtype Value
    CITY Text_Parameter 'BOGOTA'
    CATEGORY Text_Parameter 'EXPORTS'
    MULTIPLIER Text_Parameter '.0275'
    NEW_DATA Data_Parameter 'RECORD_GROUP8'
    arun reddy (guest) wrote:
    : im trying to do this but i could not find any way for this.
    : can any one help me how can i pass parameters between two forms
    : in forms4.5. any help will be appreciated
    : thanks.
    null

  • Passing parameters between views in different Web Dynpro applications

    Hi everyone,
    I would like to pass the value of one parameter between one view in a webdynpro application and another view that is in other webdynpro application. How can I do this in a secure way?

    Hi,
    Check below links for passing parameters between two applications:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b083f76a-708c-2b10-559b-e07c36dc5440
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/91b6ad90-0201-0010-efa3-9626d2685b6e
    Re: Pass parameters via POST in WDPortalNavigation.navigateAbsolute method
    Regards,
    Anagha

  • After upgrading to YOSEMITE, I tried to use Airdrop between my iMac and iPhone 6 Plus but they don't recognize each other. It also didn't recognize my iPad. I need help

    After upgrading to YOSEMITE, I tried to use Airdrop between my iMac and iPhone 6 Plus but they don't recognize each other. It also didn't recognize my iPad.
    Please help!

    After upgrading to YOSEMITE, I tried to use Airdrop between my iMac and iPhone 6 Plus but they don't recognize each other. It also didn't recognize my iPad.
    Please help!

  • How do I reorder songs in a playlist in the new itunes??? I can no longer just click and drag. When I click, it doesn't move!!!! Need help ASAP- trying to prepare for an aerobics class and need songs in a specific order!

    How do I reorder songs in a playlist in the new itunes??? I can no longer just click and drag. When I click, it doesn't move!!!! Need help ASAP- trying to prepare for an aerobics class and need songs in a specific order!

    Vera,
    Use View > View Options, and set 'Sort By" to "Manual Order."
    Then you will be able to drag-n-drop songs up and down the list.

  • What is the difference between document class and normal class

    Hi,
    Please let me know what is the difference between document class and normal class.
    And I have no idea which class should call as document class or call as an object.
    Thanks
    -Actionscript Developer

    the document class is invoked immediately when your swf opens.  the document class must subclass the sprite or movieclip class.
    all other classes are invoked explicitly with code and need not subclass any other class.

Maybe you are looking for

  • Creating a network topology with Darwin

    Hello, here are some questions concerning the neural net module at Darwin. I would be grateful if anyone can answer some of my questions: 1. sensitivity analysis: How is importance/sensitivity of each independent variable to the model measured ? (E.g

  • Imovie 8 project library thumbnails not showing up after import

    I have imovie 8 on my mac at home and I edited some footage and then wanted to bring it into work. I copied all the necessary event libraries and project libraries and I'm having a problem viewing them in my imovie 8 at work. I stored the Event libra

  • Report Ouput in Arabic

    Hi All, I have to develop the report using Bi publisher. client has provided the template . when i run the report, fields are coming in Arabic , where as data is coming in english. kindly suggest me what is approach to get the data in Arabic. Thanks.

  • JSF URL

    The URL with which a JSF JSP gets called in JDeveloper 10.1.3 Preview has a bug. A JSF JSP page gets called with the URL http://<host>:<port>/<context-root>/faces/jsfFile.jspeventhough the JSF JSP(jsfFile.jsp) is not in the faces directory.

  • Need to create user up-dateable site

    I'm going to do a site for a friend who sells Chameleons. He needs to be able to update the pages on his own once I'm done. He doesn't have DW or know anything about web design. I've had clients ask this before and it involved me hiring a coder to cr