Pls help in this code

Hi All,
please let me know, if this code is right ??
I want to select data and move to ind fields,
data : w_post_code1 like adrc-post_code1,
       w_post_code2 like adrc-post_code2.
SELECT single POST_CODE1 POST_CODE2  INTO
( w_post_code1 w_post_code2 )  from adrc
WHERE ADDRNUMBER eq s_adrnr .
endselect.
thank you.
madhu

Hi,
Please try this.
DATA: W_POST_CODE1 LIKE ADRC-POST_CODE1,
      W_POST_CODE2 LIKE ADRC-POST_CODE2.
SELECT SINGLE POST_CODE1 POST_CODE2 INTO
(W_POST_CODE1, W_POST_CODE2) FROM ADRC
WHERE ADDRNUMBER EQ S_ADRNR .
                                                                                WRITE:  W_POST_CODE1,  W_POST_CODE2.
Regards,
Ferry Lianto

Similar Messages

  • Pls Help with this

    Hi,
    I need a help to resolve my problem.Actually i have a JSP page with a list box. When i select some value in the list box, appropriate values must list out according to the selected value.And i have a submit button to process that jsp page.
    I wrote a validation as all the fields must be entered to submit a page.
    But when i tried with the following code,it's just moving to processing page when i select a values from the list box.This is happening when i cheked the validation.
    Pls help with this code.This is very urgent.
    Code is as follows
    "Example1.jsp"
    <%
    String str1 = request.getParameter("Modem");
    %>
    <html>
    <head>
    <script language = "JavaScript">
    function Validate()
    if(document.UpdateFiosAccounts.Modem.value == "Select One")
    alert("Please select the value")
    document.UpdateFiosAccounts.Modem.focus()
    return false
    if(document.UpdateFiosAccounts.text1.value == "")
    alert("Please type some text")
    document.UpdateFiosAccounts.text1.focus()
    return false
    return true
    </script>
    </head>
    <body>
    <form name = "UpdateFiosAccounts" action="./Example1.jsp" method ="post" onSubmit= "return Validate()">
    Pls select One:<select name="Modem" size="1" onChange="document.UpdateFiosAccounts.submit()">
    <%
    if(str1 == null)
    %>
         <option value="Select One">Select One</option>
         <option value="One">One</option>
         <option value="Two">Two</option>
         <option value="Three">Three</option>
         <option value="Four">Four</option>
    <%
    else
    %>
         <option value="<%=str1%>"><%=str1%></option>
    <%
    %>
    </select><br>
    Pls type something: <input type ="text" name="text1">
    <input type ="submit" value="submit" onClick="document.UpdateFiosAccounts.action='./Accounts.jsp'">
    </form>
    </body>
    </html>

    Hi! The reason is that in the onChange property you are doing the submit, so, when you select something, it goes automatically and never pases through your validation function. So, remove that onChange. Next, the button is a submit buton, so, no matter what your validation does, the page will go. You need to change the submit type of the button to just button (<input type="button" onclick="function to validate">) and then you will get what you want. By the way, this is NOT a Java question, is more JavaScript question.
    Hope this helps.

  • While updating the older version iTunes to latest one it shows "a network error occurred while attempting to read from the file: C:\windows\installer\iTunes64.msi. pls help on this matter to connect my i5 to PC. Thanks in advance

    while updating the older version iTunes to latest one it shows "a network error occurred while attempting to read from the file: C:\windows\installer\iTunes64.msi. pls help on this matter to connect my i5 to PC. Thanks in advance

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page): 
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • I need help with this code error "unreachable statement"

    the error_
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errors
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    public class Tools//tool class
    private int numberOfToolItems;
    private ToolItems[] toolArray = new ToolItems[10];
    public Tools()//array of tool
    numberOfToolItems = 0;
    for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
    toolArray[i] = new ToolItems();
    }//end for loop
    }//end of array of tools
    public int search(int id)//search mehtod
    int index = 0;
    while (index < numberOfToolItems)//while and if loop search
    if(toolArray[index].getID() == id)
    return index;
    else
    index ++;
    }//en while and if loop
    return -1;
    }//end search method
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0;
    int index;
    index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    }//end delete method
    public void display()//display method
    for(int i = 0; i < numberOfToolItems; i++)
    //toolArray.display(g,y,x);
    }//end display method
    public String getRecord(int i)//get record method
    // return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
    }//end getrecod
    }//end class
    Edited by: ladsoftware on Oct 9, 2009 6:08 AM
    Edited by: ladsoftware on Oct 9, 2009 6:09 AM
    Edited by: ladsoftware on Oct 9, 2009 6:10 AM
    Edited by: ladsoftware on Oct 9, 2009 6:11 AM

    ladsoftware wrote:
    Subject: Re: I need help with this code error "unreachable statement"
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errorsThe compiler is telling you exactly what the problems are:
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
    int index;
    index = search(id);  //< -----------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    // <<== HERE where is the return statement?
    }//end delete method
    public String getRecord(int i)//get record method
    // return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
    }//end getrecod
    }//end class

  • Pls help me this is an urgent  requirement on  ALV GRID

    Hi all
      Here i am sendig my requirement pls help me on coding ..
    Report Assignment For ELTPs:
    Selection criteria :
    Circle id : Select option without interval and mandatory
    SPR Id :  Select option without interval
    Project Status :  Parameter
    Output required in ALV Grid format with the below structure :
    cProjects ID     SPR ID     Project Name     Circle ID     Circle Description     Delegation Status     No. of CU Projects     CU-PO Share     FLCB     FLCB
    NAME     FLCL ID     FLCL Name     FLCL Email ID
    1232007
         1230
              ABCD          No     0                              
    1242007
         1240
              ABCD          Partial     2                              
    1112007
         1241
              XYZ                                             
    2222007
         1242
              WXY                                             
    1252007
         1250
              EFGH          Full     1                              
    3332007
         1251
              DEF                                             
    Requirement : 
    1.     The report should list all the CFU projects and the corresponding CU projects circle wise based on the circles entered on the selection screen and which have the SPR ids and Project status on the selection screen.
    2.     If SPR id or Project status is not entered then all the projects to be considered for the given circle/s.
    3.     It should display the details of the CFU project first. The corresponding CU projects should be listed below that CFU project in the successive rows.
    4.     For example, project 1232007 is a CFU project which does not have any CU under it. Hence, another CFU project 1242007 is displayed in the second row. It has 2 CU projects under it. The details of those two CU projects are displayed in the 3rd and 4th rows.
    5.     Total share given to the CU circle (by adding different PO shares to that circle in that project) by the CFU project should be displayed in the field ‘CU-PO Share’.
    6.     For CU projects, the fields ‘Delegation Status’, ‘No. of CU projects’ and ‘CU-PO share’ should be space.
    7.     FLCB, FLCL ID, FLCL name and FLCL email  need to given for all the projects in all the rows.
    Tables to be referred: ZSCP_PROJECT, ZSCP_CIRCLE_M, ZSCP_PJ_CL_PO_MP, ZSCP_PRJ_LINK, USR21,
    ADR6, BUT000,CGPL_TEXT.
    [<b>b]Here i done the coding the but the error showing that field catolog is not found..
    pls check this and kindly send the code .....</b></b>
    REPORT  Z_64328_TEST .
    TYPE-POOLS : SLIS.
    TABLES : ZSCP_PROJECT,ZSCP_CIRCLE_M,ZSCP_PJ_CL_PO_MP,ZSCP_PRJ_LINK,
             USR21,ADR6, BUT000.
    SELECT-OPTIONS : S_CIRID FOR ZSCP_CIRCLE_M-CIRCLE_ID NO INTERVALS.
    SELECT-OPTIONS : S_SPR_ID    FOR ZSCP_PROJECT-SPR_PROJECT_ID NO INTERVALS.
    PARAMETERS     : P_STAT  LIKE ZSCP_PROJECT-PRJ_STAT.
          DATA : GS_LAYOUT1 TYPE SLIS_LAYOUT_ALV,
                 CT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
                 G_REPID   TYPE  SY-REPID,
                 TEMP_CAT1  TYPE SLIS_FIELDCAT_ALV,
                 HEADER_ALV1 TYPE SLIS_T_LISTHEADER,
                 HEADER_ALV_WA1  TYPE SLIS_LISTHEADER,
                 GT_SORT  TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE,
                 GS_KEYINFO  TYPE SLIS_KEYINFO_ALV.
    DATA : SPRID  TYPE ZSPR_PROJECT_ID.
    DATA : CID    TYPE ZCIRCLE_ID.
    DATA : ITAB  TYPE TABLE OF ZSCP_PROJECT.
    DATA : WA    TYPE ZSCP_PROJECT.
    DATA : ITAB1 TYPE TABLE OF ZSCP_CIRCLE_M.
    DATA : WA1   TYPE ZSCP_CIRCLE_M.
    SELECT * FROM ZSCP_CIRCLE_M INTO TABLE ITAB1.
    SELECT * FROM ZSCP_PROJECT INTO TABLE ITAB WHERE SPR_PROJECT_ID IN S_SPR_ID OR CIRCLE_ID IN S_CIRID.
    LOOP AT ITAB INTO WA.
    READ TABLE ITAB1 INTO WA1 WITH KEY CIRCLE_ID = WA-CIRCLE_ID.
    WRITE : WA1-CIRCLE_DESC.
    WRITE : WA-CIRCLE_ID,
            WA-PROJECT_ID,
            WA-DELEG_STAT,
            WA-PRJ_STAT,
            WA-FLCB,
            WA-FLCL.
    ENDLOOP.
    *PERFORM FIELD_CATALOG1.
    PERFORM alv_display1.
    FORM FIELD_CATALOG1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'CIRCLE_ID'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'CIRCLEID'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND  TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'SPR_PROJECT_ID'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'CPROJECTID'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND  TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'CIRCLE_DESC'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'CIRCLEDESC'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND  TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'DELEG_STAT'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'DELGSTAT'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND  TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'PRJ_STAT'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'PROJSTAT'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND  TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'FLCB'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'FLCB1'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND  TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'FLCL'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'FLCL1'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND  TEMP_CAT1 TO CT_FIELDCAT1.
    ENDFORM.   "END CATALOG1.
    FORM ALV_DISPLAY1.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                 = G_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE             = 'TOP-OF-PAGE1 '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                          = GS_LAYOUT1
       IT_FIELDCAT                        = CT_FIELDCAT1
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                            = GT_SORT[]
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                             = 'A '
      TABLES
        T_OUTTAB                          = ITAB
    EXCEPTIONS
       PROGRAM_ERROR                      = 1
       OTHERS                             = 2
    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.
    Thanks and regards
    Nagendra Kumar

    hi nagendra,
             go through this code.
    TYPE-POOLS : SLIS.
    TABLES : ZSCP_PROJECT,ZSCP_CIRCLE_M,ZSCP_PJ_CL_PO_MP,ZSCP_PRJ_LINK,
    USR21,ADR6, BUT000.
    SELECT-OPTIONS : S_CIRID FOR ZSCP_CIRCLE_M-CIRCLE_ID NO INTERVALS.
    SELECT-OPTIONS : S_SPR_ID FOR ZSCP_PROJECT-SPR_PROJECT_ID NO INTERVALS.
    PARAMETERS : P_STAT LIKE ZSCP_PROJECT-PRJ_STAT.
    DATA : GS_LAYOUT1 TYPE SLIS_LAYOUT_ALV,
    CT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
    G_REPID TYPE SY-REPID,
    TEMP_CAT1 TYPE SLIS_FIELDCAT_ALV,
    HEADER_ALV1 TYPE SLIS_T_LISTHEADER,
    HEADER_ALV_WA1 TYPE SLIS_LISTHEADER,
    GT_SORT TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE,
    GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
    DATA : SPRID TYPE ZSPR_PROJECT_ID.
    DATA : CID TYPE ZCIRCLE_ID.
    DATA : ITAB TYPE TABLE OF ZSCP_PROJECT.
    DATA : WA TYPE ZSCP_PROJECT.
    DATA : ITAB1 TYPE TABLE OF ZSCP_CIRCLE_M.
    DATA : WA1 TYPE ZSCP_CIRCLE_M.
    SELECT * FROM ZSCP_CIRCLE_M INTO TABLE ITAB1.
    SELECT * FROM ZSCP_PROJECT INTO TABLE ITAB WHERE SPR_PROJECT_ID IN S_SPR_ID OR CIRCLE_ID IN S_CIRID.
    LOOP AT ITAB INTO WA.
    READ TABLE ITAB1 INTO WA1 WITH KEY CIRCLE_ID = WA-CIRCLE_ID.
    WRITE : WA1-CIRCLE_DESC.
    WRITE : WA-CIRCLE_ID,
    WA-PROJECT_ID,
    WA-DELEG_STAT,
    WA-PRJ_STAT,
    WA-FLCB,
    WA-FLCL.
    ENDLOOP.
    PERFORM FIELD_CATALOG1.
    PERFORM alv_display1.
    FORM FIELD_CATALOG1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'CIRCLE_ID'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'CIRCLEID'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'SPR_PROJECT_ID'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'CPROJECTID'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'CIRCLE_DESC'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'CIRCLEDESC'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'DELEG_STAT'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'DELGSTAT'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'PRJ_STAT'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'PROJSTAT'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'FLCB'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'FLCB1'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND TEMP_CAT1 TO CT_FIELDCAT1.
    CLEAR TEMP_CAT1.
    TEMP_CAT1-TABNAME = 'ITAB'.
    TEMP_CAT1-FIELDNAME = 'FLCL'.
    TEMP_CAT1-KEY = 'X'.
    TEMP_CAT1-SELTEXT_M = 'FLCL1'.
    TEMP_CAT1-OUTPUTLEN = 10.
    APPEND TEMP_CAT1 TO CT_FIELDCAT1.
    ENDFORM. "END CATALOG1.
    FORM ALV_DISPLAY1.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = G_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE1 '
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE =
    I_GRID_SETTINGS =
    IS_LAYOUT = GS_LAYOUT1
    IT_FIELDCAT = CT_FIELDCAT1
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT = GT_SORT[]
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = 'A '
    TABLES
    T_OUTTAB = ITAB
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    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.
    <b>please reward points if helpfull.</b>
    with regards,
    radhika kolluru.

  • Noob needs help with this code...

    Hi,
    I found this code in a nice tutorial and I wanna make slight
    adjustments to the code.
    Unfortunately my Action Script skills are very limited... ;)
    This is the code for a 'sliding menue', depending on which
    button u pressed it will 'slide' to the appropriate picture.
    Here's the code:
    var currentPosition:Number = large_pics.pic1._x;
    var startFlag:Boolean = false;
    menuSlide = function (input:MovieClip) {
    if (startFlag == false) {
    startFlag = true;
    var finalDestination:Number = input._x;
    var distanceMoved:Number = 0;
    var distanceToMove:Number =
    Math.abs(finalDestination-currentPosition);
    var finalSpeed:Number = .2;
    var currentSpeed:Number = 0;
    var dir:Number = 1;
    if (currentPosition<=finalDestination) {
    dir = -1;
    } else if (currentPosition>finalDestination) {
    dir = 1;
    this.onEnterFrame = function() {
    currentSpeed =
    Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
    distanceMoved += currentSpeed;
    large_pics._x += dir*currentSpeed;
    if (Math.abs(distanceMoved-distanceToMove)<=1) {
    large_pics._x =
    mask_pics._x-currentPosition+dir*distanceToMove;
    currentPosition = input._x;
    startFlag = false;
    delete this.onEnterFrame;
    b1.onRelease = function() {
    menuSlide(large_pics.pic1);
    b2.onRelease = function() {
    menuSlide(large_pics.pic2);
    b3.onRelease = function() {
    menuSlide(large_pics.pic3);
    b4.onRelease = function() {
    menuSlide(large_pics.pic4);
    I need to adjust five things in this code...
    (1) I want this menue to slide vertically not horizontally.
    I changed the 'x' values in the code to 'y' which I thought
    would make it move vertically, but it doesn't work...
    (2) Is it possible that, whatever the distance is, the
    "sliding" time is always 2.2 sec ?
    (3) I need to implement code that after the final position is
    reached, the timeline jumps to a certain movieclip to a certain
    label - depending on what button was pressed of course...
    I tried to implement this code for button number two...
    b2.onRelease = function() {
    menuSlide(large_pics.pic2);
    if (currentPosition = finalDestination) {
    this.large_pics.pic2.gotoAndPlay("s1");
    --> sliding still works but it doesn't jump to the
    appropriate label...
    (4) I wanna add 'Next' & 'Previous' buttons to the slide
    show - what would be the code in this case scenario ?
    My first thought was something like that Flash checks which
    'pic' movieclip it is showing right now (pic1, pic2, pic3 etc.) and
    depending on what button u pressed u go to the y value of movieclip
    'picX + 1' (Next button) or 'picX - 1' (Previous button)...
    Is that possible ?
    (5) After implementing the Next & Previous buttons I need
    to make sure that when it reached the last pic movieclip it will
    not go further on the y value - because there is no more pic
    movieclip.
    Options are to either slide back to movieclip 'pic1' or
    simply do nothing any more on the next button...
    I know this is probably Kindergarten for you, but I have only
    slight ideas how to do this and no code knowledge to back it up...
    haha
    Thanx a lot for your help in advance !
    Always a pleasure to learn from u guys... ;)
    Mike

    Hi,
    I made some progress with the code thanx to the help of
    Simon, but there are still 2 things that need to be addressed...
    (1) I want the sliding time always to be 2.2 sec...
    here's my approach to it - just a theory but it might work:
    we need a speed that changes dynamically depending on the
    distance we have to travel...
    I don't know if that applies for Action Scrip but I recall
    from 6th grade, that...
    speed = distance / time
    --> we got the time (which is always 2.2 sec)
    --> we got the disctance
    (currentposition-finaldestination)
    --> this should automatically change the speed to the
    appropriate value
    Unfortunately I have no clue how the action script would look
    like (like I said my action script skills are very limited)...
    (2) Also, one other thing I need that is not implemented yet,
    is that when the final destination is reached it jumps to a certain
    label inside a certain movieclip - every time different for each
    button pressed - something like:
    if (currentPosition = finalDestination) {
    this.large_pics.pic2.gotoAndPlay("s1");
    that statement just doesn't work when I put it right under
    the function for each button...
    Thanx again for taking the time !!!
    Mike

  • Can anyone help with this code

    i am trying to create a html5 video gallery for my website  I was wondering if anyone can help me with this code :  Am i missing something got this from the adobe widget browser i can get the button fuctions but i can not seem to get the video to play or work.. 

    This is the full page i am still working on it but the video code which i posted earlier is not working...    
    123456789101112131415
    Home
    Biography
    To Be Lead
    Gallery
    Videos
    Memorial Page
    Wallpaper
    Blog
    Forum
    Contact
    Randy Savage Bio
    Randy's Facts 101
    His Early Career
    Randy's Career in the WWF
    Randy's Career in WCW
    The Mega Powers  
    Mega powers Bio Mega Powers Facts 101 
    PM to fans and Elizabeth
    Randy's Radio interview
    His Death
    Elizabeth Hulette 
    Elizabeth Bio Elizabeth Facts 101 Her Career in the WWF Her Career in WCW Later Life Farewell to a Princess Elizabeth's Radio Interview Elizabeth Death 
    Sherri Martel
    Gorgeous George
    Team Madness
    Early Years
    ICW Gallery
    WWF Gallery
    WCW Gallery
    NWO Gallery
    Memorial Page for Randy
    Memorial Page for Elizabeth
                          Video of the Month    
    Site Disclaimer
    Macho-madness is in no way in contact with World Wrestling Entertainment. All photos are copyright to World Wrestling Entertainment or their respective owners and is being used under the fair copyright of Law 107.
    ©macho-madness.net All right's Reserved.  
            Affiliates
    Want to be an affiliate, elite, or partner site? Email: [email protected] with the list of things below.
    Place in the subject of email: “Randy Savage Online Affiliation”.
    Name: 
    Email: 
    Site Name: 
    Site URL: 
    When Will The Site Be Added?:
                        To see A List Click Here...
    ©macho-madness.net All right's Reserved.  
    Offical Links

  • Please help in this code..

    Hi,
    I am developing one small program. Which has one inner class in parent class. I am using object [] array of that inner class. like thisPreferredRoomsItem maxPercentagePrefRooms[] = new PreferredRoomsItem[solutionOfTimeTable.MAX_ACTIVITIES];  
            for (int j = 0; j < solutionOfTimeTable.nInternalActivities; j++) {           
                maxPercentagePrefRooms[j].percentage=-1.0;
                maxPercentagePrefRooms[j].prefferedRooms.clear(); // test it.                                  
                double maxPercentage = -1;
                double minNRooms = INF;        
                for(PreferredRoomsItem it:activitiesPreferredRoomsList){ // check this code. this is incorrect/.
                if(maxPercentage<it.percentage || (maxPercentage==it.percentage && minNRooms>it.prefferedRooms.size())){           
                    maxPercentage = it.percentage;              
                    minNRooms = it.prefferedRooms.size();
                    maxPercentagePrefRooms[j] = it;
                } In inner class PreferredRoomsItem it has two member variables. And then I am using iteration with for loop. When I am using this line-->maxPercentagePrefRooms[j]. it gives me nullpointerexception. Please help.
    It is urgent.
    Thanks in advance.

    You still need to instantiate the Object in each array index.
    for (int j = 0; j < solutionOfTimeTable.nInternalActivities; j++) {           
                 maxPercentagePrefRooms[j] = new PreferredRoomsItem();
                //...

  • Need help getting this code to work

    I am trying to get this code to work using "if else statment" but it will only do the first part and not do the second part in the else statement. Can anyone help me out? Here is the code:
    var R1 = this.getField("Registration Fees1");
    var R2 = this.getField("Registration Fees2");
    var R3 = this.getField("Registration Fees3");
    var R4 = this.getField("Registration Fees4");
    var R0 = 0
    if (R0 == 0)
      event.value = Math.floor(R1.value);
    else
      event.value = Math.floor(R2.value + R3.value + R4.value);
    I did notice that if I fiddled around this this part:
    if (R0 == 0)
    sometimes I can get the second part to work but not the first. I need it to do either or and this is getting frustrating.
    I might also not even need "var R0 = 0". I put that there for the condition part. If that is what is causing the problem, I can take it out. But then what would the condition be? For this form, the default is 0 and then the calculation follows by user clicking on different prices. The first part is if they want to pay for the full conference and the second part is if they want to pay for either Monday, Tuesday or Wednesday or 2 of the 3 days. Is it possible to get this to work with both parts together? I am still stuck on getting just one or the other working. Any help would be greatly appreciated. Thanks in advance.

    I have posted this on another message board and a user by the name of gkaiseril offered this solution but it hasn't worked either.
    // all four days
    var R1 = this.getField("Registration Fees1").value;
    // Monday
    var R2 = this.getField("Registration Fees2").value;
    // Tuesday
    var R3 = this.getField("Registration Fees3").value;
    // Wednesday
    var R4 = this.getField("Registration Fees4").value;
    var Fee = 0
    event.value = ''; // default value
    if (R1 != 'Off') {
      Fee = Number(R1) + Fee;
    } else {
      if(R2 != 'Off') {
         Fee = Number(Fee) + R2;
      if(R3 != 'Off') {
         Fee += Number(R3);
      if(R4 != 'Off') {
         Fee = Number(R4) + Fee;
    event.value = Fee;

  • Pls help me , this is very urgent

    I have a column called description with values as follows
    Admin Support
    Admin Support
    Admin Support
    Air Support
    Cable - Disaster Response
    Cable - Operational Support
    Cable - PMPP (Preparedness)
    Cable - Program Support
    Capacity Building
    Capacity Building
    Chemical, Biological, Radiological, & Nuclear
    Commodity Procurement Contract
    Communications
    Computer Support
    Contract Services (warehousing)
    Coordination
    Coordination
    Disaster Assistance Response Program
    I have another column in this table for which i have to update with the sequence nos. The update should happen in such a way that if the description is same then i have update with sequence.currval and if the description is different then i have to update with sequence.nextval for each row as follows
    Admin Support----- 1
    Admin Support----- 1
    Admin Support----- 1
    Air Support----- 2
    Cable - Disaster Response----- 3
    Cable - Operational Support----- 4
    Cable - PMPP (Preparedness)----- 5
    Cable - Program Support----- 6
    Capacity Building----- 7
    Capacity Building----- 7
    Chemical, Biological, Radiological----- 8
    Commodity Procurement Contract----- 9
    Communications----- 10
    Computer Support----- 11
    Contract Services----- 12
    Coordination----- 13
    Coordination----- 13
    Disaster Assistance Response----- 14
    Pls help me how do i do this, this is very urgent
    Thanks
    Vinod

    If you want your sequence to start from 1, you can eliminate creating a special sqeuence for this, you can do it using ROWNUM in SQL,update your_table a
    set (a.description, a.col1)
       = (select c.description, c.rn from
            (select b.description, rownum rn from
               (select distinct description from your_table order by description) b) c
         where c.description = a.description);P.S Just an alternative.
    Thx,
    SriDHAR

  • Help edit this code

    Hi I got this code of the net which displays a calendar and when a date
    is selected from the calendar it is displayed in the textfield.
    At the moment if nothing is selected from the calendar it displays the first of the month in the textField.
    I want the calendar to work in such a way that if nothing is selected from the calendar then no changes are made to the textfield.
    Can someone help me out?
    Thanks alot
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.Date;
    import java.util.Calendar;
    * dialog to allow user to select a date and return
    * a java.util.Date object
    * Creation date: (2/5/00 10:57:04 AM)
    public class DateChooser extends JDialog implements ActionListener {
         //TODO: submit to resource bundle for internationalization
         private String[] months = {"Jan","Feb", "Mar","Apr", "May","June","July","Aug","Sept","Oct","Nov","Dec"};
         private JButton[] days = null;
         private JLabel monthLabel = null;
         private Calendar calendar = null;
         private JPanel mainPanel = null;
    * DateChooser constructor comment.
    public DateChooser() {
         super();
         this.setModal(true);
         initialize();
    * deal with all the buttons that may be pressed
    * Creation date: (2/5/00 11:36:11 AM)
    * @param e java.awt.event.ActionEvent
    public void actionPerformed(ActionEvent e) {
         String text;
         if (e.getActionCommand().equals("D")){
              //return a date
              text = ((JButton) e.getSource()).getText();
              if (text.length() > 0){
                   this.returnDate(text);
              } else {
                   Toolkit.getDefaultToolkit().beep();
         } else {
              this.roll(e.getActionCommand());
    * repaint the window with the supplied calendar date
    * Creation date: (2/5/00 11:04:03 AM)
    * @param d java.util.Date
    private void caption() {
         Calendar cal = this.getCalendar();
         int startPos;
         int currentMonth = cal.get(Calendar.MONTH);
         //for painting ease, quick display
         mainPanel.setVisible(false);
         //set month
         monthLabel.setText(months[cal.get(Calendar.MONTH)] + " " + cal.get(Calendar.YEAR));
         //set to first day
         cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1);
         //now work the day labels
         startPos = cal.get(Calendar.DAY_OF_WEEK);
         for (int i = startPos - 1; i < days.length; i++) {
              days.setText(String.valueOf(cal.get(Calendar.DATE)));
              cal.roll(Calendar.DATE, true);
              if (cal.get(Calendar.DATE) == 1) {
                   //clear remaining labels going forward
                   for (int j = i + 1; j < days.length; j++) {
                        days[j].setText("");
                   break;
         //work first week
         for (int h = 0; h < startPos - 1; h++) {
              if (cal.get(Calendar.DATE) > 25 ) {
                   days[h].setText(String.valueOf(cal.get(Calendar.DATE)));
                   cal.roll(Calendar.DATE, true);
              } else {
                   days[h].setText("");
         this.setCalendar(cal);
         mainPanel.setVisible(true);
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @return java.util.Calendar
    public java.util.Calendar getCalendar() {
         if (this.calendar == null){
              calendar = Calendar.getInstance();
         return calendar;
    * set up the layout and look of the dialog
    * but don't do any data yet.
    * Creation date: (2/5/00 11:02:37 AM)
    private void initialize() {
         JButton jb;
         /* layout:
         North panel: month + year display
         Center Panel: buttons for the days, 5 by 7 grid
         South Panel: navigation buttons */
         mainPanel = new JPanel();
         JPanel northPanel = new JPanel();
         JPanel centerPanel = new JPanel();
         JPanel southPanel = new JPanel();
         //widgets
         //NORTH
         monthLabel = new JLabel(months[9] + " 1953");
         northPanel.setLayout(new FlowLayout());
         northPanel.add(monthLabel);
         //CENTER
         centerPanel.setLayout(new GridLayout(5,7));
         days = new JButton[35];
         for (int i = 0; i <35; i++){
              jb = new JButton(String.valueOf(i));
              jb.setSize(25,25);
              jb.setBorder(new EmptyBorder(1,1,1,1));
              jb.setFocusPainted(false);
              jb.setActionCommand("D");
              jb.addActionListener(this);
              days[i] = jb;
              centerPanel.add(jb);
         //SOUTH
         southPanel.setLayout(new FlowLayout());
         southPanel.add(this.makeButton("<<"));
         southPanel.add(this.makeButton("<"));
         southPanel.add(this.makeButton(">"));
         southPanel.add(this.makeButton(">>"));
         mainPanel.setLayout(new BorderLayout());
         mainPanel.add(northPanel, "North");
         mainPanel.add(centerPanel,"Center");
         mainPanel.add(southPanel, "South");
         this.getContentPane().add(mainPanel);
         this.setSize(150,150);
         caption();
    * for testing only.
    * Creation date: (2/5/00 11:19:35 AM)
    * @param args java.lang.String[]
    public static void main(String[] args) {
         try{
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
         } catch (Exception e){}
         final DateChooser dc = new DateChooser();
         JFrame jf = new JFrame();
         jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
         JPanel jp = new JPanel();
         final JTextField jff = new JTextField("The date field will hold the result.");
         JButton jb = new JButton("...");
         jb.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e){
                   dc.show();
    java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM);
    System.out.println(df.format(new java.util.Date()));
                   jff.setText("" + df.format(dc.getCalendar().getTime()));
         jp.add(jff);
         jp.add(jb);
         jf.getContentPane().add(jp);
         jf.setSize(300,300);
         jf.show();
         //set up location of the dialog
         dc.setLocationRelativeTo(jb);
    * return a button to the control Panel
    * Creation date: (2/5/00 10:57:59 AM)
    * @return java.lang.String
    private JButton makeButton(String caption) {
         JButton jb = new JButton(caption);
         jb.setSize(25,25);
         jb.setBorder(new EmptyBorder(1,4,1,4));
         jb.setFocusPainted(false);
         jb.setActionCommand(caption);
         jb.addActionListener(this);
         return jb;
    * roll the calendar to the day
    * then hide the dialog
    * Creation date: (2/5/00 11:40:31 AM)
    * @param day java.lang.String
    private void returnDate(String day) {
         this.getCalendar().set(this.getCalendar().get(Calendar.YEAR),this.getCalendar().get(Calendar.MONTH),Integer.parseInt(day));
         this.setVisible(false);
    * which way to roll the calendar
    * Creation date: (2/5/00 11:46:42 AM)
    * @param direction java.lang.String
    private void roll(String direction) {
         int field;
         if (direction.equals(">>")) calendar.roll(Calendar.YEAR,true);
         if (direction.equals(">")) calendar.roll(Calendar.MONTH,true);
         if (direction.equals("<<")) calendar.roll(Calendar.YEAR,false);
         if (direction.equals("<")) calendar.roll(Calendar.MONTH,false);
         caption();
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @param newCalendar java.util.Calendar
    public void setCalendar(java.util.Calendar newCalendar) {
         calendar = newCalendar;

    I don't give a stuff bout your prob... the formatting just pissed me off, thats all!
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.Date;
    import java.util.Calendar;
    * dialog to allow user to select a date and return
    * a java.util.Date object
    * Creation date: (2/5/00 10:57:04 AM)
    public class DateChooser extends JDialog implements ActionListener {
    //TODO: submit to resource bundle for internationalization
    private String[] months = {"Jan","Feb", "Mar","Apr", "May","June","July","Aug","Sept","Oct","Nov","Dec"};
    private JButton[] days = null;
    private JLabel monthLabel = null;
    private Calendar calendar = null;
    private JPanel mainPanel = null;
    * DateChooser constructor comment.
    public DateChooser() {
    super();
    this.setModal(true);
    initialize();
    * deal with all the buttons that may be pressed
    * Creation date: (2/5/00 11:36:11 AM)
    * @param e java.awt.event.ActionEvent
    public void actionPerformed(ActionEvent e) {
    String text;
    if (e.getActionCommand().equals("D")){
    //return a date
    text = ((JButton) e.getSource()).getText();
    if (text.length() > 0){
    this.returnDate(text);
    } else {
    Toolkit.getDefaultToolkit().beep();
    } else {
    this.roll(e.getActionCommand());
    * repaint the window with the supplied calendar date
    * Creation date: (2/5/00 11:04:03 AM)
    * @param d java.util.Date
    private void caption() {
    Calendar cal = this.getCalendar();
    int startPos;
    int currentMonth = cal.get(Calendar.MONTH);
    //for painting ease, quick display
    mainPanel.setVisible(false);
    //set month
    monthLabel.setText(months[cal.get(Calendar.MONTH)] + " " + cal.get(Calendar.YEAR));
    //set to first day
    cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1);
    //now work the day labels
    startPos = cal.get(Calendar.DAY_OF_WEEK);
    for (int i = startPos - 1; i < days.length; i++) {
    days.setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    if (cal.get(Calendar.DATE) == 1) {
    //clear remaining labels going forward
    for (int j = i + 1; j < days.length; j++) {
    days[j].setText("");
    break;
    //work first week
    for (int h = 0; h < startPos - 1; h++) {
    if (cal.get(Calendar.DATE) > 25 ) {
    days[h].setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    } else {
    days[h].setText("");
    this.setCalendar(cal);
    mainPanel.setVisible(true);
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @return java.util.Calendar
    public java.util.Calendar getCalendar() {
    if (this.calendar == null){
    calendar = Calendar.getInstance();
    return calendar;
    * set up the layout and look of the dialog
    * but don't do any data yet.
    * Creation date: (2/5/00 11:02:37 AM)
    private void initialize() {
    JButton jb;
    /* layout:
    North panel: month + year display
    Center Panel: buttons for the days, 5 by 7 grid
    South Panel: navigation buttons */
    mainPanel = new JPanel();
    JPanel northPanel = new JPanel();
    JPanel centerPanel = new JPanel();
    JPanel southPanel = new JPanel();
    //widgets
    //NORTH
    monthLabel = new JLabel(months[9] + " 1953");
    northPanel.setLayout(new FlowLayout());
    northPanel.add(monthLabel);
    //CENTER
    centerPanel.setLayout(new GridLayout(5,7));
    days = new JButton[35];
    for (int i = 0; i <35; i++){
    jb = new JButton(String.valueOf(i));
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,1,1,1));
    jb.setFocusPainted(false);
    jb.setActionCommand("D");
    jb.addActionListener(this);
    days = jb;
    centerPanel.add(jb);
    //SOUTH
    southPanel.setLayout(new FlowLayout());
    southPanel.add(this.makeButton("<<"));
    southPanel.add(this.makeButton("<"));
    southPanel.add(this.makeButton(">"));
    southPanel.add(this.makeButton(">>"));
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(northPanel, "North");
    mainPanel.add(centerPanel,"Center");
    mainPanel.add(southPanel, "South");
    this.getContentPane().add(mainPanel);
    this.setSize(150,150);
    caption();
    * for testing only.
    * Creation date: (2/5/00 11:19:35 AM)
    * @param args java.lang.String[]
    public static void main(String[] args) {
    try{
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e){}
    final DateChooser dc = new DateChooser();
    JFrame jf = new JFrame();
    jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    JPanel jp = new JPanel();
    final JTextField jff = new JTextField("The date field will hold the result.");
    JButton jb = new JButton("...");
    jb.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    dc.show();
    java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM);
    System.out.println(df.format(new java.util.Date()));
    jff.setText("" + df.format(dc.getCalendar().getTime()));
    jp.add(jff);
    jp.add(jb);
    jf.getContentPane().add(jp);
    jf.setSize(300,300);
    jf.show();
    //set up location of the dialog
    dc.setLocationRelativeTo(jb);
    * return a button to the control Panel
    * Creation date: (2/5/00 10:57:59 AM)
    * @return java.lang.String
    private JButton makeButton(String caption) {
    JButton jb = new JButton(caption);
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,4,1,4));
    jb.setFocusPainted(false);
    jb.setActionCommand(caption);
    jb.addActionListener(this);
    return jb;
    * roll the calendar to the day
    * then hide the dialog
    * Creation date: (2/5/00 11:40:31 AM)
    * @param day java.lang.String
    private void returnDate(String day) {
    this.getCalendar().set(this.getCalendar().get(Calendar.YEAR),this.getCalendar().get(Calendar.MONTH),Integer.parseInt(day));
    this.setVisible(false);
    * which way to roll the calendar
    * Creation date: (2/5/00 11:46:42 AM)
    * @param direction java.lang.String
    private void roll(String direction) {
    int field;
    if (direction.equals(">>")) calendar.roll(Calendar.YEAR,true);
    if (direction.equals(">")) calendar.roll(Calendar.MONTH,true);
    if (direction.equals("<<")) calendar.roll(Calendar.YEAR,false);
    if (direction.equals("<")) calendar.roll(Calendar.MONTH,false);
    caption();
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @param newCalendar java.util.Calendar
    public void setCalendar(java.util.Calendar newCalendar) {
    calendar = newCalendar;
    }

  • Help edit this code pliz

    Hi I got this code of the net which displays a calendar and when a date
    is selected from the calendar it is displayed in the textfield.
    At the moment if nothing is selected from the calendar it displays the first of the month in the textField.
    I want the calendar to work in such a way that if nothing is selected from the calendar then no changes are made to the textfield.
    Can someone help me out?
    Well the thing to look at is the main method.
    the main method:
    jb.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e){
                   dc.show();
                   jff.setText("" + dc.getCalendar().getTime());     
    The component works by exposing a Calendar object,
    which has been initialized to the first of the month.
    I think to change this, you would need to wrap the Calendar in
    a new method of Datechooser, like getDateText(). It
    would have code like
    return this.dateTextString;
    The DateChooser's actionPerformed method would need to
    update the dateTextString variable that this new
    method would expose...
    I don't have time to do this... can someone do this for me....pliz
    Thanks alot
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.Date;
    import java.util.Calendar;
    * dialog to allow user to select a date and return
    * a java.util.Date object
    * Creation date: (2/5/00 10:57:04 AM)
    public class DateChooser extends JDialog implements ActionListener {
    //TODO: submit to resource bundle for internationalization
    private String[] months = {"Jan","Feb", "Mar","Apr", "May","June","July","Aug","Sept","Oct","Nov","Dec"};
    private JButton[] days = null;
    private JLabel monthLabel = null;
    private Calendar calendar = null;
    private JPanel mainPanel = null;
    * DateChooser constructor comment.
    public DateChooser() {
    super();
    this.setModal(true);
    initialize();
    * deal with all the buttons that may be pressed
    * Creation date: (2/5/00 11:36:11 AM)
    * @param e java.awt.event.ActionEvent
    public void actionPerformed(ActionEvent e) {
    String text;
    if (e.getActionCommand().equals("D")){
    //return a date
    text = ((JButton) e.getSource()).getText();
    if (text.length() > 0){
    this.returnDate(text);
    } else {
    Toolkit.getDefaultToolkit().beep();
    } else {
    this.roll(e.getActionCommand());
    * repaint the window with the supplied calendar date
    * Creation date: (2/5/00 11:04:03 AM)
    * @param d java.util.Date
    private void caption() {
    Calendar cal = this.getCalendar();
    int startPos;
    int currentMonth = cal.get(Calendar.MONTH);
    //for painting ease, quick display
    mainPanel.setVisible(false);
    //set month
    monthLabel.setText(months[cal.get(Calendar.MONTH)] + " " + cal.get(Calendar.YEAR));
    //set to first day
    cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1);
    //now work the day labels
    startPos = cal.get(Calendar.DAY_OF_WEEK);
    for (int i = startPos - 1; i < days.length; i++) {
    days.setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    if (cal.get(Calendar.DATE) == 1) {
    //clear remaining labels going forward
    for (int j = i + 1; j < days.length; j++) {
    days[j].setText("");
    break;
    //work first week
    for (int h = 0; h < startPos - 1; h++) {
    if (cal.get(Calendar.DATE) > 25 ) {
    days[h].setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    } else {
    days[h].setText("");
    this.setCalendar(cal);
    mainPanel.setVisible(true);
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @return java.util.Calendar
    public java.util.Calendar getCalendar() {
    if (this.calendar == null){
    calendar = Calendar.getInstance();
    return calendar;
    * set up the layout and look of the dialog
    * but don't do any data yet.
    * Creation date: (2/5/00 11:02:37 AM)
    private void initialize() {
    JButton jb;
    /* layout:
    North panel: month + year display
    Center Panel: buttons for the days, 5 by 7 grid
    South Panel: navigation buttons */
    mainPanel = new JPanel();
    JPanel northPanel = new JPanel();
    JPanel centerPanel = new JPanel();
    JPanel southPanel = new JPanel();
    //widgets
    //NORTH
    monthLabel = new JLabel(months[9] + " 1953");
    northPanel.setLayout(new FlowLayout());
    northPanel.add(monthLabel);
    //CENTER
    centerPanel.setLayout(new GridLayout(5,7));
    days = new JButton[35];
    for (int i = 0; i <35; i++){
    jb = new JButton(String.valueOf(i));
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,1,1,1));
    jb.setFocusPainted(false);
    jb.setActionCommand("D");
    jb.addActionListener(this);
    days = jb;
    centerPanel.add(jb);
    //SOUTH
    southPanel.setLayout(new FlowLayout());
    southPanel.add(this.makeButton("<<"));
    southPanel.add(this.makeButton("<"));
    southPanel.add(this.makeButton(">"));
    southPanel.add(this.makeButton(">>"));
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(northPanel, "North");
    mainPanel.add(centerPanel,"Center");
    mainPanel.add(southPanel, "South");
    this.getContentPane().add(mainPanel);
    this.setSize(150,150);
    caption();
    * for testing only.
    * Creation date: (2/5/00 11:19:35 AM)
    * @param args java.lang.String[]
    public static void main(String[] args) {
    try{
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e){}
    final DateChooser dc = new DateChooser();
    JFrame jf = new JFrame();
    jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    JPanel jp = new JPanel();
    final JTextField jff = new JTextField("The date field will hold the result.");
    JButton jb = new JButton("...");
    jb.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    dc.show();
    java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM);
    System.out.println(df.format(new java.util.Date()));
    jff.setText("" + df.format(dc.getCalendar().getTime()));
    jp.add(jff);
    jp.add(jb);
    jf.getContentPane().add(jp);
    jf.setSize(300,300);
    jf.show();
    //set up location of the dialog
    dc.setLocationRelativeTo(jb);
    * return a button to the control Panel
    * Creation date: (2/5/00 10:57:59 AM)
    * @return java.lang.String
    private JButton makeButton(String caption) {
    JButton jb = new JButton(caption);
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,4,1,4));
    jb.setFocusPainted(false);
    jb.setActionCommand(caption);
    jb.addActionListener(this);
    return jb;
    * roll the calendar to the day
    * then hide the dialog
    * Creation date: (2/5/00 11:40:31 AM)
    * @param day java.lang.String
    private void returnDate(String day) {
    this.getCalendar().set(this.getCalendar().get(Calendar.YEAR),this.getCalendar().get(Calendar.MONTH),Integer.parseInt(day));
    this.setVisible(false);
    * which way to roll the calendar
    * Creation date: (2/5/00 11:46:42 AM)
    * @param direction java.lang.String
    private void roll(String direction) {
    int field;
    if (direction.equals(">>")) calendar.roll(Calendar.YEAR,true);
    if (direction.equals(">")) calendar.roll(Calendar.MONTH,true);
    if (direction.equals("<<")) calendar.roll(Calendar.YEAR,false);
    if (direction.equals("<")) calendar.roll(Calendar.MONTH,false);
    caption();
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @param newCalendar java.util.Calendar
    public void setCalendar(java.util.Calendar newCalendar) {
    calendar = newCalendar;

    there are 2 errors in ur code which i removed and run the application.I dont understand really what is ur task??the text filed shows this text "The date field will hold the result." if calender is not selected.here is ur code.now withour errors
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.Date;
    import java.util.Calendar;
    * dialog to allow user to select a date and return
    * a java.util.Date object
    * Creation date: (2/5/00 10:57:04 AM)
    public class DateChooser extends JDialog implements ActionListener {
    //TODO: submit to resource bundle for internationalization
    private String[] months = {"Jan","Feb", "Mar","Apr", "May","June","July","Aug","Sept","Oct","Nov","Dec"};
    private JButton[] days = null;
    private JLabel monthLabel = null;
    private Calendar calendar = null;
    private JPanel mainPanel = null;
    * DateChooser constructor comment.
    public DateChooser() {
    super();
    this.setModal(true);
    initialize();
    * deal with all the buttons that may be pressed
    * Creation date: (2/5/00 11:36:11 AM)
    * @param e java.awt.event.ActionEvent
    public void actionPerformed(ActionEvent e) {
    String text;
    if (e.getActionCommand().equals("D")){
    //return a date
    text = ((JButton) e.getSource()).getText();
    if (text.length() > 0){
    this.returnDate(text);
    } else {
    Toolkit.getDefaultToolkit().beep();
    } else {
    this.roll(e.getActionCommand());
    * repaint the window with the supplied calendar date
    * Creation date: (2/5/00 11:04:03 AM)
    * @param d java.util.Date
    private void caption() {
    Calendar cal = this.getCalendar();
    int startPos;
    int currentMonth = cal.get(Calendar.MONTH);
    //for painting ease, quick display
    mainPanel.setVisible(false);
    //set month
    monthLabel.setText(months[cal.get(Calendar.MONTH)] + " " + cal.get(Calendar.YEAR));
    //set to first day
    cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1);
    //now work the day labels
    startPos = cal.get(Calendar.DAY_OF_WEEK);
    for (int i = startPos - 1; i < days.length; i++) {
    days.setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    if (cal.get(Calendar.DATE) == 1) {
    //clear remaining labels going forward
    for (int j = i + 1; j < days.length; j++) {
    days[j].setText("");
    break;
    //work first week
    for (int h = 0; h < startPos - 1; h++) {
    if (cal.get(Calendar.DATE) > 25 ) {
    days[h].setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    } else {
    days[h].setText("");
    this.setCalendar(cal);
    mainPanel.setVisible(true);
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @return java.util.Calendar
    public java.util.Calendar getCalendar() {
    if (this.calendar == null){
    calendar = Calendar.getInstance();
    return calendar;
    * set up the layout and look of the dialog
    * but don't do any data yet.
    * Creation date: (2/5/00 11:02:37 AM)
    private void initialize() {
    JButton jb;
    /* layout:
    North panel: month + year display
    Center Panel: buttons for the days, 5 by 7 grid
    South Panel: navigation buttons */
    mainPanel = new JPanel();
    JPanel northPanel = new JPanel();
    JPanel centerPanel = new JPanel();
    JPanel southPanel = new JPanel();
    //widgets
    //NORTH
    monthLabel = new JLabel(months[9] + " 1953");
    northPanel.setLayout(new FlowLayout());
    northPanel.add(monthLabel);
    //CENTER
    centerPanel.setLayout(new GridLayout(5,7));
    days = new JButton[35];
    for (int i = 0; i <35; i++){
    jb = new JButton(String.valueOf(i));
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,1,1,1));
    jb.setFocusPainted(false);
    jb.setActionCommand("D");
    jb.addActionListener(this);
    days[i] = jb;
    centerPanel.add(jb);
    //SOUTH
    southPanel.setLayout(new FlowLayout());
    southPanel.add(this.makeButton("<<"));
    southPanel.add(this.makeButton("<"));
    southPanel.add(this.makeButton(">"));
    southPanel.add(this.makeButton(">>"));
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(northPanel, "North");
    mainPanel.add(centerPanel,"Center");
    mainPanel.add(southPanel, "South");
    this.getContentPane().add(mainPanel);
    this.setSize(150,150);
    caption();
    * for testing only.
    * Creation date: (2/5/00 11:19:35 AM)
    * @param args java.lang.String[]
    public static void main(String[] args) {
    try{
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e){}
    final DateChooser dc = new DateChooser();
    JFrame jf = new JFrame();
    jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    JPanel jp = new JPanel();
    final JTextField jff = new JTextField("The date field will hold the result.");
    JButton jb = new JButton("...");
    jb.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    dc.show();
    java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM);
    System.out.println(df.format(new java.util.Date()));
    jff.setText("" + df.format(dc.getCalendar().getTime()));
    jp.add(jff);
    jp.add(jb);
    jf.getContentPane().add(jp);
    jf.setSize(300,300);
    jf.show();
    //set up location of the dialog
    dc.setLocationRelativeTo(jb);
    * return a button to the control Panel
    * Creation date: (2/5/00 10:57:59 AM)
    * @return java.lang.String
    private JButton makeButton(String caption) {
    JButton jb = new JButton(caption);
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,4,1,4));
    jb.setFocusPainted(false);
    jb.setActionCommand(caption);
    jb.addActionListener(this);
    return jb;
    * roll the calendar to the day
    * then hide the dialog
    * Creation date: (2/5/00 11:40:31 AM)
    * @param day java.lang.String
    private void returnDate(String day) {
    this.getCalendar().set(this.getCalendar().get(Calendar.YEAR),this.getCalendar().get(Calendar.MONTH),Integer.parseInt(day));
    this.setVisible(false);
    * which way to roll the calendar
    * Creation date: (2/5/00 11:46:42 AM)
    * @param direction java.lang.String
    private void roll(String direction) {
    int field;
    if (direction.equals(">>")) calendar.roll(Calendar.YEAR,true);
    if (direction.equals(">")) calendar.roll(Calendar.MONTH,true);
    if (direction.equals("<<")) calendar.roll(Calendar.YEAR,false);
    if (direction.equals("<")) calendar.roll(Calendar.MONTH,false);
    caption();
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @param newCalendar java.util.Calendar
    public void setCalendar(java.util.Calendar newCalendar) {
    calendar = newCalendar;

  • Pls help with this precedure

    when I ran this cursor, I get the right results, the idea is that when an email on this table szcasud_email is diffrent than an email on this table GOREMAL.
    I will deactivate the email on this table
    UPDATE general.goremal
    SET
    goremal_status_ind = 'I'
    Then I will insert the new email that is store on this table szcasud
    This code is not consistent: It works sometimes but not all the time..
    goremal_status_ind = 'I' Inactive email
    goremal_status_ind = 'A' Active email
    PROCEDURE appl_email_update (
    p_user IN VARCHAR2,
    p_update_err_code OUT VARCHAR2,
    p_ora_err_code OUT NUMBER,
    p_ora_err_msg OUT VARCHAR2
    IS
    Modification History
    09/20/2009 Creator:  Changes:
    This precedure will check to see if the email coming in on the supplement is
    different that an existing email in goremal(REC1), if it is, it will deactivate
    the existing one and create a new record with the new email coming in.
    v_out_path VARCHAR2 (40) := 'MIDD_LOG';
    v_out_file VARCHAR2 (40)
    := 'common_app_load_pkg' || TO_CHAR (SYSDATE, 'YYYYMMDDHH');
    v_file_handle UTL_FILE.file_type;
    e_update_zero EXCEPTION;
    v_count NUMBER := 0;
    v_pidm spriden.spriden_pidm%TYPE;
    v_email_address goremal.goremal_email_address%TYPE;
    v_email_address2 goremal.goremal_email_address%TYPE;
    v_emal_code goremal.goremal_emal_code%TYPE;
    CURSOR upd_email_upd_cur
    IS
    SELECT
    DISTINCT
    spriden_pidm,
    REGEXP_REPLACE (szcasud_email,
    '[^0-9a-zA-Z+._@-]',
    NULL
    ),REGEXP_REPLACE(GOREMAL_EMAIL_ADDRESS, '[^0-9a-zA-Z+._@-]',
    NULL
    FROM
    saturn_midd.szcasud,
    saturn.spriden,
    general.goremal
    WHERE spriden_id = szcasud_common_appl_id
    and goremal_pidm = spriden_pidm
    and REGEXP_REPLACE (szcasud_email,
    '[^0-9a-zA-Z+._@-]',
    NULL
    ) <> REGEXP_REPLACE(GOREMAL_EMAIL_ADDRESS, '[^0-9a-zA-Z+._@-]',
    NULL
    AND spriden_ntyp_code = 'CAPP'
    AND GOREMAL_STATUS_IND = 'A'
    and goremal_emal_code = 'REC1';
    BEGIN
    UTL_FILE.fclose_all;
    v_file_handle := UTL_FILE.fopen (v_out_path, v_out_file, 'a');
    UTL_FILE.put_line (v_file_handle,
    CHR (10) || TO_CHAR (SYSDATE, 'DD-MON-YYYY HH:MI:SS')
    UTL_FILE.put_line (v_file_handle, 'Entering appl_email_update');
    /*In case there are old emails that are different, deactivate the existing one
    before inserting the new one */
    IF upd_email_upd_cur%ISOPEN
    THEN
    CLOSE upd_email_upd_cur;
    END IF;
    OPEN upd_email_upd_cur;
    LOOP
    FETCH upd_email_upd_cur
    INTO v_pidm,v_email_address,v_email_address2;
    EXIT WHEN upd_email_upd_cur%NOTFOUND;
    IF upd_email_upd_cur%FOUND
    THEN
    UPDATE general.goremal
    SET
    goremal_status_ind = 'I',
    goremal_activity_date = SYSDATE,
    goremal_data_origin = 'common_app_load_pkg',
    goremal_user_id = p_user
    WHERE goremal_pidm = v_pidm AND goremal_emal_code = 'REC1';
    END IF;
    COMMIT;
    ---END LOOP;
    INSERT INTO general.goremal
    goremal_pidm,
    goremal_emal_code,
    goremal_status_ind,
    goremal_preferred_ind,
    goremal_activity_date,
    goremal_user_id,
    goremal_disp_web_ind,
    goremal_email_address,
    goremal_data_origin
    SELECT
    DISTINCT
    spriden_pidm,
    'REC1',
    'A',
    'N',
    SYSDATE,
    p_user,
    'N',
    REGEXP_REPLACE (szcasud_email,
    '[^0-9a-zA-Z+._@-]',
    NULL
    -- ),REGEXP_REPLACE(GOREMAL_EMAIL_ADDRESS, '[^0-9a-zA-Z+._@-]',
    --- NULL
    'common_app_load_pkg'
    FROM
    saturn_midd.szcasud,
    saturn.spriden,
    general.goremal a
    WHERE spriden_id = szcasud_common_appl_id
    and a.goremal_pidm = spriden_pidm
    AND a.goremal_pidm = v_pidm
    and REGEXP_REPLACE (szcasud_email,
    '[^0-9a-zA-Z+._@-]',
    NULL
    ) <> REGEXP_REPLACE(a.goremal_email_address, '[^0-9a-zA-Z+._@-]',
    NULL
    AND spriden_ntyp_code = 'CAPP'
    and goremal_emal_code = 'REC1'
    AND goremal_status_ind = 'I'
    AND NOT EXISTS
    (SELECT 1
    FROM
    general.goremal B
    WHERE b.goremal_pidm = a.goremal_pidm
    and b.goremal_emal_code = 'REC1'
    and b.goremal_status_ind = 'A');
    END LOOP;
    COMMIT;
    CLOSE upd_email_upd_cur;
    SELECT COUNT (goremal_pidm)
    INTO v_count
    FROM general.goremal
    WHERE TO_CHAR (goremal_activity_date, 'MM/DD/RRRR') =
    TO_CHAR (SYSDATE, 'MM/DD/RRRR')
    AND goremal_data_origin = 'common_appl_data_pkg';
    IF v_count = 0
    THEN
    RAISE e_update_zero;
    ELSE
    UTL_FILE.put_line (v_file_handle,
    'Number of Records Update' || v_count
    END IF;
    EXCEPTION
    WHEN e_update_zero
    THEN
    ROLLBACK;
    p_update_err_code :=
    'CC_ERROR_MSG: Insert Procedure. ZERO Rows Returned in appl_email_update '
    || '.';
    p_ora_err_msg := SUBSTR (SQLERRM, 1, 2000);
    p_ora_err_code := SQLCODE;
    UTL_FILE.put_line (v_file_handle,
    p_update_err_code
    || CHR (10)
    || 'sqlerrm: '
    || p_ora_err_msg
    || ' / sqlcode: '
    || SQLCODE
    WHEN OTHERS
    THEN
    ROLLBACK;
    p_update_err_code :=
    'CC_ERROR_MSG: Error on UPDATE statement for term ' || '.';
    p_ora_err_msg := SUBSTR (SQLERRM, 1, 2000);
    p_ora_err_code := SQLCODE;
    END appl_email_update;

    maybe I am missing something here but couldn't you just do one update statement and one insert statement instead of a cursor?
    something like for the update part
    merge INTO general.goremal a USING
    ( SELECT DISTINCT spriden_pidm,
      REGEXP_REPLACE (szcasud_email, '[^0-9a-zA-Z+._@-]', NULL ),
      REGEXP_REPLACE(GOREMAL_EMAIL_ADDRESS, '[^0-9a-zA-Z+._@-]', NULL )
    FROM saturn_midd.szcasud,
      saturn.spriden,
      general.goremal
    WHERE spriden_id = szcasud_common_appl_id
    AND goremal_pidm = spriden_pidm
    AND REGEXP_REPLACE (szcasud_email, '[^0-9a-zA-Z+._@-]', NULL ) REGEXP_REPLACE(GOREMAL_EMAIL_ADDRESS, '[^0-9a-zA-Z+._@-]', NULL )
    AND spriden_ntyp_code  = 'CAPP'
    AND GOREMAL_STATUS_IND = 'A'
    AND goremal_emal_code  = 'REC1'
    ) b ON (a.goremal_pidm = b.spriden_pidm AND a.goremal_emal_code = 'REC1')
    WHEN matched THEN
      UPDATE
      SET a.goremal_status_ind  = 'I',
        a.goremal_activity_date = SYSDATE,
        a.goremal_data_origin   = 'common_app_load_pkg',
        a.goremal_user_id       = p_user;and maybe another merge for the insert or just the select you are using just change the
    AND a.goremal_pidm = v_pidmand a.goremal_pidm in (select pidm from blah blah blah)

  • I need help with this code

    Hello could any one tell me why this code is not writing to a file a i want to store what ever i enter in the applet a a file called applications.text
    Code:
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.applet.Applet.*;
    import javax.swing.border.*;
    public class ChinaTown5 extends JApplet
              implements ItemListener, ActionListener {
              private int foodIngrd1 = 0 ,foodIngrd2 = 0, foodIngrd3 = 0, foodIngrd4 = 0;
              private int foodIngrd5 = 0, foodIngrd6 = 0;                                    
              private JCheckBox hockey, football, swimming, golf, tennis, badminton;
              private String fName, lName, add, post_code, tel, url, datejoined,flag = "f1";
              private String value, converter, gender, sportType, show, sport, readData;
              private JRadioButton male, female;
              private JButton submit, clear, display;
              private DataInputStream receive;
              private DataOutputStream send;
              private String archive;
              Socket echoSocket = null;
    PrintWriter out = null;
    BufferedReader in = null;
              private JTextField joining_date;
              private JTextField textFName;
              private JTextField textLName;
              private JTextField telephone;
              private JTextField postcode;
              private JTextField address;
              private JTextField website;
              private JTextArea output,recieved;
              private double info = 0.0;
              private     ButtonGroup c;
              Socket Client ;
              public void init() {
                   JPanel main = new JPanel();     
                   JPanel info = new JPanel();
                   JPanel gender = new JPanel();
                   JPanel txt= new JPanel();
                   JPanel txtArea= new JPanel();
                   main.setLayout( new BorderLayout());
                   gender.setLayout(new GridLayout(1,2));
                   info.setLayout (new GridLayout(3,2 ));
                   txt.setLayout(new GridLayout(17,1));
                   txtArea.setLayout(new GridLayout(2,1));                                   
                   c = new ButtonGroup();
                   male = new JRadioButton("Male", false);
                   female = new JRadioButton("Female", false);
                   c.add(male);
                   c.add(female);
                   gender.add(male);
                   gender.add(female);
                   male.addItemListener(this);
                   female.addItemListener(this);
                   hockey = new JCheckBox ("Hockey");
                   info.add (hockey);
                   hockey.addItemListener (this);
                   football = new JCheckBox ("Football");
                   info.add (football);
                   football.addItemListener (this);
                   swimming = new JCheckBox ("Swimming");
                   info.add (swimming);
                   swimming.addItemListener (this);
                   tennis = new JCheckBox ("Tennis");
                   info.add (tennis);
                   tennis.addItemListener (this);
                   golf = new JCheckBox ("Golf");
                   info.add (golf);
                   golf.addItemListener (this);
                   badminton = new JCheckBox ("Badminton");
                   info.add (badminton);
                   badminton.addItemListener (this);
                   txt.add (new JLabel("First Name:"));
                   textFName = new JTextField(20);
                   txt.add("Center",textFName);
                   textFName.addActionListener (this);
                   txt.add (new JLabel("Last Name:"));
                   textLName = new JTextField(20);
                   txt.add("Center",textLName);
                   textLName.addActionListener (this);
                   txt.add (new JLabel("Telephone:"));
                   telephone = new JTextField(15);
                   txt.add("Center",telephone);
                   telephone.addActionListener (this);
                   txt.add (new JLabel("Date Joined:"));
                   joining_date = new JTextField(10);
                   txt.add("Center",joining_date);
                   joining_date.addActionListener (this);
                   txt.add (new JLabel("Address:"));
                   address = new JTextField(40);
                   txt.add("Center",address);
                   address.addActionListener (this);
                   txt.add (new JLabel("Postcode:"));
                   postcode = new JTextField(15);
                   txt.add("Center",postcode);
                   postcode.addActionListener (this);
                   txt.add (new JLabel("URL Address:"));
                   website = new JTextField(25);
                   txt.add("Center",website);
                   website.addActionListener (this);
                   output = new JTextArea( 15, 45);
                   output.setEditable( false );
                   output.setFont( new Font( "Arial", Font.BOLD, 12));
                   recieved = new JTextArea( 10, 40);
                   recieved .setEditable( false );
                   recieved .setFont( new Font( "Arial", Font.BOLD, 12));
                   txtArea.add(output);
                   txtArea.add(recieved);
                   submit = new JButton ("Submit Details");
                   submit.setEnabled(false);
                   info.add (submit);
                   submit.addActionListener(this);
                   clear = new JButton ("Clear Form");
                   clear.addActionListener(this);
                   info.add (clear);
                   display = new JButton ("Display");
                   display.addActionListener(this);
                   info.add (display);
                   EtchedBorder border = new EtchedBorder();
                   gender.setBorder(new TitledBorder(border,"Sex" ));
                   main.setBorder(new TitledBorder(border,"Computer Programmers Sports Club" ));
                   EtchedBorder border_sport = new EtchedBorder();
                   info.setBorder(new TitledBorder(border_sport," Select Preferred Sport(s)" ));
                   EtchedBorder border_info = new EtchedBorder();
                   txt.setBorder(new TitledBorder(border_info ," Personal Information" ));
                   EtchedBorder border_txtArea= new EtchedBorder();
                   txtArea.setBorder(new TitledBorder(border_info ," Registration Details" ));
                   main.add("North",txt);
                   main.add("West",gender);
                   main.add("East",info);
                   main.add("South",txtArea);
                   setContentPane(main);
              public void itemStateChanged (ItemEvent event) {
                   if (event.getItemSelectable() == male) {
                        gender = "Male";
                   else if (event.getItemSelectable() == female) {
                        gender = "Female";
                   if (event.getSource() == hockey) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + hockey.getLabel() + " ";
                   else if (event.getSource() == golf) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + golf.getLabel() + " ";
                   else if (event.getSource() == badminton) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + badminton.getLabel() + " ";
                   else if (event.getSource() == swimming) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + swimming.getLabel() + " ";
                   else if (event.getSource() == tennis) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + tennis.getLabel() + " ";
                   else if (event.getSource() == football) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + football.getLabel() + " ";
                   chkError();
                   repaint();
              public void chkError() {
                   if (gender != " " && sport != " " && fName != " " && lName != " "
                        && add != " " && post_code != " " && datejoined != " " ) {
                        submit.setEnabled(true);
              public void errMsg() {
                        JOptionPane.showMessageDialog( null, "Please Enter your Name and address and date joined and your sex");
                        show = (      "\n\t\t **************************************************" +
                                       "\n\t\t\t Error" +
                                       "\n\t\t **************************************************" +
                                       "\n\n\t Please Enter your Name and address and date joined and your sex");
                        output.setText( show );               
              public void displayDetails() {          
                   show = ( "\n\t\t **************************************************" +
                             "\n\t\t\t Registration Details" +
                             "\n\t\t **************************************************" +
                             "\n\t First Name:" + "\t" + fName +
                             "\n\t Last name: " + "\t" + lName +
                             "\n\t Sex:" + "\t" + gender +
                             "\n\t Tel No:" + "\t" + tel +
                             "\n\t Url Address:" + "\t" + url +
                             "\n\t Address:" + "\t" + add +
                             "\n\t Postcode:" + "\t" + post_code +
                             "\n\t Sport:" + "\t" + sport +
                             "\n\n\t\t\t Thank You For Registering" );
                   output.setText( show );
              public void LogFile() {
                   archive = ("\n\t First Name:" + "\t" + fName +
                             "\n\t Last name: " + "\t" + lName +
                             "\n\t Sex:" + "\t" + gender +
                             "\n\t Tel No:" + "\t" + tel +
                             "\n\t Url Address:" + "\t" + url +
                             "\n\t Address:" + "\t" + add +
                             "\n\t Postcode:" + "\t" + post_code +
                             "\n\t Sport:" + "\t" + sport);
                   try {
              BufferedWriter out = new BufferedWriter(new FileWriter("applications.txt"));
              out.write(archive);
              out.close();
              catch ( IOException e) {System.out.println("Exception: File Not Found");}
              public void actionPerformed (ActionEvent e){
                   if ( e.getSource() == submit) {
                        datejoined = joining_date.getText();
                        post_code = postcode.getText();
                        fName = textFName.getText();
                        lName = textLName.getText();
                        add = address.getText();
                        tel = telephone.getText();
                        url = website.getText();
                        if ( gender != " " && sport != " " && fName != " " && lName != " "
                        && add != " " && post_code != " " && datejoined != " " ) {     
                        LogFile();
                        displayDetails();
                        else { errMsg(); }
                   if (e.getSource() == display) {
                        try {
                             BufferedReader reader = new BufferedReader(new FileReader(new File("applications.txt")));
                             String readData;
                             while( (readData = reader.readLine()) != null ){     
                                  out.println(readData);
                                  recieved.setText(readData);
                        catch (IOException err) {System.err.println("Error: " + err);}          
                   if ( e.getSource() == clear ) {
                        badminton.setSelected(false);
                        swimming.setSelected(false);
                        football.setSelected(false);
                        tennis.setSelected(false);
                        hockey.setSelected(false);
                        golf.setSelected(false);
                        female.setSelected(false);
                        male.setSelected(false);
         textFName.setText(" ");
                        textLName.setText(" ");
                        address.setText(" ");
                        postcode.setText(" ");
                        telephone.setText(" ");
                        website.setText(" ");
                        joining_date.setText(" ");
                        output.setText(" ");
                        gender = " ";
                        sport = " ";
              repaint ();
    }

    Why isn't it writing to a file? Most likely because it's an applet and you haven't signed it. Applets are not allowed to access data on the client system like that.

  • Pls help in this query

    Hi,
    I've needed to print output like below. pls help me out .
    Thanks & Regards,
    Ramana.

    SQL> select '*****'||chr(10)||'****'||chr(10)||'***'||chr(10)||'**'||chr(10)||'*' from dual;
    '*****'||CHR(10)||'
    SQL>

Maybe you are looking for

  • Can't display three field in the ALV report

    hi all, i have made a report ALV in which i have to display these fields: BANFN,EMATN,TXZ01,MENGE,NETPR,EBELN,BEDAT,LIFNR,NAME1 and the table which im using are EKKO,EKPO,LFA1. Actually only three fileds i-e (EBELN,LIFNR,NAME1) are not displaying in

  • Error message when updating to iTunes 8.0

    I have been using and upgrading iTunes on my laptop for a long time now, and have never experienced this problem before. When updating, it begins installing, then gives me an error message saying: "The feature you are trying to use is on a network re

  • Why can't I access the "webpage" and "bookmarks" tabs in Safari on my iPad2?

    Sometimes when I'm using Safari, I can't access other webpages that I already have open. I click on the tab multiple times, but I stay on the current page. I also can't access any of my bookmarks (basically, none of the buttons next to the search bar

  • How to create Primary key

    I want to insert HOSTID that has unique values in a new application in a primary key column in database. I am starting with h000000001 and I want to go from that to h000000002 and .... h0000000010 , 11, 12 etc etc. How do I do this? I did this: rs =

  • ExternalInterface in C# form does not work with debug ActiveX control

    Hello, I have a C# form that is a container for the Flash ActiveX control. Everything works find as far as communication between the two (container and Actionscript) if I use the release version of the ActiveX control. If I use the debug version, the