Constrructor method in implementation class

Can we write the method constructor for a BADI implementation class?

Hi
*DATA: g_report TYPE REF TO ZCL_IM_IMPL_ENG_CHG.
CREATE OBJECT g_report
  EXPORTING
    if_repid = sy-repid .
I don't know the class ZCL_IM_IMPL_ENG_CHG, and I don't know which interface is the base for that class.
Anyway if some data is transfered while the object is being created, it means the class of the object has to have a constructor method.
Now the question is  why you create the object by the following code?
CREATE OBJECT g_report
  EXPORTING
    if_repid = sy-repid .
Max

Similar Messages

  • How to implement classes and methods in badi's ?

    how to implement classes and methods in badi's? and where i have to write the code based on the requirement?can anyone explain me briefly?

    Hi
    Every BADI by default Implements an INTERFACE which already contains some methods with parameters.
    So you have to find the relavenet method based on the related paramters (by checking the fields in that paramters) you have to double click on the method and to write the code.
    see the doc
    DEFINING THE BADI
    1) execute Tcode SE18.
    2) Specify a definition Name : ZBADI_SPFLI
    3) Press create
    4) Choose the attribute tab. Specify short desc for badi.. and specify the type :
    multiple use.
    5) Choose the interface tab
    6) Specify interface name: ZIF_EX_BADI_SPFLI and save.
    7) Dbl clk on interface name to start class builder . specify a method name (name,
    level, desc).
    Method level desc
    Linese;ection instance methos some desc
    8) place the cursor on the method name desc its parameters to define the interface.
    Parameter type refe field desc
    I_carrid import spfli-carrid some
    I_connid import spefi-connid some
    9) save , check and activate…adapter class proposed by system is
    ZCL_IM_IM_LINESEL is genereated.
    IMPLEMENTATION OF BADI DEFINITION
    1) EXECUTE tcode se18.choose menuitem create from the implementation menubar.
    2) Specify aname for implementation ZIM_LINESEL
    3) Specify short desc.
    4) Choose interface tab. System proposes a name fo the implementation class.
    ZCL_IM_IMLINESEL which is already generarted.
    5) Specify short desc for method
    6) Dbl clk on method to insert code..(check the code in “AAA”).
    7) Save , check and activate the code.
    Some useful URL
    http://www.esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt
    http://www.esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf
    http://www.esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc
    http://www.esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc
    www.sapgenie.com/publications/saptips/022006%20-%20Zaidi%20BADI.pdf
    http://www.sapdevelopment.co.uk/enhance/enhance_badi.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm
    Now write a sample program to use this badi method..
    Look for “BBB” sample program.
    “AAA”
    data : wa_flights type sflight,
    it_flights type table of sflight.
    format color col_heading.
    write:/ 'Flight info of:', i_carrid, i_connid.
    format color col_normal.
    select * from sflight
    into corresponding fields of table it_flights
    where carrid = i_carrid
    and connid = i_connid.
    loop at it_flights into wa_flights.
    write:/ wa_flights-fldate,
    wa_flights-planetype,
    wa_flights-price currency wa_flights-currency,
    wa_flights-seatsmax,
    wa_flights-seatsocc.
    endloop.
    “BBB”
    *& Report ZBADI_TEST *
    REPORT ZBADI_TEST .
    tables: spfli.
    data: wa_spfli type spfli,
    it_spfli type table of spfli with key carrid connid.
    *Initialise the object of the interface.
    data: exit_ref type ref to ZCL_IM_IM_LINESEL,
    exit_ref1 type ref to ZIF_EX_BADISPFLI1.
    selection-screen begin of block b1.
    select-options: s_carr for spfli-carrid.
    selection-screen end of block b1.
    start-of-selection.
    select * from spfli into corresponding fields of table it_spfli
    where carrid in s_carr.
    end-of-selection.
    loop at it_spfli into wa_spfli.
    write:/ wa_spfli-carrid,
    wa_spfli-connid,
    wa_spfli-cityfrom,
    wa_spfli-deptime,
    wa_spfli-arrtime.
    hide: wa_spfli-carrid, wa_spfli-connid.
    endloop.
    at line-selection.
    check not wa_spfli-carrid is initial.
    create object exit_ref.
    exit_ref1 = exit_ref.
    call method exit_ref1->lineselection
    EXPORTING
    i_carrid = wa_spfli-carrid
    i_connid = wa_spfli-connid.
    clear wa_spfli.
    Reward points for useful Answers
    Regards
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • Question about methods in a class that implements Runnable

    I have a class that contains methods that are called by other classes. I wanted it to run in its own thread (to free up the SWT GUI thread because it appeared to be blocking the GUI thread). So, I had it implement Runnable, made a run method that just waits for the thread to be stopped:
    while (StopTheThread == false)
    try
    Thread.sleep(10);
    catch (InterruptedException e)
    //System.out.println("here");
    (the thread is started in the class constructor)
    I assumed that the other methods in this class would be running in the thread and would thus not block when called, but it appears the SWT GUI thread is still blocked. Is my assumption wrong?

    powerdroid wrote:
    Oh, excellent. Thank you for this explanation. So, if the run method calls any other method in the class, those are run in the new thread, but any time a method is called from another class, it runs on the calling class' thread. Correct?Yes.
    This will work fine, in that I can have the run method do all the necessary calling of the other methods, but how can I get return values back to the original (to know the results of the process run in the new thread)?Easy: use higher-level classes than thread. Specifically those found in java.util.concurrent:
    public class MyCallable implements Callable<Foo> {
      public Foo call() {
        return SomeClass.doExpensiveCalculation();
    ExecutorService executor = Executors.newFixedThreadPool();
    Future<Foo> future = executor.submit(new MyCallable());
    // do some other stuff
    Foo result = future.get(); // get will wait until MyCallable is finished or return the value immediately when it is already done.

  • Implementing UIApplicationDelegate protocol methods in NSObject class not working.

    Hi Everyone,
    I am new bee in iphone developement. I want to implement UIApplicationDelegate protocol methods in one of my NSObject class, how can i implement that help me please.
    I have mentioned the sample code what acutal i want to impelment.
    .h file
    @interface SmaplClass : NSObject <UIApplicationDelegate>
    .m file
    - (void)applicationWillResignActive:(UIApplication *)application
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
    -(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
    - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
    Want to implement the above methods is NSObject class to be implemented or used, its not working. Help me can do it.
    Please help me
    Thanks,

    I complete the above discussion with saying that it is better to implement the notification handling methods in your app delegate. If there are good reasons to not to do so, you have to implement the methods in another class, instantiate the class, and call the methods from the actual UIApplicationDelegate protocol methods in the AppDelegate object. This way you can remove the actual notification handling code from AppDelegate class.
    For example, suppose you implemented the methods in the class called Test. This is a sample code in the AppDelegate class:
    @implementation AppDelegate
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
          Test *t = [[Test alloc] init];
         [t application: application didReceiveRemoteNotification: userInfo];
    @end
    Or you can create an association relationship between the AppDelegate and Test, so you do not have to create a new Test instance in each of the remote notification handling methods:
    @interface AppDelegate {
         Test *test;
    @end
    @implementation AppDelegate
    + (id)init {
         if (self = [super init]) {
              test = [[Test alloc] init];
         return self;
    - (void)dealloc {
         [test release];
         [super dealloc];
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
         // No need to create a Test instance. You just forward the call from AppDelegate instance to test      // instance
         [test application: application didReceiveRemoteNotification: userInfo];
    @end

  • How to check (programmatic) existence of a method in a class implementation

    Hi
    I need to check the existence of method in a class in a programmatic way and call it only when it is available otherwise proceed with subsequent steps in my ABAP OO Program. Is there way to do it? This is needed in a customer exit situation and each task is implemented with method and not all tasks would have methods implemented.
    Any feedback is greatly appreciated.
    Thanks

    When you try to call the method dynamically and ifthe method doesn't exist, system would complain by raising the exception cx_sy_dyn_call_illegal_method. You can Catch this exception when you call the method.
    CLASS lcl_test DEFINITION.
      PUBLIC SECTION.
        METHODS:
          check_exist.
    ENDCLASS.                    "lcl_test DEFINITION
    DATA: lo_test TYPE REF TO lcl_test.
    DATA: lv_method TYPE char30.
    lv_method = 'GET_DATA'.
    CREATE OBJECT lo_test.
    TRY.
        CALL METHOD lo_test->(lv_method).
      CATCH cx_sy_dyn_call_illegal_method.
    ENDTRY.
    CLASS lcl_test IMPLEMENTATION.
      METHOD check_exist.
      ENDMETHOD.                    "check_exist
    ENDCLASS.
    Regards,
    Naimesh Patel

  • I need  to implement clone method  in theAdvancedDataGrid class

    I need  to implement clone method  in theAdvancedDataGrid class, to copy the object in its completeness   Could anyone give me a helping hand.

    Hi Nikos,
    from youe question it's not clear what do you need to copy: data, parts of ADG (GUI) or something else?
    If it's not a GUI - only data - you can use mx.utils.ObjectUtil.copy(value:Object):Object

  • Implementing methods in a class

    I have a class called Employee that uses getters and seters and methods from another project. I brought the code from the methods into the Employee class to run them in my class. It is supose to calculate an employee's monthly income plus commission and a seniority bonus based on years. When I compile the class I get errors. I was wondering if you java experts can look and see what my problem is. Here is the code and errors, thanks...
    public class Employee
         private String firstName, lastName,
              address, city, state,zipCode;
         private short seniority = 0;
         private double baseSalary = 500;
         private Company company;
         //constructor
         public Employee(String fn, String ln, String a, String c, String s,
              String zc, short newSeniority, double newBs, Company newCompany){
              firstName = fn;
              lastName = ln;
              address = a;
              city = c;
              state = s;
              zipCode = zc;
              seniority = newSeniority;
              baseSalary = newBs;
              company = newCompany;
         public Employee(){
              firstName = "";
              lastName = "";
              address = "";
              city = "";
              state = "";
              zipCode = "";
         public double computeCommision(double weeklyPay) {
              double thisCommission;   
           if(weeklyPay < baseSalary)
                  thisCommission = 0.00;   
           else if(weeklyPay < 1000.00)
              thisCommission = weeklyPay * .05;   
           else if(weeklyPay < 5000.00)
              thisCommission = weeklyPay * .08;   
           else if(weeklyPay >= 5000.00)
              thisCommission = weeklyPay * .10 + 400;   
           else thisCommission = 0.00;  
           return thisCommission;
         public double bonus(double weeklyPay, int yearsWorked) {
              short seniority;
            double thisCommission = computeCommission(weeklyPay);
            if (yearsWorked >= 2) // No bonus for less than two years
                 seniority = (weeklyPay * yearsWorked)/100;
            return seniority;
         public double payroll() {
              double payroll = 0.0, pay, commission, bonus, years;
            System.out.println("\nPlease enter the years you have worked for this company:");
            int response = MyInput.readInt();
            for (int i = 0; i < 4; i++)
            System.out.println("\nPlease enter you salary for week "  + (i+1) + ": ");
            pay = MyInput.readDouble();
            commission =  computeCommission(pay);
            bonus = bonus((commission + pay), response);
            payroll = payroll + pay + commission + bonus;     
            return payroll;
         public String getFirstName() { return firstName; }
         public void setFirstName(String fn) { firstName = fn; }
         public String getLastName() { return lastName; }
         public void setLastName(String ln) { lastName = ln; }
         public String getAddress() { return address; }
         public void setAddress(String a) { address = a; }
         public String getCity() { return city; }
         public void setCity(String c) { city = c; }
         public String getState() { return state; }
         public void setState(String s)     { state = s; }
         public String getZipCode()     { return zipCode; }
         public void setZipCode(String zc) { zipCode = zc; }
         public short getSeniority() { return seniority; }
         public void setSeniority(short newSeniority) { seniority = newSeniority; }
         public double getBaseSalary() { return baseSalary; }
         public void setBaseSalary(double newBs) { baseSalary = newBs; }
         public Company getCompany() { return company; } //getter method for company in company class
         public void setBank(Company newCompany) { company = newCompany; }
    }   and the errors are :
    C:\cis163\Project5_1\src\Employee.java:59: cannot resolve symbol
    symbol : method computeCommission (double)
    location: class Employee
    double thisCommission = computeCommission(weeklyPay);
    ^
    C:\cis163\Project5_1\src\Employee.java:62: possible loss of precision
    found : double
    required: short
    seniority = (weeklyPay * yearsWorked)/100;
    ^
    C:\cis163\Project5_1\src\Employee.java:70: cannot resolve symbol
    symbol : variable MyInput
    location: class Employee
    int response = MyInput.readInt();
    ^
    C:\cis163\Project5_1\src\Employee.java:75: cannot resolve symbol
    symbol : variable MyInput
    location: class Employee
    pay = MyInput.readDouble();
    ^
    C:\cis163\Project5_1\src\Employee.java:76: cannot resolve symbol
    symbol : method computeCommission (double)
    location: class Employee
    commission = computeCommission(pay);
    ^
    5 errors

    ok, sorry. I wasnt clear on what you were saying. MyInput.java is in the same folder when I compiled it. I changed my code around a little, changed some variables so it was easier for me to understand. I am still getting several errors after I wrote code for the Project which I called project5. Not sure where I am going wrong but I will post my classes and main to see if anyone can help me out.
    //Company class
    public class Company
        private String companyName;
         private String companyAddress;
         private String companyCity;
         private String companyState;
         private String companyZip ;
         //Constructor method
         public Company(String cn, String ca, String cc, String cs, String cz) {
              companyName = cn;         
              companyAddress = ca;         
              companyCity = cc;         
              companyState = cs;         
              companyZip = cz;
        public Company(){
             companyName = "";
             companyAddress = "";
             companyCity = "";
             companyState = "";
             companyZip = "";
         public String getName() { return companyName; }
        public void setName(String cn) { companyName = cn; }
         public String getAddress() { return companyAddress; }
        public void setAddress(String ca){ companyAddress = ca; }
        public String getCity() { return companyCity; }
        public void setCity(String cc) { companyCity = cc; }     
        public String getState() { return companyState; }     
        public void setState(String cs) { companyState = cs; }
        public String getZip()     { return companyZip; }     
        public void setZip(String cz) { companyZip = cz; }
    //Employee class
    public class Employee
         private String employeeFName, employeeLName,employeeAddress,
              employeeCity, employeeState, employeeZip;
         private short seniority = 0;
         private double baseSalary = 500;
         private Company company;
         //constructor
         public Employee(String efn, String eln, String ea, String ec, String es,
              String ez, short newSeniority, double newBs, Company newCompany){
              employeeFName = efn;
              employeeLName = eln;
              employeeAddress = ea;
              employeeCity = ec;
              employeeState = es;
              employeeZip = ez;
              seniority = newSeniority;
              baseSalary = newBs;
              company = newCompany;
         public Employee(){
              employeeFName = "";
              employeeLName = "";
              employeeAddress = "";
              employeeCity = "";
              employeeState = "";
              employeeZip = "";
         public double computeCommission(double weeklyPay) {
              double thisCommission;   
           if(weeklyPay < baseSalary)
                  thisCommission = 0.00;   
           else if(weeklyPay < 1000.00)
              thisCommission = weeklyPay * .05;   
           else if(weeklyPay < 5000.00)
              thisCommission = weeklyPay * .08;   
           else if(weeklyPay >= 5000.00)
              thisCommission = weeklyPay * .10 + 400;   
           else thisCommission = 0.00;  
           return thisCommission;
         public double bonus(double weeklyPay, int yearsWorked) {
              short seniority;
            double thisCommission = computeCommission(weeklyPay);
            if (yearsWorked >= 2) // No bonus for less than two years
                 seniority = (short) ((weeklyPay * yearsWorked)/100);
            return seniority;
         public double payroll() {
              double payroll = 0.0, pay, commission, bonus, years;
            System.out.println("\nPlease enter the years you have worked for this company:");
            int response = MyInput.readInt();
            for (int i = 0; i < 4; i++)
            System.out.println("\nPlease enter you salary for week "  + (i+1) + ": ");
            pay = MyInput.readDouble();
            commission =  computeCommission(pay);
            bonus = bonus((commission + pay), response);
            payroll = payroll + pay + commission + bonus;     
            return payroll;
         public String getFirstName() { return employeeFName; }
         public void setFirstName(String efn) { employeeFName = efn; }
         public String getLastName() { return employeeLName; }
         public void setLastName(String eln) { employeeLName = eln; }
         public String getAddress() { return employeeAddress; }
         public void setAddress(String ea) { employeeAddress = ea; }
         public String getCity() { return employeeCity; }
         public void setCity(String ec) { employeeCity = ec; }
         public String getState() { return employeeState; }
         public void setState(String es)     { employeeState = es; }
         public String getZipCode()     { return employeeZip; }
         public void setZipCode(String ez) { employeeZip = ez; }
         public short getSeniority() { return seniority; }
         public void setSeniority(short newSeniority) { seniority = newSeniority; }
         public double getBaseSalary() { return baseSalary; }
         public void setBaseSalary(double newBs) { baseSalary = newBs; }
         public Company getCompany() { return company; } //getter method for company in company class
         public void setBank(Company newCompany) { company = newCompany; }
    public class Project5 { //Beginning of class Project5
    public static void main (String args[]) { //Beginning of main
            //Company
            String companyName = "";
            String companyAddress = "";
            String companyCity = "";
            String companyState = "";
            String companyZip = "";
            // Creates a new Company object called aCompany
            Company aCompany = new Company( companyName, companyAddress,
                 companyCity, companyState, companyZip );
            // Prompts user about information about company
            // and sets fields for the Company object.
            System.out.println( "***Company Information***" );
            System.out.println( "Please enter information about company:");
            System.out.println();
            System.out.print( "Company name: " );
            companyName = MyInput.readString();
            aCompany.setName( companyName );
            System.out.print( "Company address: " );
            companyAddress = MyInput.readString();
            aCompany.setAddress( companyAddress );
            System.out.print( "Company city: " );
            companyCity = MyInput.readString();
            aCompany.setCity( companyCity );
            System.out.print( "Company state: " );
            companyState = MyInput.readString();
            aCompany.setState( companyState );
            System.out.print( "Company zip: " );
            companyZip = MyInput.readString();
            aCompany.setZip( companyZip );
            System.out.println();
            // Employee
            String employeeFName = "";
            String employeeLName = "";
            short seniority = 0;
            String employeeAddress = "";
            String employeeCity = "";
            String employeeState = "";
            String employeeZip = "";
            // Creates a new Employee object called anEmployee who works for the above company.
            Employee anEmployee = new Employee( employeeFName,employeeLName, seniority,
                 employeeAddress, employeeCity, employeeState, employeeZip, aCompany );
            // Prompts user about information about employee
            // and sets fields for the Employee object.
            System.out.println( "***Employee Information***" );
            System.out.println( "Please enter information about an employee:");
            System.out.println();
            System.out.print( "Employee first name: " );
            employeeFName = MyInput.readString();
            anEmployee.setFirstName( employeeFName );
            System.out.print( "Employee last name: " );
            employeeLName = MyInput.readString();
            anEmployee.setLastName( employeeLName );
            System.out.print( "Employee address: " );
            employeeAddress = MyInput.readString();
            anEmployee.setAddress( employeeAddress );
            System.out.print( "Employee city: " );
            employeeCity = MyInput.readString();
            anEmployee.setCity( employeeCity );
            System.out.print( "Employee state: " );
            employeeState = MyInput.readString();
            anEmployee.setState( employeeState );
            System.out.print( "Employee zip: " );
            employeeZip = MyInput.readString();
            anEmployee.setZip( employeeZip );
            System.out.print( "How many years the employee has been with the company? : " );
            seniority = (short)MyInput.readInt();
            anEmployee.setSeniority( seniority );
            System.out.println();
            // Displays company information
            System.out.println( "*** Company Information Summary ***" );
            System.out.println( "Company name:    " + aCompany.getName());
            System.out.println( "Company address: " + aCompany.getAddress() );
            System.out.println( "Company city:    " + aCompany.getCity() );
            System.out.println( "Company state:   " + aCompany.getState() );
            System.out.println( "Company zip:     " + aCompany.getZip() );
            System.out.println();
            // Displays employee information
            System.out.println( "*** Employee Information Summary ***");
            System.out.println( "Employee firstName:  " + anEmployee.getFirstName() );
            System.out.println( "Employee lastName:   " + anEmployee.getLastName() );
            System.out.println( "Employee seniority:  " + anEmployee.getSeniority() );
            System.out.println( "Employee baseSalary: $" + anEmployee.getBaseSalary() );
            System.out.println( "Employee address:    " + anEmployee.getAddress() );
            System.out.println( "Employee city:       " + anEmployee.getCity() );
            System.out.println( "Employee state:      " + anEmployee.getState() );
            System.out.println( "Employee zip:        " + anEmployee.getZip() );
            // We retrieve the company name from anEmployee object.
            System.out.println( "Company name the employee works for: "
                 + anEmployee.getCompany().getName() );
            // Calls payroll() to calculate one month salary
            System.out.println();
            System.out.println( "*** Calculate monthly pay *** " );
            double oneMonthSalary = anEmployee.payroll(); // Calls payroll()
            DecimalFormat myDecimalFormat = new DecimalFormat( "0.00" );
    // Instantiate DecimalFormat object
            // Format one month salary and display to console
            System.out.println();
            System.out.println( "One month salary is: $" + myDecimalFormat.format(oneMonthSalary) );
            System.out.println();
    }sorry, its alot. I'm getting 18 errors, which are:
    C:\cis163\Project5_1\src\Project5.java:24: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    companyName = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:28: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    companyAddress = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:32: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    companyCity = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:36: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    companyState = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:40: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    companyZip = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:56: cannot resolve symbol
    symbol : constructor Employee (java.lang.String,java.lang.String,short,java.lang.String,java.lang.String,java.lang.String,java.lang.String,Company)
    location: class Employee
    Employee anEmployee = new Employee( employeeFName,employeeLName, seniority,
    ^
    C:\cis163\Project5_1\src\Project5.java:66: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    employeeFName = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:70: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    employeeLName = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:74: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    employeeAddress = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:78: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    employeeCity = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:82: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    employeeState = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:86: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    employeeZip = MyInput.readString();
    ^
    C:\cis163\Project5_1\src\Project5.java:87: cannot resolve symbol
    symbol : method setZip (java.lang.String)
    location: class Employee
    anEmployee.setZip( employeeZip );
    ^
    C:\cis163\Project5_1\src\Project5.java:90: cannot resolve symbol
    symbol : variable MyInput
    location: class Project5
    seniority = (short)MyInput.readInt();
    ^
    C:\cis163\Project5_1\src\Project5.java:114: cannot resolve symbol
    symbol : method getZip ()
    location: class Employee
    System.out.println( "Employee zip: " + anEmployee.getZip() );
    ^
    C:\cis163\Project5_1\src\Project5.java:127: cannot resolve symbol
    symbol : method payroll ()
    location: class Employee
    double oneMonthSalary = anEmployee.payroll(); // Calls payroll()
    ^
    C:\cis163\Project5_1\src\Project5.java:129: cannot resolve symbol
    symbol : class DecimalFormat
    location: class Project5
    DecimalFormat myDecimalFormat = new DecimalFormat( "0.00" );
    ^
    C:\cis163\Project5_1\src\Project5.java:129: cannot resolve symbol
    symbol : class DecimalFormat
    location: class Project5
    DecimalFormat myDecimalFormat = new DecimalFormat( "0.00" );
    ^
    18 errors

  • Is it possible to access elements of a view in implementation class?

    Hi,
            In the BSP component workbench, is it possible to manipulate elements of a view (listbox, inputfields etc., hardcoded using htmlb tags) in the methods of view implementation class. For example, I have a inputfield which is initially invisible. I want to make it visible when a particular event is triggered. I wish to code this directly in the event handler method. Can anybody provide some pointers?

    Arun,
    As the UI elements (tags) do only exist during rendering phase a direct access from the view controller is not possible - especially not in the forward-oriented way from within an event handler as  indicated from you in the posting.
    However, it is of course possible to hard-code view layouts; for this approach you can use the BSP view corresponding to the view and code there whatever you like. BSP views can also contain code snippets to achieve dynamic effects. In your example it doesn't look like that you need code at all - you need to preserve the status (visible/ invisible) in a value attribute of a context node and use this value to bind visibility of the input field on the layout.
    In CRM 2007, there are two main tag libraries (aka BSP extensions) being used:
    - THTMLB (single tags, like input field, button, table, ...)
    - CHTMLB (configuration tags; these are available for forms, tables and trees)
    You should always use these tag libraries in the first place to assure common look and feel and avoid rendering issues.
    Best regards
    Peter

  • Moving a method from one class to another issues

    Hi, im new. Let me explain what i am trying to achieve. I am basically trying to move a method from one class to another in order to refactor the code. However every time i do, the program stops working and i am struggling. I have literally tried 30 times these last two days. Can some one help please? If shown once i should be ok, i pick up quickly.
    Help would seriously be appreciated.
    Class trying to move from, given that this is an extraction:
    class GACanvas extends Panel implements ActionListener, Runnable {
    private WorldMenuItems speedMenuItems, designMenuItemsPlantGrowth, designMenuItemsPlantCount;
         private WorldMenuItems designMenuItemsPlantEaten, designMenuItemsApproximatePopulation;
         private WorldMenuItems designMenuItemsEatersBorn,designMenuItemsMutationProbability;
         private WorldMenuItems designMenuItemsCrossoverProbability;
    MenuBar getMenuBar() {
              menuBar = new MenuBar();
              addControlItemsToMenuBar();
              addSpeedItemsToMenuBar();
              addWorldDesignItemsToMenuBar();
              return menuBar;
    This is the method i am trying to move (below)
    public void itemsInsideWorldDesignMenu() {
              designMenuItemsPlantGrowth = new WorldMenuItems("Plants Grow",
                        new String[] { "In Rows", "In Clumps", "At Random",
                                  "Along the Bottom", "Along the Edges" }, 1);
              designMenuItemsPlantCount = new WorldMenuItems("Number Of Plants",
                        new String[] { "50", "100", "150", "250", "500" }, 3);
              designMenuItemsPlantEaten = new WorldMenuItems("When a Plant is Eaten",
                        new String[] { "It grows back somewhere",
                                  "It grows back nearby", "It's Gone" }, 0);
              designMenuItemsApproximatePopulation = new WorldMenuItems(
                        "Approximate Population", new String[] { "10", "20", "25",
                                  "30", "40", "50", "75", "100" }, 2);
              designMenuItemsEatersBorn = new WorldMenuItems("Eaters are Born",
                        new String[] { "At the Center", "In a Corner",
                                  "At Random Location", "At Parent's Location" }, 2);
              designMenuItemsMutationProbability = new WorldMenuItems(
                        "Mutation Probability", new String[] { "Zero", "0.25%", "0.5%",
                                  "1%", "2%", "3%", "5%", "10%" }, 3);
              designMenuItemsCrossoverProbability = new WorldMenuItems(
                        "Crossover Probability", new String[] { "Zero", "10%", "25%",
                                  "50%", "75%", "100%" }, 4);
    Class Trying to move to:
    class WorldMenuItems extends Menu implements ItemListener {
       private CheckboxMenuItem[] items;
       private int selectedIndex = -1;
       WorldMenuItems(String menuName, String[] itemNames) {
          this(menuName, itemNames, -1);
       WorldMenuItems(String menuName, String[] itemNames, int selected) {
          super(menuName);
          items = new CheckboxMenuItem[itemNames.length];
          for (int i = 0; i < itemNames.length; i++) {
             items[i] = new CheckboxMenuItem(itemNames);
    add(items[i]);
    items[i].addItemListener(this);
    selectedIndex = selected;
    if (selectedIndex < 0 || selectedIndex >= items.length)
    selectedIndex = 1;
    items[selectedIndex].setState(true);
         public int getSelectedIndex() {
              return selectedIndex;
    public void itemStateChanged(ItemEvent evt) {  // This works on other systems
    CheckboxMenuItem newSelection = (CheckboxMenuItem)evt.getSource();
    for (int i = 0; i < items.length; i++) {
    if (newSelection == items[i]) {
    items[selectedIndex].setState(false);
    selectedIndex = i;
    newSelection.setState(true);
    return;

    Ok i've done this. I am getting an error on the line specified. Can someone help me out and tell me what i need to do?
    GACanvas
    //IM GETTING AN ERROR ON THIS LINE UNDER NAME, SAYING IT IS NOT VISIBLE
    WorldMenuItems worldmenuitems = new WorldMenuItems(name, null);
    public MenuBar getMenuBar() {
              menuBar = new MenuBar();
              addControlItemsToMenuBar();
              addSpeedItemsToMenuBar();
              worldmenuitems.addWorldDesignItemsToMenuBar();
              return menuBar;
    class WorldMenuItems extends Menu implements ItemListener {
         private WorldMenuItems speedMenuItems, designMenuItemsPlantGrowth, designMenuItemsPlantCount;
         private WorldMenuItems designMenuItemsPlantEaten, designMenuItemsApproximatePopulation;
         private WorldMenuItems designMenuItemsEatersBorn,designMenuItemsMutationProbability;
         private WorldMenuItems designMenuItemsCrossoverProbability;
         GACanvas gacanvas = new GACanvas(null);
       private CheckboxMenuItem[] items;
       private int selectedIndex = -1;
       WorldMenuItems(String menuName, String[] itemNames) {
          this(menuName, itemNames, -1);
       WorldMenuItems(String menuName, String[] itemNames, int selected) {
          super(menuName);
          items = new CheckboxMenuItem[itemNames.length];
          for (int i = 0; i < itemNames.length; i++) {
             items[i] = new CheckboxMenuItem(itemNames);
    add(items[i]);
    items[i].addItemListener(this);
    selectedIndex = selected;
    if (selectedIndex < 0 || selectedIndex >= items.length)
    selectedIndex = 1;
    items[selectedIndex].setState(true);
         public int getSelectedIndex() {
              return selectedIndex;
    public void itemStateChanged(ItemEvent evt) {  // This works on other systems
    CheckboxMenuItem newSelection = (CheckboxMenuItem)evt.getSource();
    for (int i = 0; i < items.length; i++) {
    if (newSelection == items[i]) {
    items[selectedIndex].setState(false);
    selectedIndex = i;
    newSelection.setState(true);
    return;
    public void itemsInsideWorldDesignMenu() {
         designMenuItemsPlantGrowth = new WorldMenuItems("Plants Grow",
                   new String[] { "In Rows", "In Clumps", "At Random",
                             "Along the Bottom", "Along the Edges" }, 1);
         designMenuItemsPlantCount = new WorldMenuItems("Number Of Plants",
                   new String[] { "50", "100", "150", "250", "500" }, 3);
         designMenuItemsPlantEaten = new WorldMenuItems("When a Plant is Eaten",
                   new String[] { "It grows back somewhere",
                             "It grows back nearby", "It's Gone" }, 0);
         designMenuItemsApproximatePopulation = new WorldMenuItems(
                   "Approximate Population", new String[] { "10", "20", "25",
                             "30", "40", "50", "75", "100" }, 2);
         designMenuItemsEatersBorn = new WorldMenuItems("Eaters are Born",
                   new String[] { "At the Center", "In a Corner",
                             "At Random Location", "At Parent's Location" }, 2);
         designMenuItemsMutationProbability = new WorldMenuItems(
                   "Mutation Probability", new String[] { "Zero", "0.25%", "0.5%",
                             "1%", "2%", "3%", "5%", "10%" }, 3);
         designMenuItemsCrossoverProbability = new WorldMenuItems(
                   "Crossover Probability", new String[] { "Zero", "10%", "25%",
                             "50%", "75%", "100%" }, 4);
    public void addWorldDesignItemsToMenuBar() {
         gacanvas = new GACanvas(null);
         itemsInsideWorldDesignMenu();
         Menu designMenuItems = new Menu("WorldDesign");
         designMenuItems.add(designMenuItemsPlantGrowth);
         designMenuItems.add(designMenuItemsPlantCount);
         designMenuItems.add(designMenuItemsPlantEaten);
         designMenuItems.add(designMenuItemsApproximatePopulation);
         designMenuItems.add(designMenuItemsEatersBorn);
         designMenuItems.add(designMenuItemsMutationProbability);
         designMenuItems.add(designMenuItemsCrossoverProbability);
         gacanvas.menuBar.add(designMenuItems);

  • Find the implementation class of a Business object

    HI Gurus,
    Is there any path in SPRO from where we can find the implementation class of a BOL object?
    For an example, I am working with BuilHeader. The backend table for BUL Header which will be updated while modifiyng BuilHeader is BUT000. So how can we find the back end database  table name or implementation class where the table BUT000 is updated?

    Hi Suchandra Bose
    the flow will go like this.
    1) the data in the BOL structures moved to Genil Implementation Class  which is defined in the below SPRO path
    CRM->CRM Cross application components->Generic Interaction Layer/Object Layer->Basic Settings in this corresponding each and every component one Genil class and its Model information in the form of tables will be maintained.
    2) Take for example BP component , for BP component CL_CRM_BUIL is the Generic Interaction layer class , with in the generic interaction layer class methods (Create_objects, MODIFY_OBJECTS, GET_OBJECTS)  you will find a code snippet to get the * Handler class* , this handler class will inturn get the Interaction Layer classes to reach the API  ,
    get object handler
          lv_cl_object =
             me->handler_factory->get_obj_handler(
                                      iv_object_name = iv_object_name ).
    3) This handler method will query the table CRMC_OBJIMP_BUIL  to get the relevant handler class depending on which functionality you are implementing.
    Thanks & Regards
    Raj

  • Calling a method from abstarct class

    Hi Experts,
    Am working on ABAP Objects.
    I have created an Abstract class - with method m1.
    I have implemented m1.
    As we can not instantiate an abstract class, i tried to call the method m1 directly with class name.
    But it it giving error.
    Please find the code below.
    CLASS c1 DEFINITION ABSTRACT.
      PUBLIC SECTION.
        DATA: v1 TYPE i.
        METHODS: m1.
    ENDCLASS.                    "c1 DEFINITION
    CLASS c1 IMPLEMENTATION.
      METHOD m1.
        WRITE: 'You called method m1 in class c1'.
      ENDMETHOD. "m1
    ENDCLASS.                    "c1 IMPLEMENTATION
    CALL METHOD c1=>m1.
    Please tell me what is wrong and how to solve this problem.
    Thanks in Advance.

    Micky is right, abstract means not to be instantiated. It is just a "template" which you can use for all subsequent classes. I.e you have general abstract class vehicle . For all vehicles you will have the same attributes like speed , engine type ,  strearing , gears etc and methods like start , move etc.
    In all subsequent classes (which inherit from vehicle) you will have more specific attributes for each. But all of these classes have some common things (like the ones mentioned above), so they use abstract class to define these things for all of them.
    Moreover there is no sense in creating instance (real object) of class vehicle . What kind of physical object would vehicle be? there is no such object in real world, right? For this we need to be more precise, so we create classes which use this "plan" for real vehicles. So the abstract class here is only to have this common properties and behaviour defined in one place for all objects which will have these. Abstract object however cannot be created per se. You can only create objects which are lower in hierarchy (which are specific like car , ship, bike etc).
    Hope this claryfies what we need abstract classes for.
    Regards
    Marcin

  • Can't add list element when calling a method from another class

    I am trying to call a method in another class, which contains code listmodel.addElement("text"); to add an element into a list component made in that class.
    I've put in System.out.println("passed"); in the method just to make sure if the method was being called properly and it displays normally.
    I can change variables in the other class by calling the method with no problem. The only thing I can't do is get listmodel.addElement("text"); to add a new element in the list component by doing it this way.
    I've called that method within it's class and it added the element with no problem. Does Java have limitations about what kind of code it can run from other classes? And if that's the case I'd really like to know just why.

    There were no errors, just the element doesnt get added to the list by doing it this way
    class showpanel extends JPanel implements ActionListener, MouseMotionListener {
           framepanel fp = new framepanel();
           --omitted--
         public void actionPerformed(ActionEvent e){
                  if(e.getSource() == button1){
                       fp.addLayer();
    /*is in a different class file*/
    class framepanel extends JPanel implements ActionListener{
            --omitted--
         public void addLayer(){
              listmodel.addElement("Layer"+numLayer);
              numLayer++;
    }

  • Calling a non-static method from another Class

    Hello forum experts:
    Please excuse me for my poor Java vocabulary. I am a newbie and requesting for help. So please bear with me! I am listing below the program flow to enable the experts understand the problem and guide me towards a solution.
    1. ClassA instantiates ClassB to create an object instance, say ObjB1 that
        populates a JTable.
    2. User selects a row in the table and then clicks a button on the icon toolbar
        which is part of UIMenu class.
    3. This user action is to invoke a method UpdateDatabase() of object ObjB1. Now I want to call this method from UIMenu class.
    (a). I could create a new instance ObjB2 of ClassB and call UpdateDatabase(),
                                      == OR ==
    (b). I could declare UpdateDatabase() as static and call this method without
         creating a new instance of ClassB.With option (a), I will be looking at two different object instances.The UpdateDatabase() method manipulates
    object specific data.
    With option (b), if I declare the method as static, the variables used in the method would also have to be static.
    The variables, in which case, would not be object specific.
    Is there a way or technique in Java that will allow me to reference the UpdateDatabase() method of the existing
    object ObjB1 without requiring me to use static variables? In other words, call non-static methods in a static
    way?
    Any ideas or thoughts will be of tremendous help. Thanks in advance.

    Hello Forum:
    Danny_From_Tower, Encephalatic: Thank you both for your responses.
    Here is what I have done so far. I have a button called "btnAccept" created in the class MyMenu.
    and declared as public.
    public class MyMenu {
        public JButton btnAccept;
         //Constructor
         public MyMenu()     {
              btnAccept = new JButton("Accept");
    }     I instantiate an object for MyMenu class in the main application class MyApp.
    public class MyApp {
         private     MyMenu menu;
         //Constructor     
         public MyApp(){
              menu = new MyMenu();     
         public void openOrder(){
               MyGUI MyIntFrame = new MyGUI(menu.btnAccept);          
    }I pass this button all the way down to the class detail02. Now I want to set up a listener for this
    button in the class detail02. I am not able to do this.
    public class MyGUI {
         private JButton acceptButton;
         private detail02 dtl1 = new detail02(acceptButton);
         //Constructor
         public AppGUI(JButton iButton){
         acceptButton = iButton;
    public class detail02{
        private JButton acceptButton;
        //Constructor
        public detail02(JButton iButton){
          acceptButton = iButton;
          acceptButton.addActionListener(new acceptListener());               
       //method
        private void acceptListener_actionPerformed(ActionEvent e){
           System.out.println("Menu item [" + e.getActionCommand(  ) + "] was pressed.");
        class acceptListener implements ActionListener {       
            public void actionPerformed(ActionEvent e) {
                   acceptListener_actionPerformed(e);
    }  I am not able to get the button Listener to work. I get NullPointerException at this line
              acceptButton.addActionListener(new acceptListener());in the class detail02.
    Is this the right way? Or is there a better way of accomplishing my objective?
    Please help. Your inputs are precious! Thank you very much for your time!

  • Reading global attributes from implementation class

    Hi,
    How to access
                    global attributes of implementation class
                             from getter method of context node class.
    Thanks in advance,
    Srinivas.

    Hi Srinivasa,
    Access the view controller using attribute
    owner
    , Then you can access the global attributes.
    Regards,
    Masood Imrani S.

  • Problem using repaint() method from another class

    I am trying to make tower of hanoi...but unable to transfer rings from a tower to another...i had made three classes....layout21 where all componentents of frame assembled and provided suitable actionlistener.....second is mainPanel which is used to draw the rods n rings in paintComponent.....and third is tower in which code for hanoi is available...i had made an object of mainPanel at layoout21 n tower but i m not able to call repaint from tower..gives an error : cannot find the symbol....method repaint in tower.
    code fragments od three classes are:
    LAYOUT21
    class layout21 extends JFrame implements ActionListener
    { private Vector rod1 = new Vector();
    private Vector rod2 = new Vector();
    private Vector rod3 = new Vector();
    private String elem; //comment
    public String r22;
    public boolean in=false;
    public int count=0; //no of times the transfer to other rods performed
    private int r3,rings; // current no of rings
    private JComboBox nor,col;
    private JLabel no;
    private JLabel moved;
    private JLabel no1;
    private JButton start;
    private JButton ref;
    private AboutDialog dialog;
    private JMenuItem aboutItem;
    private JMenuItem exitItem;
    private tower t;
    final mainPanel2 p =new mainPanel2();
    public layout21()
    { t = new tower();
         Toolkit kit =Toolkit.getDefaultToolkit();
    Image img = kit.getImage("java.gif");
    setIconImage(img);
    setTitle("Tower Of Hanoi");
    setSize(615,615);
    setResizable(false);
    setBackground(Color.CYAN);
         JMenuBar mbar = new JMenuBar();
    setJMenuBar(mbar);
    JMenu fileMenu = new JMenu("File");
    mbar.add(fileMenu);
    aboutItem = new JMenuItem("About");
    aboutItem.addActionListener(this);
    fileMenu.add(aboutItem);
    exitItem = new JMenuItem("Exit");
    exitItem.addActionListener(this);
    fileMenu.add(exitItem);
    Container contentPane =getContentPane();
    JPanel bspanel = new JPanel();
    JPanel bnpanel = new JPanel();
    setBackground(Color.CYAN);
         //JComboBox
    nor = new JComboBox();
    nor.setEditable(false);
    nor.addItem("3");
    nor.addItem("4");
    nor.addItem("5");
    nor.addItem("6");
    nor.addItem("7");
    nor.addItem("8");
    nor.addItem("9");
    bspanel.add(nor);
    col = new JComboBox();
    col.setEditable(false);
    col.addItem("BLACK");
    col.addItem("GREEN");
    col.addItem("CYAN");
    bspanel.add(col);
    JLabel tl = new JLabel("Time");
    tl.setFont(new Font("Serif",Font.BOLD,12));
    bspanel.add(tl);
    JTextField tlag = new JTextField("0",4);
    bspanel.add(tlag);
    start =new JButton("Start");
    bspanel.add(start);
    ref =new JButton("Refresh");
    bspanel.add(ref);
    JButton end =new JButton("End");
    bspanel.add(end);
    start.addActionListener(this);
    nor.addActionListener(this);
    col.addActionListener(this);
    ref.addActionListener(this);
    end.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    dispose(); // Closes the dialog
    contentPane.add(bspanel,BorderLayout.SOUTH);
    JLabel count = new JLabel("No of Transfer reguired:");
    count.setFont(new Font("Serif",Font.BOLD,16));
    bnpanel.add(count);
    no = new JLabel("7");
    no.setFont(new Font("Serif",Font.BOLD,16));
    bnpanel.add(no);
    JLabel moved = new JLabel("Moved:");
    moved.setFont(new Font("Serif",Font.BOLD,16));
    bnpanel.add(moved);
    no1 = new JLabel("0");
    no1.setFont(new Font("Serif",Font.BOLD,16));
    bnpanel.add(no1);
    contentPane.add(bnpanel,BorderLayout.NORTH);
    contentPane.add(p,BorderLayout.CENTER);
         String r = (String)nor.getSelectedItem();
    rings = Integer.valueOf(r).intValue();
    p.draw(rings,1) ;
    public void actionPerformed(ActionEvent evt)
    {  Object source = evt.getSource();
    if(source == start)
    r3 = Integer.valueOf((String)nor.getSelectedItem()).intValue();
    p.transfer(false);
    t.initialise(rod1,rod2,rod3,0);
    t.towerOfHanoi(r3);
         //repaint();
         if(source == ref)
    { rod1.removeAllElements() ;
    rod2.removeAllElements() ;
    rod3.removeAllElements() ;
    count=0;
              r3 = Integer.valueOf((String)nor.getSelectedItem()).intValue();
              p.draw(r3,1);
    p.transfer(true);
    no1.setText(""+0);
    p.trans_vec(rod1,rod2,rod3);
    t.initialise(rod1,rod2,rod3,0);
              System.out.println("");
              repaint();
    if(source == nor)
    { JComboBox j = (JComboBox)source;
    String item = (String)j.getSelectedItem();
    int ring1 = Integer.valueOf(item).intValue();
    int a=1;
    for(int i=1;i<=ring1;i++)
    { a = a*2;
    a=a-1;
    no.setText(""+a);
    p.draw(ring1,1);
    repaint();
    if(source == aboutItem)
    {  if (dialog == null) // first time
    dialog = new AboutDialog(this);
    dialog.setVisible(true);
    if(source == exitItem)
    {  System.exit(0);
         if (source==col)
         { JComboBox j = (JComboBox)source;
    String item = (String)j.getSelectedItem();
              repaint();
    TOWER
    class tower extends Thread
    { private Vector rod1 = new Vector();
    private Vector rod2 = new Vector();
    private Vector rod3 = new Vector();
    private int count ;
    private String elem;
    final mainPanel2 z =new mainPanel2();
    public void initialise(Vector r1,Vector r2,Vector r3,int c)
    { rod1 = r1;
    rod2 = r2;
         rod3 = r3;
         count =c;
    public void towerOfHanoi(int rings)
    for(int i=0;i<rings;i++)
    rod1.add(" "+(i+1));
    System.out.println("rod1:"+rod1.toString());
    hanoi(rings,1,2);
    public void hanoi(int m,int i, int j)
    if(m>0)
    { hanoi(m-1,i,6-i-j);
    if(i==1 && j==2 && rod1.isEmpty()==false)
    { count++;
    //no1.setText(""+count);
    elem = (String)rod1.remove(0);
    rod2.add(0,elem);
         //z.trans_vec(rod1,rod2,rod3);
    repaint(); //NOT ABLE TO USE METHOD HERE...WHY??
    //z.hanoi_paint();
    try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 2:"+rod2.toString());
    if(i==1 && j==3 && rod1.isEmpty()==false)
    { count++;
         //no1.setText(""+count);
         elem = (String)rod1.remove(0);
    rod3.add(0,elem);
    //z.trans_vec(rod1,rod2,rod3);
    repaint();//
    // z.hanoi_paint();
                   try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 3:"+rod3.toString());
    if(i==2 && j==1 && rod2.isEmpty()==false)
    { count++;
         //no1.setText(""+count);
         elem = (String)rod2.remove(0);
    rod1.add(0,elem);
    //z.trans_vec(rod1,rod2,rod3);
    repaint();
    //z.hanoi_paint();
    try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 1:"+rod1.toString());
    if(i==2 && j==3 && rod2.isEmpty()==false)
    { count++;     
         //no1.setText(""+count);
         elem = (String)rod2.remove(0);
    rod3.add(0,elem);
    //z.trans_vec(rod1,rod2,rod3);
    repaint();
    //z.hanoi_paint();
    try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 3:"+rod3.toString());
    if(i==3 && j==1 && rod3.isEmpty()==false)
    { count++;
         //no1.setText(""+count);
    elem = (String)rod3.remove(0);
    rod1.add(0,elem);
    //z.trans_vec(rod1,rod2,rod3);
    repaint();
    //z.hanoi_paint();
         try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 1:"+rod1.toString());
    if(i==3 && j==2 && rod3.isEmpty()==false)
    { count++;
         //no1.setText(""+count);
    elem = (String)rod3.remove(0);
    rod2.add(0,elem);
    //z.trans_vec(rod1,rod2,rod3);
    repaint();
    //z.hanoi_paint();
    try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 2:"+rod2.toString());
    hanoi(m-1,6-i-j,j);
    MAINPANEL
    class mainPanel2 extends JPanel //throws IOException
    public Vector line = new Vector();
    public Vector rod11= new Vector();
    public Vector rod22= new Vector();
    public Vector rod33= new Vector();
    public int no_ring;
    public int rod_no;
    String pixel;
    StringTokenizer st,st1;
    int x,y;
    public boolean initial =true;
    public void paintComponent(Graphics g)
    { System.out.println("repaint test");
    bresenham(100,60,100,360);
         bresenham(101,60,101,360);
    bresenham(102,60,102,360);
    bresenham(103,60,103,360);
    bresenham(104,60,104,360);     
    g.setColor(Color.BLUE);
    while(line.size()>0)
    { pixel = (String)line.remove(0);
    st = new StringTokenizer(pixel);
    x = Integer.valueOf(st.nextToken()).intValue();
    y = Integer.valueOf(st.nextToken()).intValue();
    g.drawLine(x,y,x,y);
    bresenham(300,60,300,360);
    bresenham(301,60,301,360);
    bresenham(302,60,302,360);
    bresenham(303,60,303,360);
    bresenham(304,60,304,360);     
    while(line.size()>0)
    { pixel = (String)line.remove(0);
    st = new StringTokenizer(pixel);
    x = Integer.valueOf(st.nextToken()).intValue();
    y = Integer.valueOf(st.nextToken()).intValue();
    g.drawLine(x,y,x,y);
    bresenham(500,60,500,360);
    bresenham(501,60,501,360);
    bresenham(502,60,502,360);
    bresenham(503,60,503,360);
    bresenham(504,60,504,360);     
    while(line.size()>0)
    { pixel = (String)line.remove(0);
    st = new StringTokenizer(pixel);
    x = Integer.valueOf(st.nextToken()).intValue();
    y = Integer.valueOf(st.nextToken()).intValue();
    g.drawLine(x,y,x,y);
    bresenham(0,361,615,361);//used to get a pixel according to algo.. . func not provided
    bresenham(0,362,615,362);
    bresenham(0,363,615,363);
    bresenham(0,364,615,364);
    bresenham(0,365,615,365);     
    while(line.size()>0)
    { pixel = (String)line.remove(0);
    st = new StringTokenizer(pixel);
    x = Integer.valueOf(st.nextToken()).intValue();
    y = Integer.valueOf(st.nextToken()).intValue();
    g.drawLine(x,y,x,y);
    if(initial==true)
    g.setColor(Color.RED);
    for(int i = no_ring;i>0;i--)
    { g.drawLine(100-(i*8),360-(no_ring - i)*10,100+(i*8)+5,360-(no_ring - i)*10);
    g.drawLine(100-(i*8),359-(no_ring - i)*10,100+(i*8)+5,359-(no_ring - i)*10);
    g.drawLine(100-(i*8),358-(no_ring - i)*10,100+(i*8)+5,358-(no_ring - i)*10);
    g.drawLine(100-(i*8),357-(no_ring - i)*10,100+(i*8)+5,357-(no_ring - i)*10);
    g.drawLine(100-(i*8),356-(no_ring - i)*10,100+(i*8)+5,356-(no_ring - i)*10);
    // draw for each rod
    //System.out.println("rod11:"+rod11);
    //System.out.println("rod22:"+rod22);
    //System.out.println("rod33:"+rod33);
         int r1 = rod11.size();
         int r2 = rod22.size();
         int r3 = rod33.size();
    String rd1,rd2,rd3;
    int r11,r12,r21,r22,r31,r32;
    if(initial == false)
         { g.setColor(Color.RED);
         while(rod11.size()>0)
    { r12 = rod11.size()-1;
              rd1 = (String)rod11.remove(r12);
    r11 = Integer.valueOf(rd1).intValue();
    g.drawLine(100-((r11+1)*8),360-(r1 - (r11+1))*10,100+((r11+1)*8)+5,360-(r1 - (r11+1))*10);
    g.drawLine(100-((r11+1)*8),359-(r1 - (r11+1))*10,100+((r11+1)*8)+5,359-(r1 - (r11+1))*10);
              g.drawLine(100-((r11+1)*8),358-(r1 - (r11+1))*10,100+((r11+1)*8)+5,358-(r1 - (r11+1))*10);
              g.drawLine(100-((r11+1)*8),357-(r1 - (r11+1))*10,100+((r11+1)*8)+5,357-(r1 - (r11+1))*10);
              g.drawLine(100-((r11+1)*8),356-(r1 - (r11+1))*10,100+((r11+1)*8)+5,356-(r1 - (r11+1))*10);
         while(rod22.size()>0)
    { g.setColor(Color.RED);
              r22 = rod22.size()-1;
         System.out.println("TEST *************************:"+r22);
              try
         // e.printStackTrace();      
              InputStreamReader isr = new InputStreamReader(System.in);
         BufferedReader br = new BufferedReader(isr)      ;
         br.readLine() ;
         }catch(Exception f) {}
              rd2 = ((String)rod22.remove(r22)).trim();
    r21 = Integer.valueOf(rd2).intValue();
    g.drawLine(300-((r22+1)*8),360-(r2 - (r22+1))*10,300+((r22+1)*8)+5,360-(r2 - (r22+1))*10);
    g.drawLine(300-((r22+1)*8),359-(r2 - (r22+1))*10,300+((r22+1)*8)+5,359-(r2 - (r22+1))*10);
              g.drawLine(300-((r22+1)*8),358-(r2 - (r22+1))*10,300+((r22+1)*8)+5,358-(r2 - (r22+1))*10);
              g.drawLine(300-((r22+1)*8),357-(r2 - (r22+1))*10,300+((r22+1)*8)+5,357-(r2 - (r22+1))*10);
              g.drawLine(300-((r22+1)*8),356-(r2 - (r22+1))*10,300+((r22+1)*8)+5,356-(r2 - (r22+1))*10);
         while(rod33.size()>0)
    { g.setColor(Color.RED);
              r32 = rod33.size()-1;
              rd3 = (String)rod33.remove(r32);
    r31 = Integer.valueOf(rd3).intValue();
    g.drawLine(500-((r32+1)*8),360-(r3 - (r32+1))*10,500+((r32+1)*8)+5,360-(r3 - (r32+1))*10);
    g.drawLine(500-((r32+1)*8),359-(r3 - (r32+1))*10,500+((r32+1)*8)+5,359-(r3 - (r32+1))*10);
              g.drawLine(500-((r32+1)*8),358-(r3 - (r32+1))*10,500+((r32+1)*8)+5,358-(r3 - (r32+1))*10);
              g.drawLine(500-((r32+1)*8),357-(r3 - (r32+1))*10,500+((r32+1)*8)+5,357-(r3 - (r32+1))*10);
              g.drawLine(500-((r32+1)*8),356-(r3 - (r32+1))*10,500+((r32+1)*8)+5,356-(r3 - (r32+1))*10);
    why i m not able to use repaint() method in tower class? from where i can use repaint() method

    i can't read your code - not formatted with code tags
    I have no chance of getting it to compile (AboutDialog class?? p.draw() ??)
    here's a basic routine - add a couple of things to this to demonstrate what is not
    being redrawn
    (compare the readability of below code (using tags) to yours)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class Testing extends JFrame
      public Testing()
        setSize(400,300);
        setLocation(400,300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        final DrawPanel dp = new DrawPanel();
        JButton btn = new JButton("Change Text Location/Repaint");
        getContentPane().add(dp,BorderLayout.CENTER);
        getContentPane().add(btn,BorderLayout.SOUTH);
        btn.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent ae){
            dp.x = (int)(Math.random()*300);
            dp.y = (int)(Math.random()*150)+50;
            repaint();}});
      public static void main(String[] args){new Testing().setVisible(true);}
    class DrawPanel extends JPanel
      int x = 50, y = 50;
      public void paintComponent(Graphics g)
        super.paintComponent(g);
        g.drawString("Hello World",x,y);
    }

Maybe you are looking for

  • JMS ReplyTo - RequestQ and ResponseQ are in different Managed Servers

    Hopefully this brief summary explains the issue: 1) Two managed servers, ServerA and ServerB 2) ServerA has JMSServerA with ResponseQ (hosted at t3:\\A) 3) ServerB has JMSServerB with RequestQ (hosted at t3::\\B) a) Standalone JMS client sends messag

  • Tomcat and apache mod_jk or mod_webapp

    Hello,I am using linux and I am running a apache web server and I also use tomcat. I have upgraded from tomcat 4.0 to 4.1.24 and I am now wanting to use servlets and jsp with apache.I have messed around with servlet etc for awhile now but I wish to u

  • As of Inventory Reporting

    Hi, I am using Oracle EBS 12.0.6. Is there a report/utility program that will provide costed inventory as of a particular date in the past? Thanks in advance

  • Cant get my my ipod shuffle to load on to my imac computer

    i cant seem to get my daughters ipod shuffle to be reconized to my imac computer. im not sure if its because the thing is dead. i alos didnt get a disc with the ipod i bought it off ebay about a year ago.im kinda stumped on this. please help. thanks!

  • Error OEM java.lang.Exception: Exception in sending Request :: null

    Hi there guys, i get the error when i trying to connect to OEM java.lang.Exception: Exception in sending Request :: null the installation went without any hitch, the instance is up and running, but when i use the console i get the error $emctl status