Plz help!! array of object (for search)

i've got few questions of array of object
1-how to search for a price that is greater than 300 in the array of object
and how to list all of them?
2- how to search for the smallest price in the array of object, and how to list?
can anyone provde a java code for me:P?
but plz don't too complex
coz i'm a learner of javaT_T

_< i still can't understand, and dunno how to change into the code that i needand you guyz help me change it?
/*wirte the driver program which will define and create an array of
objects instantiated from the class WaterBill
Create Accessor and Mutator methods to get/set data from the class.
write code within the driver method to perfrom the following:
a) The final total of funds
b) To search for accounts greater than $300 in the array of objects,
     and list all the customer details
c)To search for the lowest bill in the array of objects, and list
those customer dtails
Class definitions and Objects  using price
import java.text.*;
import javax.swing.JOptionPane;
public class Pre_pb3
     public static void main(String []args)
          int  TTc=0;
          int accNum[]=new int[20];
          String name[]=new String[20], output, stans, display; //stAccNum, stUsage, stTTc;
          double usage[]=new double[20];
          double TTa=0.0;
          double price[]=new double[20];
          char ans;
          double acctG,lowest;
          int i=0;
          waterBill MYwaterBill = new waterBill();
          ans='Y';
          while (!(ans=='N'))
               name=inputName();
               accNum[i]=inputAccNum();
               usage[i]=inputUsage();
               price[i]=calculateAmountOwing(usage[i]);
               TTa=MYwaterBill.TTaPrice(price[i]);
               output=MYwaterBill.outputInfo(name[i], accNum[i], usage[i], price[i]);
               waterBill MYwaterBill2= new waterBill(name[i], accNum[i],usage[i], price[i]);     
               stans=JOptionPane.showInputDialog("Do you wanna continue?, (Y)es, (N)o");
               stans = stans.substring(0, 1);
               stans=stans.toUpperCase();
               ans=stans.charAt(0);
               TTc++;     
          MYwaterBill.outputoutput(TTc, TTa);
          MYwaterBill.findGreat();     //b)
          MYwaterBill.searchDetail();     //c)
          System.exit(0);                                                  
     public static String inputName()
               String name;
               name=JOptionPane.showInputDialog("Enter Name ");
               return name;
     public static int inputAccNum()
          int accNum;
          String stAccNum;
          stAccNum=JOptionPane.showInputDialog("Enter Account Number");
          accNum=Integer.parseInt(stAccNum);
          return accNum;
     public static double inputUsage()
          double usage;
          String stUsage;
          stUsage=JOptionPane.showInputDialog("Enter Water Usage");
          usage=Double.parseDouble(stUsage);
          if (!(usage>=0 && usage<=99999999))
               System.out.println("water useage is invalid");
               System.exit(0);
          return usage;
     public static double calculateAmountOwing(double usage)
          double price=0.0;
          if (usage>=0)
               if (usage<=10000)
                    price=(10000/10)*0.01;
               else if (usage>10000)
                    price=((10000/10)*0.01)+(((usage-10000)/10)*0.02);
          else
                    System.out.println("Error of usage");
               return price;
class waterBill
     private static     int TTc=0 ,accNum=0;
     private static String name, stAccNum, stUsage, stTTc;
     private static String output=" ";
     private static double usage=0.0;
     private static double TTa=0.0;
     private static double price=0.0;
     private static String lowest;
     public waterBill()
          name=" ";
          accNum=0;
          usage=0.0;
          price=0.0;
     public waterBill(String n,int an, double us, double p)
          setName(n);
          setAccNum(an);
          setUsage(us);
          setPrice(p);
     public void setName(String n)
          name=n;
     public void setAccNum(int an)
          accNum=an;
     public void setUsage(double us)
          usage=us;
     public void setPrice(double p)
          price=p;
     public String getName()
          return name;
     public int getAccNum()
          return accNum;
     public double getUsage()
          return usage;
     public double getPrice()
          return price;
     public double TTaPrice(double price)
          TTa=TTa + price;
          return TTa;
     public String outputInfo(String name, int accNum, double usage, double price )
          String output=" ";                         
          output: System.out.println( "Account Number: "+ accNum +
                                   "\nWater Usage: " + usage +
                                   "\nCost Owing: " price
                                   "\nName: "+ name+"\n");
          return output;
     public void outputoutput(int TTc, double TTa)
          display:     System.out.println("Total customer: "+ TTc +
                              "\nTotal amount owing: " + TTa + "\n\n");
     public void findGreat()//search the a/c that is greater than 300.
          //dunno how to do, so i just leave it blank^^"
          public String searchDetail()//search the smallest a/c
          //same...dunno how to doT_T     

Similar Messages

  • Hi, i am badly in need of help. i partitioned my mac hd yesterday and now the boot camp is nt working as i was using win 7 on it. i am using macbook pro 13'' 2011. plz help me. anxiously waiting for response... specially from "Christopher"

    hi, i am badly in need of help. i partitioned my mac hd yesterday and now the boot camp is nt working as i was using win 7 on it. i am using macbook pro 13'' 2011. plz help me. anxiously waiting for response... specially from "Christopher murphy"

    you can't add or mofidy partition numbers. especially not if and once you have windows installed.
    boot from Windows 7 DVD afterwards
    but first you have to tell us and Christopher what and how you partitioned your system.
    Successful setup of OS X Lion + Data Partition + Bootcamp Win7 Ult
    https://discussions.apple.com/thread/3293948
    So after many, many hours I think I've finally figured out how to successfully setup Mac OS X Lion on one partition, a seperate data partition, and Windows 7 Ultimate on a Bootcamp partition . Here is a screenshot of my setup on my 13" MacBook Pro
    Thread with suggestions on Windows backup methods:
    https://discussions.apple.com/thread/3798090
    Paragon CampTune
    Paragon CampTune is a commercial product that is designed expressly for this task. http://www.paragon-software.com/home/camptune/ It consists of a downloadable ISO that needs to be burned to a disc and booted from in order to resize the partitions costs US$19.95.
    Securing Dual-System Configuration
    Imaging is still the most affordable and robust way to secure computer data. Unfortunately Mac OS X backs up only HFS+ volumes, leaving Windows with dual-system configurations unsecured. You can permanently lose all of your data unless you have a Windows-compatible backup solution.
    Paragon’s CampTune and Paragon’s Drive Copy for Mac can secure the entire dual-system configuration. CampTune creates traditional images of volumes or entire hard disks, Drive Copy can copy them to other disks. In case of an emergency, you can restore the previously created image or copy all your data back to its original state.
    GParted Live
    GParted Live is similar to CampTune as it is also distributed as a bootable image that needs to be copied to a CD/DVD or USB flash drive. As free and open source software, distributed under the GPL, it will always be available free. Since it has more functions than CampTune, it may be harder for folks who are not as experienced with partitioning hard drives. http://gparted.sourceforge.net/
    iPartition
    Coriolis Systems' iPartition is a £29.95 ($44.95 US) utility that runs in Mac OS X and allows resizing of all of the relevant partition formats, including HFS+, FAT32, and NTFS. It provides a Mac-oriented user interface that may be easier to manage than some of the free utilities. As it is not capable of resizing the boot disk, it requires a bootable external disk or a boot DVD. (A tool to create a boot DVD is included.)
    Paragon Partition Manager
    From the makes of CampTune is a commercial tool that is similar in functionality to GParted Live, but has a more polished/friendly user interface than GParted Live. Previously only the US$79.95 Professional version supported all the features required for this, but as of version 11 the US$39.95 Personal version has also been reported to work. http://www.paragon-software.com/home/pm-personal/
    Winclone/Disk Utility
    Winclone is a free tool for creating and restoring backup images of your Windows partition. One of its key features is that it can restore to a larger partition than the one the image was created from.
    NOTE: Winclone has been discontinued, but for now remains available and capable of completing these tasks (including creating and restoring Windows 7 images).
    Winclone updated to support Lion Winclone updates and download
    Disk Utility can resize HFS+ (Mac OS) partitions, but is currently incapable of resizing NTFS partitions, so you could use it to reduce the size of the HFS+ partition and create a new larger placeholder MS-DOS (FAT) partition
    The full process would be:
    Backup Windows partition with Winclone.
    (if the new Windows partition is smaller than the old one make sure you set the preferences in Winclone to save the image as an uncompressed dmg)
    Delete old Windows partition
    Resize current Mac Partition
    Create new Windows partition as MS-DOS (FAT) in free space after Mac OS partition.
    (If the new Windows partition is smaller than the old one an additional step is required: shrink the filesystem on the image by selecting Tools->Shrink Windows (NTFS) Filesystem)
    Reboot your computer for the new Windows partition to mount properly (winclone may not restore if you don't reboot)
    Restore Winclone partition over new Windows partition
    An alternate Winclone based process is described in the External Guides section
    Native OS utilities
    MR user Kazyua reports that you can use the disk management utilities provided with the current operating systems if you want to do it manually. Windows 7 and OS X both have partition resizing functions built in. In OS X, open Disk Utility and manually shrink the mac HFS+ partition by dragging the lower right corner. Then in windows go to the start menu and type "disk management" into the search box then hit enter. You should get an overview of the drives you have and the individual partitions. Right-clicking on the partition gives an "Extend Volume" option. The Windows NTFS volume should then be extended into the free space you created with Disk Utility. This method has not worked for other users, so try at your own risk.
    Resizing under VMWare Fusion
    If you are looking to allocate more space to Windows under VMWare please refer to the following thread http://forums.macrumors.com/showthread.php?t=828182
    From http://guides.macrumors.com/Extend/Resize_Boot_Camp_Partition
    Thread with suggestions on Windows backup methods:
    https://discussions.apple.com/thread/3798090

  • Hey all..i hv problm .. i cant connect wifi properly ..its stucking itself after evry 5 mints and reconnect after evry 5 mints ..plz helpe...sorry for bad english but hope u will understand

    hey all..i hv problm .. i cant connect wifi properly ..its disconnect itself after evry 5 mints and reconnect after evry 5 mints.. signal showing but there is no avail internet ..plz helpe...sorry for bad english but hope u will understand..

    If your connection won't 'stick', check for interference in that area from other devices on competing channels, etc.
    Configure your choice of band/channel with interference robustness, but mainly reduce the sources to be sure it's not just a too noisy environement.
    Still no joy, be sure your software is up to date and then walk it into the nearest Apple store for a professional opinion
    Good luck in any case.

  • Plz help me out with for all entries

    hi to all experts,
                              This is my sample code plz tell me how to output the data.plz help me out.im very much beginner in ABAP and i dont want to use loop and endloop is there any way
                                  REPORT  Z_FORALLENTERIES                        .
    types : begin  of ty_lfa1,
              lifnr type lfa1-lifnr,
              name1 type lfa1-name1,
              land1 type lfa1-land1,
            end of ty_lfa1.
    types : begin of ty_lfb1 ,
              lifnr type lfb1-lifnr,
              bukrs type lfb1-bukrs,
              pernr type lfb1-pernr,
            end of ty_lfb1.
    types : begin of ty_lfc1 ,
              lifnr type lfc1-lifnr,
              gjahr type lfc1-gjahr,
              usnam type lfc1-usnam,
             end of ty_lfc1.
    types :  begin of ty_lfbk ,
              lifnr type lfbk-lifnr,
              banks type lfbk-banks,
              bankl type lfbk-bankl,
              bankn type lfbk-bankn,
            end of ty_lfbk.
    types : begin of ty_final,
              lifnr type lfa1-lifnr,
              name1 type lfa1-name1,
              land1 type lfa1-land1,
              bukrs type lfb1-bukrs,
              pernr type lfb1-pernr,
              gjahr type lfc1-gjahr,
              usnam type lfc1-usnam,
              banks type lfbk-banks,
              bankl type lfbk-bankl,
              bankn type lfbk-bankn,
            end of ty_final.
    data : it_lfa1 type standard table of ty_lfa1 initial size 0 with header line.
    data : it_lfb1 type standard table of ty_lfb1 initial size 0 with header line.
    data : it_lfc1 type standard table of ty_lfc1 initial size 0 with header line.
    *--internal for outputting data--
    data : it_lfbk type standard table of ty_lfbk initial size 0 with header line.
    data : it_final type  standard table of ty_final initial size 0,
           wa_final like line of it_final.
    select lifnr name1 land1
           into table it_lfa1[]
           from lfa1 up to 10 rows.
    if it_lfa1[]  is not initial.
    select lifnr bukrs pernr
           into table it_lfb1[]
           from lfb1
           for all entries in it_lfa1[]
           where lifnr eq it_lfa1-lifnr.
    endif.
    if it_lfb1[] is not initial.
    select lifnr gjahr usnam
           into table it_lfc1[]
           from lfc1
           for all entries in it_lfb1[]
           where lifnr eq it_lfb1-lifnr.
    endif.
    if it_lfc1[] is not initial.
    select lifnr banks bankl bankn
           into table it_lfbk[]
           from lfbk
           for all entries in it_lfc1[]
           where lifnr eq it_lfc1-lifnr.
    endif.

    Hi
    see this program  almost same req
    **************DATA TYPES DECLARATION **********************
    TABLES: HRP1001, HRP1026, HRP1000,PCHDY.
    TYPE-POOLS SLIS.
    TYPES :BEGIN OF ST_OUTPUT,
            COUNT TYPE STRING,
            OBJID TYPE HRP1001-OBJID,
            STEXT TYPE HRP1000-STEXT,
            BEGDA TYPE HRP1000-BEGDA,
            ENDDA TYPE HRP1000-ENDDA,
            CANCRT TYPE T77CRT-CANCRT,
            AEDTM TYPE HRP1026-AEDTM,
            UNAME TYPE HRP1026-UNAME,
            LSTEXT TYPE HRP1000-STEXT,
           RINVT TYPE T777V-RINVT,
           END OF ST_OUTPUT.
    TYPES: BEGIN OF ST_HRP1000,
            OBJID TYPE HRP1001-OBJID,
            STEXT TYPE HRP1000-STEXT,
           END OF ST_HRP1000.
    TYPES : BEGIN OF ST_HRP1001,
             OTYPE TYPE HRP1001-OTYPE,
             OBJID TYPE HRP1001-OBJID,
             RELAT type hrp1001-RELAT,
             BEGDA TYPE HRP1001-BEGDA,
             ENDDA TYPE HRP1001-ENDDA,
             SCLAS TYPE HRP1001-SCLAS,
             SOBID TYPE HRP1001-SOBID,
            END OF ST_HRP1001.
    TYPES : BEGIN OF ST_HRP1026,
             OTYPE TYPE HRP1026-OTYPE,
             OBJID TYPE HRP1001-OBJID,
             AEDTM TYPE HRP1026-AEDTM,
             UNAME TYPE HRP1026-UNAME,
             DELET TYPE HRP1026-DELET,
             CANCR TYPE HRP1026-CANCR,
            END OF ST_HRP1026.
    TYPES : BEGIN OF ST_REASON,
             CANCR TYPE HRP1026-CANCR,
             CANCRT TYPE T77CRT-CANCRT,
            END OF ST_REASON.
    TYPES : BEGIN OF ST_SOBID,
             OTYPE TYPE HRP1001-OTYPE,
             OBJID TYPE HRP1001-OBJID,
             RELAT type hrp1001-OBJID,
             BEGDA TYPE HRP1001-BEGDA,
             ENDDA TYPE HRP1001-ENDDA,
             SCLAS TYPE HRP1001-SCLAS,
             SOBID TYPE HRP1001-OBJID,
            END OF ST_SOBID.
    TYPES : BEGIN OF ST_OBJID,
             OBJID TYPE HRP1001-OBJID,
            END OF ST_OBJID.
    TYPES : BEGIN OF ST_LOCATION,
             OTYPE TYPE HRP1001-OTYPE,
             OBJID TYPE HRP1001-OBJID,
             RSIGN TYPE HRP1001-RSIGN,
             RELAT TYPE HRP1001-RELAT,
             SCLAS TYPE HRP1001-SCLAS,
             SOBID TYPE HRP1001-SOBID,
            END OF ST_LOCATION.
    TYPES : BEGIN OF ST_LOCATION1,
             OTYPE TYPE HRP1001-OTYPE,
             OBJID TYPE HRP1001-OBJID,
             RSIGN TYPE HRP1001-RSIGN,
             RELAT TYPE HRP1001-RELAT,
             SCLAS TYPE HRP1001-SCLAS,
             SOBID TYPE HRP1001-OBJID,
            END OF ST_LOCATION1.
    TYPES : BEGIN OF ST_LSTEXT,
             OTYPE TYPE HRP1000-OTYPE,
             OBJID TYPE HRP1000-OBJID,
             LSTEXT TYPE HRP1000-STEXT,
            END OF ST_LSTEXT.
    TYPES : BEGIN OF ST_OBJID_SH,
             OTYPE TYPE HRP1000-OTYPE,
             OBJID TYPE HRP1000-OBJID,
            END OF ST_OBJID_SH.
    DATA : IT_OBJID_SH TYPE STANDARD TABLE OF ST_OBJID_SH.
    DATA : WA_OBJID_SH TYPE ST_OBJID_SH.
    DATA : IT_LSTEXT TYPE STANDARD TABLE OF ST_LSTEXT.              "TOS STORE THE TEXT OF COURCE LOCATION
    DATA : WA_LSTEXT TYPE ST_LSTEXT.
    DATA : IT_LOCATION TYPE STANDARD TABLE OF ST_LOCATION.          " TO STORE THE LOCATION OF COURCE
    DATA : WA_LOCATION TYPE ST_LOCATION.
    DATA : IT_LOCATION1 TYPE STANDARD TABLE OF ST_LOCATION1.        " TO CONVERT SOBID INTO OBJID FOR COURCE LOCATION
    DATA : WA_LOCATION1 TYPE ST_LOCATION1.
    DATA : IT_SOBID TYPE STANDARD TABLE OF ST_SOBID.                " TO CHANGE THE SOBID OF HRP1001 TO OBJID OF HRP1026
    DATA : WA_SOBID TYPE ST_SOBID.                                   " BY USING FOR ALL ENTRIES
    DATA : IT_REASON TYPE STANDARD TABLE OF ST_REASON.              "TO STORE T HE REASON FOR CANCELL TEXT
    DATA : WA_REASON TYPE ST_REASON.
    DATA : IT_OUTPUT TYPE STANDARD TABLE OF ST_OUTPUT.               "OUTPUT FEILDS OF REPORT.
    DATA : WA_OUTPUT TYPE ST_OUTPUT.
    DATA : IT_OUTPUT_1 TYPE STANDARD TABLE OF ST_OUTPUT.               " TEMP OUTPUT FEILDS OF REPORT.
    DATA : WA_OUTPUT_1 TYPE ST_OUTPUT.
    DATA : IT_HRP1000 TYPE STANDARD TABLE OF ST_HRP1000.             "DATA FROM HRP1000 TABLE
    DATA : WA_HRP1000 TYPE ST_HRP1000.
    DATA : IT_HRP1001 TYPE STANDARD TABLE OF ST_HRP1001.             "DATA FROM HRP1001 TABLE
    DATA : WA_HRP1001 TYPE ST_HRP1001.
    DATA : IT_HRP1026 TYPE STANDARD TABLE OF ST_HRP1026.              "DATA FROM HRP1026 TABLE
    DATA : WA_HRP1026 TYPE ST_HRP1026.
    DATA : IT_OBJID TYPE STANDARD TABLE OF ST_OBJID.                  " TO STORE THE OBJID OF HRP1001
    DATA : WA_OBJID TYPE ST_OBJID.
    DATA: WS_FCAT    TYPE SLIS_FIELDCAT_ALV .                         " FEILDCATALOG FOR ALV REPORT
    DATA: IN_FCAT    TYPE SLIS_T_FIELDCAT_ALV.
    DATA: W_LAYOUT   TYPE SLIS_LAYOUT_ALV.
    DATA : LV_COUNT TYPE I.                                           "FEILD FOR SERIAL NUMBER
    ***************************END OF DATA DECLARATION******************************************
    ***********SELECTION SCREEN DESIGN***********************
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    *SELECT-OPTIONS : S_OTYPE FOR HRP1001-OTYPE NO INTERVALS .
    SELECT-OPTIONS : S_OBJID FOR HRP1001-OBJID NO INTERVALS .
    SELECT-OPTIONS : DATE FOR SY-DATUM NO-EXTENSION OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1.
    **********END OF SELECTION SCREEN DESIGN*****************
    *****INITIALIZATION VENT TO ASIGN DEFAULT VALUES TO OTYPE
    *INITIALIZATION.
    S_OTYPE-LOW = 'D'.
    S_OTYPE-SIGN = 'I'.
    S_OTYPE-OPTION = 'EQ'.
    APPEND S_OTYPE.
    CLEAR S_OTYPE.
    *************END OF EVENT INITIALIZATION*****************
    *********VALIDATION FOR SCREEN FIELDS********************
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_OBJID-LOW.
    IF S_OBJID IS NOT INITIAL.
        SELECT OTYPE OBJID FROM HRP1000
                     INTO TABLE IT_OBJID_SH
                     WHERE OTYPE = 'D'.
    IF SY-SUBRC EQ 0.
    SEARCH HELP FOR QUALIFICATION.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
                 DDIC_STRUCTURE         = ' '
            RETFIELD               =  'OBJID'
                 PVALKEY                = ' '
           DYNPPROG               = SY-REPID
           DYNPNR                 = SY-DYNNR
           DYNPROFIELD            = 'S_OBJID'
                 STEPL                  = 0
                 WINDOW_TITLE           =
                 VALUE                  = ' '
           VALUE_ORG              = 'S'
                 MULTIPLE_CHOICE        = ' '
                 DISPLAY                = ' '
                 CALLBACK_PROGRAM       = ' '
                 CALLBACK_FORM          = ' '
                 MARK_TAB               =
               IMPORTING
                 USER_RESET             =
          TABLES
            VALUE_TAB              =  IT_OBJID_SH
                 FIELD_TAB              =
                 RETURN_TAB             = RETURN_TAB
                 DYNPFLD_MAPPING        =
               EXCEPTIONS
                 PARAMETER_ERROR        = 1
                 NO_VALUES_FOUND        = 2
                 OTHERS                 = 3
        IF SY-SUBRC <> 0.
              MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
       IF SY-SUBRC NE 0.
         MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA.' TYPE 'E'.
       ENDIF.
    ENDIF.
    REFRESH IT_OBJID.
    ***************VALIDATION OF SCREEN FIELDS ENDS***********
    *****************START OF SELECTION ************************
    START-OF-SELECTION.
      SELECT OTYPE
             OBJID
             RELAT
             BEGDA
             ENDDA
             SCLAS
             SOBID FROM HRP1001 INTO TABLE IT_HRP1001
                        WHERE OTYPE = 'D'
                            AND OBJID IN S_OBJID
                            AND BEGDA GE DATE-LOW
                            AND ENDDA LE DATE-HIGH
                            AND ( SCLAS = 'E' OR SCLAS = 'ET' ).
      IF SY-SUBRC NE 0.
        MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.
      ENDIF.
      LOOP AT IT_HRP1001 INTO WA_HRP1001.
        WA_SOBID-OTYPE = WA_HRP1001-OTYPE.
        WA_SOBID-OBJID = WA_HRP1001-OBJID.
        WA_SOBID-RELAT = WA_HRP1001-RELAT.
        WA_SOBID-BEGDA = WA_HRP1001-BEGDA.
        WA_SOBID-ENDDA = WA_HRP1001-ENDDA.
        WA_SOBID-SCLAS = WA_HRP1001-SCLAS.
        WA_SOBID-SOBID = WA_HRP1001-SOBID.
        APPEND WA_SOBID TO IT_SOBID.
      ENDLOOP.
      SELECT OTYPE
             OBJID
             AEDTM
             UNAME
             DELET
             CANCR
            NCONT
              FROM HRP1026
              INTO TABLE IT_HRP1026
              FOR ALL ENTRIES IN IT_SOBID
                 WHERE OBJID = IT_SOBID-SOBID
                 AND ( OTYPE = 'E' OR OTYPE = 'ET' )
                     AND DELET = 'X' AND
                     BEGDA GE DATE-LOW  AND
                     ENDDA LE DATE-HIGH.
      IF SY-SUBRC EQ 0.
        SELECT OBJID
               STEXT
               FROM HRP1000
               INTO TABLE IT_HRP1000
               FOR ALL ENTRIES IN IT_SOBID
                  WHERE OBJID = IT_SOBID-SOBID AND
                        BEGDA GE DATE-LOW  AND
                        ENDDA LE DATE-HIGH.
        SELECT CANCR
               CANCRT
               FROM T77CRT
               INTO TABLE IT_REASON
               FOR ALL ENTRIES IN IT_HRP1026
               WHERE CANCR = IT_HRP1026-CANCR
                 AND LANGU = 'E' .
    ********PERFORM FOR GETTING T HE LOCATION OF THE COURCE**
      PERFORM GET_LOCATION.
    **************END OF LOCATION OF COURCE ******************
      ELSE.
        MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.
      ENDIF.
    *****PERFORM FOR GETTING DATA INTO THE FINAL INTERNAL TABLE IT_OUTPUT**
      PERFORM GET_DATA.
    *********************************END OF PERFORM ET DATA ***************
    ***********LOGIC FOR PRONTING NUMBER OF RECORDS ***********************
      LV_COUNT = 0.
      LOOP  AT IT_OUTPUT INTO WA_OUTPUT.
        LV_COUNT = LV_COUNT + 1.
        WA_OUTPUT-COUNT = LV_COUNT.
        APPEND WA_OUTPUT TO IT_OUTPUT_1.
      ENDLOOP.
      REFRESH IT_OUTPUT.
      IT_OUTPUT = IT_OUTPUT_1.
    ********************END OF LOGIC FOR NUMBER OF RECORDS ***************
    ****************DISPLAYING OUTPUT BY USEING GRID DISPLAY**********
      PERFORM ALV_DISPLAY.
    ****************************END OF PERFORM FOR DISPLAYING **********
    *&      Form  PERFORM_ALV
    DISPLAY THE RECORDS IN ALV GRID FORMAT.
    FORM ALV_DISPLAY.
      PERFORM FIELD_CATALOG USING 'COUNT' 'Sr. No.'.
      PERFORM FIELD_CATALOG USING 'OBJID' 'COURCE ID.'.
      PERFORM FIELD_CATALOG USING 'STEXT' 'COURCE NAME'.
        PERFORM FIELD_CATALOG USING 'LSTEXT' 'COURCE LOATION'.
      PERFORM FIELD_CATALOG USING 'BEGDA' 'BEGIN DATE '.
      PERFORM FIELD_CATALOG USING 'ENDDA' 'END DATE '.
      PERFORM FIELD_CATALOG USING 'CANCRT' 'REASON'.
      PERFORM FIELD_CATALOG USING 'AEDTM' 'DATE Of CANCEL'.
    PERFORM FIELD_CATALOG USING 'NCONT' 'NUMBER OF BOOKINGS'.
    PERFORM FIELD_CATALOG USING 'LOCTX' 'COURCE LOCATION'.
      PERFORM FIELD_CATALOG USING 'UNAME' 'WHO CANCELLED'.
    PERFORM FIELD_CATALOG USING 'LSTEXT' 'COURCE LOATION'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_STRUCTURE_NAME = 'IT_OUTPUT'
          I_GRID_TITLE     = ' Cancelled courses with reason '
          IT_FIELDCAT      = IN_FCAT
        TABLES
          T_OUTTAB         = IT_OUTPUT.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "PERFORM_ALV
    *&      Form  FIELD_CATALOG
          text
         -->FIELD_NAME text
         -->DIS_TEXT   text
    FORM FIELD_CATALOG USING FIELD_NAME DIS_TEXT.
      CLEAR WS_FCAT.
      WS_FCAT-TABNAME = 'IT_OUTPUT'.
      WS_FCAT-FIELDNAME = FIELD_NAME.
      WS_FCAT-SELTEXT_M = DIS_TEXT.
      APPEND WS_FCAT TO IN_FCAT .
    ENDFORM.                    "FIELD_CATALOG
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA .
    *sort it_sobid by objid.
      LOOP AT IT_SOBID INTO WA_SOBID." where otype eq s_otype and objid eq s_objid.
        READ TABLE IT_HRP1026 WITH KEY OBJID = WA_SOBID-SOBID OTYPE = WA_SOBID-SCLAS INTO WA_HRP1026.
        IF SY-SUBRC EQ 0.
          READ TABLE IT_HRP1000 WITH KEY OBJID = WA_SOBID-SOBID INTO WA_HRP1000.
       READ TABLE IT_REASON WITH KEY CANCR = WA_HRP1026-CANCR INTO WA_REASON.
          WA_OUTPUT-OBJID = WA_HRP1026-OBJID.
          WA_OUTPUT-BEGDA = WA_SOBID-BEGDA.
          WA_OUTPUT-ENDDA = WA_SOBID-ENDDA.
          WA_OUTPUT-AEDTM = WA_HRP1026-AEDTM.
          WA_OUTPUT-UNAME = WA_HRP1026-UNAME.
       WA_OUTPUT-NCONT = WA_HRP1026-NCONT.
       READ TABLE IT_HRP1000 WITH KEY OBJID = WA_SOBID-SOBID INTO WA_HRP1000.
          WA_OUTPUT-STEXT = WA_HRP1000-STEXT.
          READ TABLE IT_REASON WITH KEY CANCR = WA_HRP1026-CANCR INTO WA_REASON.
          WA_OUTPUT-CANCRT = WA_REASON-CANCRT.
          CLEAR WA_REASON-CANCRT.
          READ TABLE IT_LOCATION1 WITH KEY OBJID = WA_HRP1026-OBJID INTO WA_LOCATION1..
          READ TABLE IT_LSTEXT WITH KEY OBJID = WA_LOCATION1-SOBID OTYPE = 'F' INTO WA_LSTEXT.
                 WA_OUTPUT-LSTEXT = WA_LSTEXT-LSTEXT.
                 CLEAR WA_LSTEXT-LSTEXT.
          APPEND WA_OUTPUT TO IT_OUTPUT.
          CLEAR WA_OUTPUT.
          CLEAR WA_OUTPUT-CANCRT.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " GET_DATA
    *&      Form  GET_LOCATION
          text
    -->  p1        text
    <--  p2        text
    FORM GET_LOCATION .
    SELECT OTYPE
           OBJID
           RSIGN
           RELAT
           SCLAS
          SOBID
          FROM HRP1001
          INTO TABLE IT_LOCATION
          FOR ALL ENTRIES IN IT_HRP1026
          WHERE OTYPE = 'E' AND OBJID = IT_HRP1026-OBJID
           AND RSIGN = 'A' AND RELAT = '024' AND SCLAS = 'F'
                    AND BEGDA GE DATE-LOW AND ENDDA LE DATE-HIGH.
    IF SY-SUBRC NE 0.
        MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.
      ENDIF.
      LOOP AT IT_LOCATION INTO WA_LOCATION.
        WA_LOCATION1-OTYPE = WA_LOCATION-OTYPE.
        WA_LOCATION1-OBJID = WA_LOCATION-OBJID.
            WA_LOCATION1-RSIGN = WA_LOCATION-RSIGN.
        WA_LOCATION1-RELAT = WA_LOCATION-RELAT.
        WA_LOCATION1-SCLAS = WA_LOCATION-SCLAS.
        WA_LOCATION1-SOBID = WA_LOCATION-SOBID.
        APPEND WA_LOCATION1 TO IT_LOCATION1.
       CLEAR WA_LOCATION1.
      ENDLOOP.
    SELECT OTYPE
           OBJID
           STEXT
           FROM HRP1000
           INTO TABLE IT_LSTEXT
           FOR ALL ENTRIES IN IT_LOCATION1
           WHERE OBJID = IT_LOCATION1-SOBID
              AND OTYPE = 'F'.
             AND BEGDA GE DATE-LOW
             AND ENDDA LE DATE-HIGH.
    ENDFORM.                    " GET_LOCATION
    <b>Reward if usefull</b>

  • Help with creating objects for ArrayCollection

    Hi all,
    I am trying to update an ArrayCollection with Objects created
    in ActionScript
    In the end the array collection will provide data to a chart
    I can add the objects to my arrayCollection and access the
    values of the properties via text field output but the data is not
    Bindable
    So my text field shows the values from my AC but my chart
    isn't getting the data

    AaffordableWeb:
    Wrapping the Object in an ObjectProxy seems to have worked in
    that the properties are bound but my Chart shows nothing.
    I have posted the code below (keep in mind its a work in
    progress)
    Any help would be appreciated.
    //////Code
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="handleResult(event);">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.events.FlexEvent;
    import mx.rpc.events.ResultEvent;
    import mx.utils.ObjectUtil;
    import mx.utils.ObjectProxy;
    //// set price change range for the four arrays
    [Bindable]
    public var nPchange:Array = new Array(-12, -11,
    -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0);
    [Bindable]
    public var pPchange:Array = new Array(12, 11,
    10,9,8,7,6,5,4,3,2,1,0);
    //// Set up temprary var
    [Bindable]
    public var tempval:*;
    [Bindable]
    public var tempval2:*;
    [Bindable]
    public var tempvaly:*;
    [Bindable]
    public var tempvalr:*;
    [Bindable]
    public var tempvalr2:*;
    [Bindable]
    public var tempvalry:*;
    [Bindable]
    public var ylovert:Array = new Array;
    [Bindable]
    public var rylovert:Array = new Array;
    [Bindable]
    public var ymin:*;
    [Bindable]
    public var testarray:Array;
    /// declare the lPrime ac
    // declare the rprime ac
    [Bindable]
    public var rPrime:ArrayCollection = new ArrayCollection();
    // declare rylover ac
    [Bindable]
    public var ryLover:ArrayCollection = new ArrayCollection();
    // declare ylover ac
    [Bindable]
    public var yLover:ArrayCollection = new ArrayCollection();
    /// declare default cMargin
    [Bindable]
    public var cMargin:* = 80;
    [Bindable]
    public var lPrime:ArrayCollection;
    public function handleResult(event:FlexEvent):void
    pedata();
    public function pedata():*{
    /// begin loop
    lPrime = new ArrayCollection();
    for(var n:int = 0; n < nPchange.length; n++){
    var value:* = nPchange[n];
    if(value == 0){value = .0001;}else{value = value;}
    tempval = -1 * value / (cMargin + value);
    tempval2 = (tempval / value);
    ylovert.push(tempval2);
    var o:Object = new Object;
    o.PriceChange= value;
    o.PriceElasticity= tempval2;
    lPrime.addItem(new ObjectProxy(o));
    } // end loop
    lprime.xField= "PriceChange";
    lprime.yField= "PriceElasticity";
    lprime.dataProvider = lPrime;
    ///last brkt
    ]]>
    </mx:Script>
    <mx:AreaChart id="myChart" showDataTips="true"
    mouseSensitivity="25" width="100%" >
    <mx:horizontalAxis>
    <mx:LinearAxis maximumLabelPrecision="1" title="Pricec2a"
    minimum="-12" maximum="12"/>
    </mx:horizontalAxis>
    <mx:verticalAxis>
    <mx:LinearAxis displayName="Price Elasticity to Break
    Even" minimum="-1.5" maximum="-1" />
    </mx:verticalAxis>
    <mx:series>
    <mx:AreaSeries id="lprime" form="curve" >
    <mx:areaFill>
    <mx:SolidColor color="red"/>
    </mx:areaFill></mx:AreaSeries>
    </mx:series>
    </mx:AreaChart>
    <mx:Text id="txt2"
    text="{lPrime.getItemAt(3).PriceElasticity}"/>
    </mx:Application>

  • How to block first time loading data in View Object for searching

    hi all,
    I am using jdeveloper ADF 11g 2 release. i am making search page. but i make it manually, not use ADF query pannel.
    I drag and drop the adf read only table. it can execute using Lov and date time range using backing bean.
    eg: vo1.setWhereClause(whereClause);
    vo1.executeQuery();
    where clause can change dynamically.
    But my table indicate vo which load it all data first time page loading. I add all tuning performance,but no data option is for insert only. so like that option can make programmatically and can execute query??
    This method I used because of I can not make searching options what I want in ADF query pannel. Is there any way add 3 options but display all table fields??
    hoping help anyone.,thks

    Akash ,
    thanks ur reply.
    how to call that method? I made this method in my AppImpl class
    public void loaddata(){
    ViewObject viewObject = this.findViewObject("EstimateSearchDet_VO1");
    viewObject.executeEmptyRowSet();
    then in my backing bean make this after phase method..
    public void view_afterPhase(PhaseEvent phaseEvent) {
    // Add event code here...
    EstimateSearch_AMImpl amob= new EstimateSearch_AMImpl();
    amob.loaddata();
    BUT it say loaddata() can not find? what should i do?
    in view property After phase include this..
    #{backingBeanScope.backing_EstimateSearchnew.view_afterPhase}
    it is underline and say After phase is not define property.
    thks

  • Plz help i really tired from searching creat MBR partition without bootcamp or install win7 in GPT guid

    hello i have more than one partition on my macbook pro mid 2012 13 inch and its impossible to me to make it one partition for some reasons one of them that the partition sys is the second any way i tried to creart partition EXFAT and tried to install win7 but it says that can't be installed in GPT guid i talked chat with apple more than one 9 times to find answer but it's useless i get pro solution here

    The TechRecipe article is old. Some of the commands still apply, but it is a very custom solution.
    Yes, there is a way to create a custom hybrid MBR to accommodate additional partitions.
    1. This is a very fragile arrangement, and any Apple Software upgrade can break it.
    2. Any Hybrid MBR changes require this process to be repeated every time it breaks, which you should be willing to undertake.
    3. If you want to do this, and maintain it, please post the output of the following commands from OS X Terminal?
         diskutil list
         diskutil cs list
         sudo gpt -vv -r show /dev/disk0
         sudo fdisk /dev/disk0
    4. Sudo command require your password, which is not echoed back to you. You may also see a warning about improper use of sudo and potential data loss.
    5. Can you describe what exactly are you trying to establish?
    6. You previous attempt with exFAT failed, because your Mac requires a Hybrid MBR which maps the GPT to a MBR using a one-to-one mapping.
    7. If you just want to run OS X and Windows, and do not want to run any custom disk partitions, you should use Bootcamp Assistant. If it is failing, it can be addressed.

  • Help in collecting objects for transport into Q

    Hi All,
    We have our Q environment ready and need to transport the data flows into Q. I know that we have to replicate the datasources in Q before doing any transports. I have a flow like below:
    R/3 -> ODS -> Cube. I have generated an export datasource on the ODS and created a datamrt infopackage to load from ODS to Cube. What is the correct way to collect them in transports. I read(in some of the earlier posts) that we need to transport the export datasource before transporting the Cube.
    Please suggest!!!
    Thanks,
    RPK.

    Hi,
    If you are using Version 7 , no need to worry about it. We can combine both ODS and CUBE with Dataflow before and after in a transport requet.
    But If I remember correctly, I had a datasource unavailability problem with both ODS and CUBE with Dataflow before and after in a transport requet in older versions.
    So, in older versions, Take ODS with DFBefore in a request , trnasport and import it first, Then Replicate teh data sources from teh context menu of self source system. And then take Cube in another request with DFB and DFAfter .Import it later.
    With rgds,
    Anil Kumar Sharma .P

  • Plz help, A select query for table giving foll o/p

    A table has a single column with following data
    Col1
    170
    10
    140
    520
    20
    60
    70
    The select query should return the data in the following format
    Col1 Col2 Col3 Col4
    170 3 1 0
    10 0 0 1
    140 2 2 0
    520 10 1 0
    20 0 1 0
    60 1 0 1
    70 1 1 0

    Using my awesome puzzle solving brain I note that Col2 = 50 Col3 = 20 Col4 = 10.
    But you should be telling US that.
    select col1, floor(col1/50) col2, floor(mod(col1,50)/20) col3, floor(mod(mod(col1,50),20)/10) col4
    from mytable.
    I win the internets!
    Edited by: Dave Hemming on Dec 19, 2008 11:35 AM

  • Searching through an array of objects

    Hi, I am currently working on an assignment where I have to create a class called Persons with data fields of Name(String),age(int),income(int).
    All the values including the string values for name and values for income and age are all randomly generated and are stored in an array of objects of class "Persons".
    The array size is user specified.
    What I must attempt to implement now is to make a search feature that lets the user search through the array of objects for a particular name.
    I'm having some bad luck trying to implement this feature.
    If anyone can help me, I would greatly appreciate that!
    Cheers.

    Hi, Thank you for the prompt reply.
    I do not yet know HOW to start this,I mean I know how to search for individual characters in an element of an array, but to search for whole strings I am quite unsure.
    public class Persons
        //data fields
        private String name;
        private int age;
        private int income;
        //Constructor for Class Persons
        public Person(String[] name,int[] age,int[] income)
              String[] tempName = name;
              int[] tempAge = age;
              int[] itempIncome = income;
        //Instance method for returning some basic values about personal data
        public void toString(Persons ofChoice)
            System.out.println("Persons Data");
            System.out.println("Name: " + ofIntrest.name);
            System.out.println("Age: " + ofIntrest.age);
            System.out.println("Income: $" + ofIntrest.income);
    }This is my Persons class code, but I am quite stumped how to search for whole strings at the time being.

  • How to add the Match code object for the requisitioner field in TCODE ME51N

    Hi,
    How to add the search help (Match code object) for the requisitioner field in transaction ME51N.
    Please  do the needful to me.
    Regards
    Rajesh

    don't you think that posting your question to a microsoft developer site would be more efficient?
    regards,
    anton

  • TRYING TO FIND A CASE! PLZ HELp

    I have the ipod touch 4g and i was looking for a good case to protect it.im trying to find a case with a built in screen protector.PLZ HELP
    THANK YOU.

    You can search for iPod Touch 4g Cases at amazon.com, griffintechnology.com, and belkin.com. I don't know what's taking Apple so long to put new touch 4G cases on their website.

  • Adding "window to a container:illegal argument exception".error plz help

    Thanks to Mr.Andrew and sun for developing the following code for a
    mediaplayer which is implemented in jmf.This is working in core java. But
    when i have converted it to Applet it compiles but an error adding "window
    to a container:illegal argument exception".code is given below plz point
    me where is the error;
    import javax.media.*;
    import java.text.DecimalFormat;
    import java.awt.*;
    import java.awt.FileDialog;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    class nwa extends WindowAdapter{
    frameclass frame;
    public nwa(frameclass frame){
    this.frame=frame;
    public void windowClosing (WindowEvent e)
    //User selected close from System menu.
    //Call dispose to invoke windowClosed.
    frame.dispose ();
    public void windowClosed (WindowEvent e)
    //if (player != null)
    //player.close ();
    System.exit (0);
    class frameclass extends JFrame
    frameclass(){
    nwa n=new nwa(this);
    this.addWindowListener(n);                    
    public class PlayerApplet extends JApplet
              implements
    ActionListener,ControllerListener,ItemListener, KeyListener
    frameclass frame=new frameclass();
    Player player;
    Component vc, cc;
    JProgressBar volumeBar;
         JButton fastRewind;
         JButton fastForward;
         JButton play;
    int sizeIncrease = 2;
    boolean invokedStop = false;
         /** Big */
         int progressFontSize=30;
    boolean first = true, loop = false;
    String currentDirectory;
    public void init(){
    JMenu m = new JMenu ("File");
    JMenuItem mi = new JMenuItem ("Open...");
    mi.addActionListener (this);
    m.add (mi);
    m.addSeparator ();
    JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem ("Loop", false);
    cbmi.addItemListener (this);
    m.add (cbmi);
    m.addSeparator ();
    mi = new JMenuItem ("Exit");
    mi.addActionListener (this);
    m.add (mi);
    JMenuBar mb = new JMenuBar ();
    mb.add (m);
    frame.setJMenuBar (mb);
    setSize (200, 200);
         final JPanel p = new JPanel(new GridLayout(1,0,5,5));
              p.setBorder(new EmptyBorder(3,5,5,5) );
              fastRewind = new JButton("<html><body><font size=+"+
    sizeIncrease+ "><<");
              fastRewind.setToolTipText("Fast Rewind");
              fastRewind.addActionListener( new ActionListener(){
                   public void actionPerformed(ActionEvent ae) {
                        if (player!=null) {
                             invokedStop = false;
                             skipBack();
                        } else {
    JOptionPane.showMessageDialog(play,
                             new JLabel("Open a sound file
    first!"));
              fastRewind.addKeyListener(this);
              p.add(fastRewind);
              JButton stop = new JButton("<html><body><font size=+"+
    sizeIncrease+ ">&#9632;");
              stop.setToolTipText("Stop");
              stop.addActionListener( new ActionListener(){
                   public void actionPerformed(ActionEvent ae) {
                        invokedStop = true;
                        //player.stop();
                        sp();
              stop.addKeyListener(this);
              p.add(stop);
              play = new JButton("<html><body><font size=+"+
    sizeIncrease+ ">>");
              play.setToolTipText("Play");
              play.addActionListener( new ActionListener(){
                   public void actionPerformed(ActionEvent ae) {
                        if (player!=null) {
                             invokedStop = false;
                             player.setRate(1);
                             st();
                        } else {
    JOptionPane.showMessageDialog(play,
                             new JLabel("Open a sound file
    first!"));
              play.addKeyListener(this);
              p.add(play);
              fastForward = new JButton("<html><body><font size=+"+
    sizeIncrease+ ">>>");
              fastForward.setToolTipText("Fast Forward");
              fastForward.addActionListener( new ActionListener(){
                   public void actionPerformed(ActionEvent ae) {
                        if (player!=null) {
                             invokedStop = false;
                             skipForward();
                        } else {
    JOptionPane.showMessageDialog(play,
                             new JLabel("Open a sound file
    first!"));
              fastForward.addKeyListener(this);
              p.add(fastForward);
              p.addKeyListener(this);
              frame.add(p,BorderLayout.CENTER);     
              add(frame);
    // pack ();
    setVisible (true);
    public void start(){
    st();
    public void stop(){
    sp();
    public void destroy(){
    player.stop();
    player.deallocate();
    public void actionPerformed (ActionEvent e)
                   if (e.getActionCommand().equals("Exit"))
                   // Call dispose to invoke windowClosed.
                   frame.dispose ();
                        return;
         FileDialog fd = new FileDialog (frame, "Open File",
    FileDialog.LOAD);
         fd.setDirectory (currentDirectory);
         fd.show ();
         // If user cancelled, exit.
              if (fd.getFile() == null)
         return;
    currentDirectory = fd.getDirectory ();
              if (player != null)
         player.close ();
         try
         player = Manager.createPlayer (new MediaLocator
    ("file:" +
    fd.getDirectory() +
    fd.getFile()));
         catch (java.io.IOException e2)
    System.out.println (e2);
    return;
         catch (NoPlayerException e2)
    System.out.println ("Could not find a player.");
    return;
              if (player == null)
         System.out.println ("Trouble creating a player.");
         return;
    first = false;
    frame.setTitle (fd.getFile ().toString());
    player.addControllerListener (this);
    player.prefetch ();
    public void controllerUpdate (ControllerEvent e)
    if (e instanceof ControllerClosedEvent)
    if (vc != null)
    remove (vc);
    vc = null;
    if (cc != null)
    remove (cc);
    cc = null;
    return;
    if (e instanceof EndOfMediaEvent)
    if (loop)
    player.setMediaTime (new Time (0));
    player.start ();
    return;
    if (e instanceof PrefetchCompleteEvent)
    player.start ();
    return;
    if (e instanceof RealizeCompleteEvent)
    vc = player.getVisualComponent ();
    if (vc != null)
    add (vc);
    cc = player.getControlPanelComponent ();
    if (cc != null){
         this.add (cc, BorderLayout.SOUTH);
                        this.show();
    public void keyReleased(KeyEvent ke) {
    int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
         public void keyTyped(KeyEvent ke) {
         int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
         public void keyPressed(KeyEvent ke) {
              int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
              }else if (keycode==KeyEvent.VK_UP) {
                   st();
              }else if (keycode==KeyEvent.VK_DOWN) {
                   sp();
    public void skipForward() {
    double secs=5;
    double playersecs = player.getMediaTime().getSeconds();
    Time settime = new javax.media.Time(playersecs + secs);
    player.setMediaTime(settime);
    public void skipBack() {
              double secs1=5;
    double playersecs1 = player.getMediaTime().getSeconds();
    Time settime1 = new javax.media.Time(playersecs1 - secs1);
    player.setMediaTime(settime1);
         public void st() {
         player.start();
         public void sp() {
         player.stop();
    public void itemStateChanged (ItemEvent e)
    loop = !loop;
    When i comment add(frame) this error goes but i got a null poiter
    exception
    Plz help
    manu

    Hi Andrew,
    Thanks for ur reply.Sorrry that my code not included in the code block.
    My problem have been solved partly.Now playerapplet is working properly.It can play files from local machine(through open menuitem from file menu) as well as local network (through url menuitem from file menu).
    There is no requirement to play file from internet at present.
    I have given arrow keys to forward/backward/open/close.
    I have now completed my first part of project.Now i have to start the second part ie Controlling arrow keys using a joystick like instrument.The instrument and driver will be provided by my co. and the user is using only this device.Plz help me how to do that.
    The code is given below
    import javax.media.*;
    import java.text.DecimalFormat;
    import java.awt.*;
    import java.awt.FileDialog;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    <APPLET CODE=PlayerApplet.class
    WIDTH=320 HEIGHT=300>
    </APPLET>
    class nwa extends WindowAdapter
         frameclass frame;
         Player player;
         public nwa(frameclass frame,Player player)
          this.player=player;
          this.frame=frame;
         public void windowClosing (WindowEvent e)
          //User selected close from System menu.
          //Call dispose to invoke windowClosed.
          frame.dispose ();
          public void windowClosed (WindowEvent e)
              if (player != null)
                   player.stop();
                player.close ();
                   player.deallocate();
          System.exit (0);
    class frameclass extends JFrame
    Player player;
         frameclass(Player player)
         nwa n=new nwa(this,player);
         this.addWindowListener(n);                    
    public class PlayerApplet extends JApplet
               implements ActionListener,ControllerListener,ItemListener, KeyListener
               Player player=null;
               frameclass frame=new frameclass(player);
                 Component vc, cc;
                 Container f;
                 JProgressBar volumeBar;
                 JButton fastRewind;
              JButton fastForward;
              JButton play;
              int sizeIncrease = 2;
              boolean invokedStop = false;
              /** Big */
              int progressFontSize=30;
                 boolean first = true, loop = false;
                 String currentDirectory;
                 public void init()
                          f=frame.getContentPane();
                         JMenu m = new JMenu ("File");
                         JMenuItem mi = new JMenuItem ("Open...");
                         mi.addActionListener (this);
                         m.add (mi);
                         m.addSeparator ();
                         mi = new JMenuItem ("URL");
                         mi.addActionListener (this);
                         m.add (mi);
                         m.addSeparator ();
                         JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem ("Loop", false);
                         cbmi.addItemListener (this);
                         m.add (cbmi);
                         m.addSeparator ();
                         mi = new JMenuItem ("Exit");
                         mi.addActionListener (this);
                         m.add (mi);
                         JMenuBar mb = new JMenuBar ();
                         mb.add (m);
                         frame.setJMenuBar (mb);
                         setSize (500, 500);
                           JPanel p = new JPanel(new GridLayout(1,0,5,5));
                        p.setBorder(new EmptyBorder(3,5,5,5) );
                        fastRewind = new JButton("<html><body><font size=+"+ sizeIncrease+ "><<");
                        fastRewind.setToolTipText("Fast Rewind");
                        fastRewind.addActionListener( new ActionListener(){
                             public void actionPerformed(ActionEvent ae) {
                                  if (player!=null) {
                                       invokedStop = false;
                                       skipBack();
                                  } else {
                                       JOptionPane.showMessageDialog(play,
                                       new JLabel("Open a sound file first!"));
                        fastRewind.addKeyListener(this);
                        p.add(fastRewind);
                        JButton stop = new JButton("<html><body><font size=+"+ sizeIncrease+ ">&#9632;");
                        stop.setToolTipText("Stop");
                        stop.addActionListener( new ActionListener(){
                                  public void actionPerformed(ActionEvent ae) {
                                       invokedStop = true;
                                       sp();
                        stop.addKeyListener(this);
                        p.add(stop);
                        play = new JButton("<html><body><font size=+"+ sizeIncrease+ ">>");
                        play.setToolTipText("Play");
                        play.addActionListener( new ActionListener()
                                  public void actionPerformed(ActionEvent ae) {
                                       if (player!=null) {
                                            invokedStop = false;
                                            player.setRate(1);
                                            st();
                                       } else {
                                            JOptionPane.showMessageDialog(play,
                                            new JLabel("Open a sound file first!"));
              play.addKeyListener(this);
              p.add(play);
              fastForward = new JButton("<html><body><font size=+"+ sizeIncrease+ ">>>");
              fastForward.setToolTipText("Fast Forward");
              fastForward.addActionListener( new ActionListener(){
                   public void actionPerformed(ActionEvent ae) {
                        if (player!=null) {
                             invokedStop = false;
                             skipForward();
                        } else {
                             JOptionPane.showMessageDialog(play,
                             new JLabel("Open a sound file first!"));
              fastForward.addKeyListener(this);
              p.add(fastForward);
              frame.getContentPane().add(p,BorderLayout.CENTER);
              frame.setVisible (true);
              frame.pack();
              frame.setResizable(false);
      public void stop(){
      sp();
      public void destroy(){
       player.stop();
        player.deallocate();
      public void actionPerformed (ActionEvent e)
              if (e.getActionCommand().equals("Exit"))
                             // Call dispose to invoke windowClosed.
                             player.stop();
                             player.close();
                             player.deallocate();
                             frame.dispose ();
                                  return;
              if (e.getActionCommand().equals("Open..."))
                             FileDialog fd = new FileDialog (frame, "Open File",
                                         FileDialog.LOAD);
                              fd.setDirectory (currentDirectory);
                              fd.show ();
                              // If user cancelled, exit.
                              if (fd.getFile() == null)
                             return;
                              currentDirectory = fd.getDirectory ();
                                   if (player != null){
                                       player.close ();
                                       player.deallocate();
                         try
                  player = Manager.createPlayer (new MediaLocator
                                               ("file:" +
                                               fd.getDirectory() +
                                               fd.getFile()));
                              catch (java.io.IOException e2)
                            System.out.println ("file not found :"+e2);
                            return;
                              catch (NoPlayerException e2)
                            System.out.println ("Could not find a player.");
                            return;
                    if (player == null)
                   System.out.println ("Trouble creating a player.");
                   return;
                    first = false;
                    frame.setTitle (fd.getFile ().toString());
                    player.addControllerListener (this);
                    player.prefetch ();
                   return;
              if (e.getActionCommand().equals("URL"))
                             FileDialog fd = new FileDialog (frame, "Open File",
                                         FileDialog.LOAD);
                         fd.setDirectory (currentDirectory);
                         fd.show ();
                         // If user cancelled, exit.
                              if (fd.getFile() == null)
                             return;
                         currentDirectory = fd.getDirectory ();
                              if (player != null){
                                       player.close ();
                                       player.deallocate();
                   try
                        URL url = new URL ("file://"+fd.getDirectory()+fd.getFile());
                    MediaLocator mediaLocator = new MediaLocator (url);
                        player = Manager.createPlayer (mediaLocator);
                   catch (java.io.IOException e2)
                  System.out.println ("file not found :"+e2);
                  return;
                    catch (NoPlayerException e2)
                  System.out.println ("Could not find a player.");
                  return;
                    if (player == null)
                   System.out.println ("Trouble creating a player.");
                   return;
          first = false;
          frame.setTitle (fd.getFile ().toString());
          player.addControllerListener (this);
          player.prefetch ();
              return;
       public void controllerUpdate (ControllerEvent e)
          if (e instanceof ControllerClosedEvent)
              if (vc != null)
                  frame.getContentPane().remove (vc);
                  vc = null;
              if (cc != null)
                  frame.getContentPane().remove (cc);
                  cc = null;
              return;
          if (e instanceof EndOfMediaEvent)
              if (loop)
                  player.setMediaTime (new Time (0));
                  player.start ();
              return;
          if (e instanceof PrefetchCompleteEvent)
              player.start();
              return;
          if (e instanceof RealizeCompleteEvent)
            if (vc != null)
                  remove (vc);
                  vc = null;
              if (cc != null)
                  remove (cc);
                  cc = null;
              vc = player.getVisualComponent ();
              if (vc != null)
                  frame.getContentPane().add(vc,BorderLayout.NORTH);
              cc = player.getControlPanelComponent ();
              if (cc != null){
                       frame.getContentPane().add (cc, BorderLayout.SOUTH);
                     frame.setVisible(true);
                     frame.pack();
    public void keyReleased(KeyEvent ke) {
    int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
         public void keyTyped(KeyEvent ke) {
         int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
         public void keyPressed(KeyEvent ke) {
              int keycode = ke.getKeyCode();
              if (keycode==KeyEvent.VK_LEFT) {
                   skipBack();
              } else if (keycode==KeyEvent.VK_RIGHT) {
                   skipForward();
              }else if (keycode==KeyEvent.VK_UP) {
                   st();
              }else if (keycode==KeyEvent.VK_DOWN) {
                   sp();
    public void skipForward() {
    Time settime;
    double secs=5;
    double playersecs = player.getMediaTime().getSeconds();
    double duration = player.getDuration().getSeconds();
              if((playersecs+secs) < duration){
                      settime = new javax.media.Time(playersecs + secs);
                      player.setMediaTime(settime);
              }else {
                        player.setMediaTime(new Time(duration));
    public void skipBack() {
              double secs1=5;
              double secs2=0;
              double playersecs1 = player.getMediaTime().getSeconds();
              Time settime1;
              if((playersecs1 - secs1) > secs2){
                      settime1 = new javax.media.Time(playersecs1 - secs1);
                      player.setMediaTime(settime1);
              }else {
                        player.setMediaTime(new Time(0));
         public void st() {
         player.start();
         public void sp() {
         player.stop();
       public void itemStateChanged (ItemEvent e)
          loop = !loop;
    With Thanks
    manuEdited by: mm_mm on Nov 27, 2007 11:09 PM

  • My friend has an Iphone 5s which states 'Assembled in Korea' at the back? Is it genuine? Plz help ! thanks

    My friend has an Iphone 5s which states 'Assembled in Korea' at the back? Is it genuine? Plz help ! thanks

    Thanks Razmee209 for your reply. He bought it in India. I was wondering does apple make devices which are Assembled or Made in Korea?

  • What the correct URL for searching on KM Index

    I have an application that supposed to mimics a KM search over TREX Index.
    When Pressing the button "search" I operate the following url:
    <i>"/irj/servlet/prt/portal/prtroot/com.sap.km.cm.basicsearch?layoutSetMode=exclusive&ResourceListType=com.sapportals.wcm.SearchResultList&SearchType=ctrlpers&QueryString="str"&SelectedSearchIndices="+ Index</i>
    The var "str" stands for the input field (the search Item)
    The var "Index" stands for the Index.
    It doesn't work!
    What am I doing wrong?
    Thanks,
    Meytal.

    Hi,
    If you need a search in TREX index you can try use a portal API  for search.
    See this example <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/com.sap.km.cm.docs/library/nw/netweaver-developers-guide-2004s/NetWeaverDevelopersGuide2004s_Documents/KM_articles_new/examples/com.sap.netweaver.kmc.search_servlet.zip">https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/com.sap.km.cm.docs/library/nw/netweaver-developers-guide-2004s/NetWeaverDevelopersGuide2004s_Documents/KM_articles_new/examples/com.sap.netweaver.kmc.search_servlet.zip</a>
    It is an example of search in exact index:
                             // get an instance of the indexmanagement service
                             IIndexService indexService = (IIndexService) ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.INDEX_SERVICE);
                             // build a query object, using the SearchQueryBuilder
                             SearchQueryListBuilder sqb = new SearchQueryListBuilder();
                             sqb.setSearchTerm(query);
                             IQueryEntryList qel = sqb.buildSearchQueryList();
                             // get an instance of federated search
                             IFederatedSearch federatedSearch = (IFederatedSearch) indexService.getObjectInstance(IWcmIndexConst.FEDERATED_SEARCH_INSTANCE);
                             List indexList = new ArrayList();
                             if (index!=null && index.length()>0) {
                                  // take a specified index from index= parameter
                                  indexList.add(indexService.getIndex(index));
                             } else {
                                  // take all available indexes
                                  indexList = indexService.getActiveIndexes();     
                             // it is recommended to use a search session object
                             // for searching execution
                             ISearchSession session = null;
                             if (session==null)
                                  session = federatedSearch.searchWithSession(qel, indexList, c);
                             this.renderResultHeader(response, session, indexList);
                             // get all results from the search session
                             ISearchResultList results = session.getSearchResults(1, session.getTotalNumberResultKeys());
                             this.renderResultList(response, results);
    You can use this code when you press you "search" button and render the result.
    Regards,
    Andrei

Maybe you are looking for

  • Can Wcf-Custom Adapter implement Wcf-WebHttp Functionality?

    Can the Wcf-Custom adapter implement the same functionality as the Wcf-WebHttp adapter in BizTalk 2013? In particular, can it provide the same functionality as the operation map and the variable map? If not, is there any other way to provide Wcf-WebH

  • LR 1.1 with CS2?

    In the readme file with LR 1.1 it says: "Adobe applications must be updated with the Camera Raw 4.1 plug-in order to ensure compatibility with Lightroom 1.1 develop module settings. The following products will support the Camera Raw 4.1 plug-in: Phot

  • Photoshop - combine red and green channel images into a merged image?

    Hi, I am a developmental biologist carrying out experiments on a type of microscope known as a Confocal Laser Scanning Microscope (CSLM).  Basically, this is a microscope coupled to some lasers which allow fluorescently-labelled parts of a biological

  • Adobe Reader will work, and I cannot find the fix

    When I try to open a PDF, Adobe reports an internal error and shuts down. I have tried to uninstall and reinstall, but when I try either, I cannot complete the install or uninstall because I get the message of error 1606 could not access network loca

  • Does anyone know what settings are affected when I "reset all settings" on my iPhone5?

    Please help! I lost my iMessage ability when my phone accidentally was erased by find my iPhone App. Now the iCloud put my spouses tn in the "send & receive" My number is there but in grey? Thanks