Change variable values in a class without acessing it's methods?

I have the following scenery, a main class with:
-ArrayList of strings.
-Class frame (with textfield and button) supposed to add strings to that Array.
Ok, in main class i set the frame to run, but how to make the frame to change the ArrayList of the main class in a easy way? What is the easiest solution and the best without hurting the paradigm?
1-One solution would be to make a method in frame that returns the string and IN MAIN CLASS add it. But is this too straightforward? Like, if i had to manage 7,8 frames that must acess 7, 8 ArrayLists of main class as well as other frames recursively (Example: main class start running frame 1, then if button1 pressed go to frame 2, if button 2 pressed get textfield and chang ArrayList)
2-Another solution would be to set all ArrayLists as static variables so i can change them freely? Is this a good paradigm?
3-Pass the own main class as parameter throughout the frames? Is it possible? If so please post a 10, 15 line code in which i could do that.
4- Put the main class as mother and all frames as son and put all arraylists as protected?
I feel like im lacking one good paradigm, it should exist some concept in which the created object could change the value of the variable passed as parameter in the class that created it.
Thank you very much.

Thank you for your reply Kayaman, but i think you should help me.
I tried to pass a simple variable (a string) as parameter through the constructor to one frame, like any other class.
public class TelaLogin extends javax.swing.JFrame {
String a;
public TelaLogin(String a) {
this.a=a;
initComponents();
But it returns a compilation error, maybe is something in it's main method? I didn't change it:
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TelaLogin().setVisible(true);
The main class has a 'new TelaLogin' that looks very suspicious. Is it that?
This looks very simple.
What must i change here? Please Kayaman help me.

Similar Messages

  • How to change the value of Valuation class.

    dear friends:
    i want to change the value of Valuation class in the material master .but system  warning info occurs .
    The valuation class cannot be changed
    Message no. M3 368
    Diagnosis
    You wanted to change the valuation class. However, this is not possible because one or more of the following already exist for the material:
    Valuated stocks in the current period or in the previous period
    Open purchase orders or delivery schedule lines
    Production orders for which a goods movement has already taken place
    System Response
    Your change is reset by the system.
    Procedure
    If valuated stocks already exist, you can change the valuation class only as follows:
    a) Post the stocks of the material to an interim account.
    b) Change the valuation class in the material master record.
    c) Post the stocks of the material back to their original account.
    If open purchase orders already exist, you can only change the valuation class if you first flag the corresponding purchase order items for deletion.
    If production orders exist for which a goods movement has already taken place, you can only change the valuation class if you first set the status of the production orders to Deleted.
    Procedure for System Administration
    In Customizing for the Material Master, you can switch the check for open purchase orders and/or for production orders to a warning. You do this in Define Attributes of System Messages by assigning the message type Warning to message MM 326 and/or MM 327 respectively. However, first ensure organizationally that further processing of the open purchase orders or production orders cannot result in inconsistencies.

    To resolve SAP error message M3 368 I would suggest that you refer to SAP note number 1967543. This note outlines the issue and a resolution to it:
    Please have a look at the description of the error M3 368. This error may occur if one or more of the following already exist for the material:
    1. Valuated stocks in the current period or in the previous period
    2. Open purchase orders or delivery schedule lines
    3. Production orders for which a goods movement has already taken place
    Resolution:
    If you have valuated stocks in the current period or in the previous period, you will get message "Stocks already exist.". You have to clear all the stocks both in current period and previous period. Please have a look at SAP Note 30656, it shows an example on how to clear the stocks in
    previous period. You can use transaction MIGO to execute this step.
    If you have open purchase orders or delivery schedule lines, you will get message "Purchase orders already exist.". You can find related purchase orders after you click 'Display Error' button. Please delete them in transaction ME22N.
    If you have production orders for which a goods movement has already taken place, you will get message "Production orders already exist.". Please archive these production orders. You need to set deletion flag for these orders firstly and go to SARA, use archiving object PP_ORDER to archive
    these orders.
    Kind regards,
    James

  • How to change variable values ?

    Dear friends,
    How to change variable values when we are broadcasting the Queires ?
    Do we need to change them everytime ?
    Thanks,
    N

    Hi,
    Please go through it.
    /people/ramkumar.ghattamaneni/blog/2008/02/25/using-variables-while-broadcasting-queries-to-the-portal-in-bi-7
    Regards,
    Ramkumar.

  • BEx crashes when changing variable values

    Hi all,
    We're having a problem with BEx.
    It crashes when trying to change variable values.
    We've been looking into syslogs and dev logs and so on,
    and found that the cpic connection has been disconnected
    before the crash. BUT we cannnot find out what is actually
    disconnecting the session.
    Well, at least F/W wasn' the cause. Have check the logs.
    Any ideas? Thx in advance!
    Yuko
    Below is our info.
    BEx: BI 7.10 sp7
    BI: BI 7.0 SAPKW70017
    <BI syslog at the time of BEx crash>
    15:40:36 RD                                 Q0  I Operating system call recv failed (error no. 232 )
    15:40:36 RD                                 S2  3 Connection to CPI-C client 586 was closed
    15:40:36 RD                                 S7  4 > Partner LU name:
    15:40:36 RD                                 S0  R > Host: 172.19.xx.xxx
    15:40:36 RD                                 S0  I > Partner TP Name: EXCEL
    15:40:36 DIA  000 500 BIB103                R4  9 Communication error, CPIC return code 020, SAP return code 223
    15:40:36 DIA  000 500 BIB103                R5  A > Conversation ID: 82142217
    15:40:36 DIA  000 500 BIB103                R6  4 > CPI-C function: CMSEND(SAP)
    <dev_rd log trace level 3>
    GWRD LOOP **********
    I'm in GwReceive
    SiSelPSelect: start select (timeout=20000)
    Thu Apr  9 15:40:36 2009
    SiSelPNext: an error occurred in sock 31
    NiSelISelectInt: error detected on hdl 18 / sock 31
    NiSelIListInsert: add hdl 18 [17] to sel-list (0) of set0
    NiSelISelectInt: 1 handles selected (0 buffered)
    main: NiSelNext (ni_hdl=18, read=1, write=0, connect=0, hdl_info=0x6000000000587400)
    request from CLIENT
    GwRequest: request from client 586
    GwGetMemory: allocated 0x600000000089bee0 (len=34615)
    NiHsLGetHostName: found address 172.19.xx.xxx in cache
    ***LOG Q0I=> NiIRead: recv (232: Connection reset by peer) [nixxi.cpp 4423]
    ERROR => NiIRead: SiRecv failed for hdl 18 / sock 31
        (SI_ECONN_BROKEN/232; I4; ST; 172.19.xx.xxx:1097) [nixxi.cpp    4423]
    Adresse   Offset  bad request
    GwSaveErrInfo2: save err info (225)
    ***LOG S23=> GwIDisconnectClient, client disconnected (586) [gwxxrd.c     11657]
    ***LOG S74=> GwIDisconnectClient, client disconnected ( SY08472) [gwxxrd.c     11665]
    ***LOG S0R=> GwIDisconnectClient, client disconnected () [gwxxrd.c     11704]
    ***LOG S0I=> GwIDisconnectClient, client disconnected ( EXCEL) [gwxxrd.c     11713]
    LOCATION    SAP-Gateway on host mxxx112 / sapgw01
    ERROR       connection to partner '172.19.xx.xxx:1097' broken
    TIME        Thu Apr  9 15:40:36 2009
    RELEASE     700
    COMPONENT   NI (network interface)
    VERSION     38
    RC          -6
    MODULE      nixxi.cpp
    LINE        4423
    DETAIL      NiIRead
    SYSTEM CALL recv
    ERRNO       232
    ERRNO TEXT  Connection reset by peer
    COUNTER     790

    Just FYI.
    After all, we ended up applying BEx addon patch 9.
    The problem about the BEx crash seemed to be fixed in patch 8, but another problem (I heard it was about something to do with report jump function) was not fixed. As a result, we skipped patch 8 and applied 9.
    Both problems were fixed in patch 9.
    Many thanks to SDN informations.
    Yuko

  • Changing variable values in query navigation

    Hello,
    We used to use the functionality of a user exit variable for a web template query and could enter a default value for a query, like yesterday's date. This allowed the web template to be presented without a user having to enter variables in order to initially see data. Then either dropdowns or the navigation block objects could be used to navigate the query. To do this the, "Can be changed in query navigation", was set to on. In BI 7.0 this functionality has been removed. Is there a way to provide a default value to a characteristic that can still be changed during query navigation?
    According to documentation this functionality has been enhanced with default values in the variables but there does not seem to be a way to enter a non-fixed value and still change it during navigation.
    Any assistance would be appreciated.
    Thanks,
    Rick

    This can be done by changing the variable to be processed with user exits and changing the user exit for variables to populate the variable value at runtime.

  • How to change variable values dynamicly  in broadcasting

    Dear Friends i am scheduling workbooks using broadcasting feature.
    i want to know how can i change the variable values of report in broadcasting dynamically.
    becuase i dont want to schedule report again and again after changing the variable values.
    Regards
    Malik

    i did the same but its not working.
    i create one variant for the query ABC  using RSRT now if i look into table RSRVARIANT we can see that variant
    entry in this table. Now i create variant by bex on this query with the same name.
    now i schedule it using broadcasting but its not takeing the values of RSRVARIANT table.
    Its taking the value of variant which i save in bex.
    By default variant which is save in bex not appear in RSRVARIANT table.
    But i f you make a variant in RSRT you can see those entries in Table RSRVARIANT.
    But RSRT variant is not showing in Broadcast scheduling. Only Bex variant are showing.
    Where should create the variant in Workbook, in Bex web analyzer, or in RSRT.
    Regards
    Malik
    Edited by: Malik Naeem on Jun 9, 2010 2:05 PM

  • Getting a variable value from another class

    Is there any way to get the value of a variable from another class? I have a file that calls another that does some checking then gives a true or false. The place the checking is done is inside an ActionListener I want to use that value in the file that calls the second. Any help would be great.

    in 'another class', implement a method,
    public boolean isCheckedOutOK( Object obj )
    do the comparison in that method (use a suitable argument)

  • Pass The Variable Value to another class

    maybe just simple question, but i can't find out how to resolve it
    I want to use the ResultSet for my database connection result to another class ..
    this is my code
    private static select(){
    String URL = "jdbc:mysql://localhost/Chat";
    String username = "root";
    String password ="";
    try{
    Class.forName("com.mysql.jdbc.Driver")
    }catch(exception e){
    System.out.println("Failed to load MySQL driver");
    Statement stmt = null;
    Connection con = null;
    try{
    con = DriverManager.getConnection(URL,username,password);
    stmt = con.createStatement();
    ResultSet RS = stmt.executeQuery("SELECT * FROM message;");
    while (RS.next()){
    String command = RS.getString("command");
    String source = RS.getString("source");
    String target = RS.getString("target");
    RS.close();
    stmt.close();
    con.close();
    i want to retrieve those three string variable "command", "source", "target"
    for example
    public void run(){
    while(true){
    try{
    select()
    ...... next line is to retrive those three value of string
    how can do it ?
    TIA

    than you limeybrit9 for the answer..
    i get the point, buat i still can't figure it how exactly it has to be done ..
    let me try with arrayList
    private static select(){
    String URL = "jdbc:mysql://localhost/Chat";
    String username = "root";
    String password ="";
    String[] result = new String[3];
    Arrays array = new Arrays();
    try{
    Class.forName("com.mysql.jdbc.Driver")
    }catch(exception e){
    System.out.println("Failed to load MySQL driver");
    Statement stmt = null;
    Connection con = null;
    try{
    con = DriverManager.getConnection(URL,username,password);
    stmt = con.createStatement();
    ResultSet RS = stmt.executeQuery("SELECT * FROM message;");
    while (RS.next()){
    Result[0] = RS.getString("command");
    Result[1] = RS.getString("source");
    Result[2] = RS.getString("target");
    array.asList(Result);
    RS.close();
    stmt.close();
    con.close();
    and i still dont know how to pass those arraylist in other class

  • Changing Variable values and saving it across sessions.

    Hi,
    I've have an requirement like counting the number of times a form is opened and number of times a button is clicked.For this I tried to use global variables.I tried to increment the value of the variable each time a form is opened or a button is clicked.
    opencount.value += 1;
    But it didnt work for me.I tried to hardcode a value like
    opencount.value = 5;
    Even this is also not working.Do I need change any settings or extend rights.Is it possible to save the values that are persistent across the sessions.
    Please help

    I have another apporach using an extras object.
    What you is a script object 'Actions' with this script, to create a counter in the extras object in any form object.
    function initOpenCounter(targetObject) {
        if (targetObject.extras.nodes.namedItem("OpenCounter") === null) {
            targetObject.extras.nodes.append(xfa.form.createNode("extras", "OpenCounter"));
            targetObject.extras.OpenCounter.nodes.append(xfa.form.createNode("integer", "state"));
            while (targetObject.extras.OpenCounter.nodes.length > 0) {
                targetObject.extras.OpenCounter.nodes.remove(targetObject.extras.OpenCounter.nodes.item(t argetObject.extras.OpenCounter.nodes.length - 1));
            var newState = xfa.form.createNode("integer", "OpenCounter");
            newState.value = 0;
            targetObject.extras.OpenCounter.nodes.append(newState);
    Then you need another script, to call the function in the script object and raise the counter, when the form opens.
    I used a floating field in a text on a master pager and put this script into its initialize event.
    Actions.initOpenCounter(this);
    var cCount = parseInt(this.extras.OpenCounter.nodes.item(0).value, 10);
              cCount += 1;
    this.extras.OpenCounter.nodes.item(0).value = cCount;
    this.rawValue = cCount;
    Here's a sample form with an open and save counter.
    https://acrobat.com/#d=C90OHrJKx52LHrtbtahWzQ

  • Change Characteristic values in Material class Classification

    Hi,
    Is there any standard program to change Characteristic vaules in Material Classification?
    Thanks,
    Shiva

    Thanks for your help.
    Points will be awarded.
    Shiva

  • Change Bex Variable Value every time refresh query!

    I'm looking for solution at this problem:
    1) I've create a formula variable
    2) I've assign to this variable a value in EXIT_SAPLRRS0_001 (step 2)
    3) When run my query it's OK but the value of my variable is static!!
    The problem is to change variable value every time the user change a filter like when do "Select Filter Value"...
    How can I do this?

    I know step 2 and this step is usefull for the first valorization of variable
    but, for example, if I run the query with initial filter and after, in the navigation, I restrict the filter using "Keep Filter Value" on a single value of one characteristic the system doesn't execute the SAP EXIT and variable is the same of the first initial value...
    I need a SAP EXIT or anything like it for change Formula Variable Value every time I change any filter during the query navigation.

  • Variable value passing

    I am having issue with passing variable value from one class to another.
    I have class A and Class B bot in same package.
    package D
    Class A {
    private int j = 0; //I have getters and setters for this variable
    public void doSomething(){
    j++;
    this.setJ(++j);
    Class B{
    A a = new A();
    int i = a.getJ();
    System.out.println("value of j is "+i);
    My problem is class A gets called first and j's value get incremented twice...it becomes 2. But when i am calling the getter value in i received is 0 (initial value of J).
    Someone recomened since A does not know about method getJ in B i use request object to set value of j in B which i did but result is still same i am getting value as 0. I tried using request dispatchr but than also am not getting right value of J in A.
    I know this is basic issue in java if anyone canhelp me i will be really grateful.

    Post a small, complete example, using the [ code ][ /code] tags, that will compile and shows the behaviour you are having a problem with.
    In the example above, only the A.doSomething() method changes j from zero, and it is not called in B, so you'd expect j to be 0. There's no reason to resort to reflection.
    Pete

  • Non-final variable inside an inner class - my nemisis

    I have an issue with accessing variables from an inner method. This structure seems to allow access to the text objects but not to the button object. This comes from a bit of example code that just illustrates a simple form window with text fields and buttons that read them.
    At the start of the class I have text objects defined like this:
    public class SimpleGUI extends Composite {
    Text nameField;
    Text junkField;
    // Constructors come next, etc...
    Later within this class there is a method to create some GUI stuff, and then to create a button and when pressed access and print the text to the console
    protected void createGui(){
    junkField = new Text(entryGroup,SWT.SINGLE); //Ross
    junkField.setText("Howdy");
    Button OKbutton = new Button(buttons,SWT.NONE);
    OKbutton.setText("Ok");
    OKbutton.addSelectionListener(
    new MySelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
    System.out.println("Name: " + nameField.getText());
    System.out.println("Junk: " + junkField.getText());
    And that all works fine. So within the inner class, the object junkField can be accessed nicely.
    However if I try to do the same with the button (I want to change the label on the button after it's pressed) I get errors for trying to access a non-final object in an inner class.
    I tried to handle the button similar to the text, adding this after the text defs:
         Button myButton;
    and under the println's in the inner class I wanted:
    if OKbutton.getText.equals("OK") {  OKbutton.setText("NotOK")}
    That's when I get an issue with "cannot refer to a non-final variable inside an inside class defined in a different method"
    Now, if I move the button declaration into the createGui method, and declare it with "final Button myButton" it works.
    Why does the button need different treatment than the text?
    Is this a suitable method to make my button change it's label when pressed, or is this sloppy?

    Button is a local variable. The anonymous inner class object you create can continue to exist after the method ends, but the local variables will not. Therefore, as the error message says, you must make that local button variable final if you want to refer to it inside the anon inner class. If it's final, a copy of its value can be given to the inner class--there's no need to treat it as "variable."

  • Need to place a variable value at the end of report heading in BI 7

    Dear All,
    We have to place a variable value at the end of the report heading and the value should get refreshed whenever we change the variable by using "Change Variable Value". I have created a macro and the value will get triggered unless and until we click on any where on a sheet. But, we want to automate this one by using a macro.
    Ex: Quarterly TA Host Country Details As Of "Variable Date" Variable is created on TA Date characteristic. User can enter date on Pop up window box at the time of changing a variable TA Date. We need changed date at the end of the Report heading Qua----
    Please suggest me on how to place variable value at the end of report heading by using a macro.

    No need to use Macro. You can use text variable.
    Goto the Query Description and click on the Text variable icon.
    Create a text variable of processing type as REPLACEMENT PATH and replace it with the characteristic for which you have a ready for input variable that will be eneter by the user.
    This will populate the text variable with the value entered by teh user.
    Use this text variabkle along with the Query Description. So your description will look something like REPORT_TITLE&TXT_VAR&
    Hope this helps.

  • BI 7 list of variable values not shown in chagne variable values option.

    Hi,
    In BI7 queries i face a problem like the first time you execute a query it asks for selection options ,then the next time if we want to change the variables we have a option "change variable values" in the menu bar to change it,but unlike BW 3.5 it is not showing the entire list of values it shows only the history or the present values we choose,this restricts from selecting any desired values from the list.
    Is there any way to resolve this problem,your suggestions will be really helpful.
    Thanks,
    G.Monica Roja Flora.

    After you click on the box in the variable selection screen you will get another window "Select Values for XXXX". In the first box you will have a drop down box which will show "History", Favorites", "Single Values" & "Value rabges". Then in the bottom right there is a button "More" when you click on it it will open to show the selections already made.
    Hope this helps.
    Bhargava

Maybe you are looking for