How to put checkbox into sap grid display

hi,
     how to put checkbox into sap grid display ,when i am selecting the check box it should move to second secondary list.
      could u plz explain clearly

Hi,
In the layout fill
is_layout-box_fieldname = 'CHECKBOX'
is_layout-box_tabname   = 'I_OUTPUT'.
The internal table that you are passing as I_OUTPUT, should have an extra field called CHECKBOX of length 1.
Also refer to tutorial Easy Grid :
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf
Cheers,
Simha.

Similar Messages

  • How to put checkbox into classical report header row?

    Hi,
    I have a classical report that has a check item as a first column. I would like to put a check box item into the header row too, When checked it is supposed to set the check box item in all report rows. Something like in APEX Shared components / Links / Grid Edit.
    Is this possible to do? TIA.
    Tamas

    Hi,
    See e.g. this post
    Re: Tabular form check all checkbox header
    Regards,
    Jari

  • How to put data into a RFC import parameter structure from portal

    Hi, All,
    I have a RFC in which an import parameter is a structure (not a table). I want to put data into that structure. I know how to put data into a table or a string. I tried to use
    IRecordSet MyTABStr = (IRecordSet)structureFactory.getStructure(function.getParameter("MYTABSTR").getStructure());
    MyTABStr.setString("FIELD1", value1);
    MyTABStr.setString("FIELD2", value2);
    importParams.put("MYTABSTR",MyTABStr);
    But it works for table not structure.  Is there anybody know how to do that?
    Thanks in advance!
    Meiying

    Hi,
    You can try the following code -
    IRecord structure = (IRecord)structureFactory.getStructure(function.getParameter("MYTABSTR").getStructure());
    structure.setString("FIELD1", value1);
    structure.setString("FIELD2", value2);
    importParams.put("MYTABSTR",structure);
    Regards,
    Sudip

  • How to install FLEX in SAP WAS and How to deploy project into SAP EP ?

    Hi.
    I want to create SAP EP Contents using FLEX and I have serveral question about this.
    1. How to install Flex into SAP EP and What do I have to install ?
    2. When we developing SAP EP Contents using FLEX,
        Which Tool do I have to use ? (NWDS or Flex Builder)
    3. After we develop contents, How can I deploy into SAP EP and
       How to create iView for Flex Application ?
    Sorry for many question.
    Kindly explain this.
    Regads, Arnold.

    Hi Arnold,
    here my answers to your questions:
    1) You don't need to install flex under EP, you need only adobe flash player 9 on EP
    2) If you want to develop a SAP Ep cont using Flex, you need adobe flex builder 2 or 3 (ide based).
    3)You can store under any EP folder (es. KM) the .swf  object and html page of FLEX application, create an iView and call the url link
    or load the .swf as mime object in BSP on backend syst, include in a bsp page and create iView for bsp..
    Regards
    Raffaele

  • How to upload Materials into  SAP

    HI,
         How to upload Materials into  SAP using MATMAS05 Idoc type?

    use the lsmw standard existing bapi or idoc method to upload the data into sap

  • How to upload forecast into sap.

    how to upload forecast into sap.

    Hi
    You can use MD61 - create planned independent requirements or MM17 - Mass Maintenance
    Thanks !
    E.Avudaiappan

  • E mail how to put photo into body of e-mail without recipient having to click downloadload

    e mail how to put photo into body of e-mail without recipient having to click downloadload

    What and how an email is seen on the other person's machine is dependent on their settings and not what you do. You can, for instance, send a HTML email, but if they haven't set their machine to deal with those, it won't work. It's all down to them.

  • What is Investment allowance on asset. and How can we map into SAP?

    Hi all,
    I want know what is investment allowance on asset and how can we map into sap?
    Thank you in advance.
    Regards,
    Chandu.

    hello chandu ,
    In order to encourage substantial investment in plant or machinery clause 5 of the Finance Bill, 2013 seeks to insert new section 32AC in the Income-tax Act, 1961 to provide for deduction for
    investment in new plant or machinery by a company.   It is allowed over and above the depreciation rates.   This is for tax calculation purpose for availing this benefit so many conditions to be fullfilled.   In sap this can be handled through development only.  n.selvakumar.

  • How to Set Checkbox of ALV Grid Dark on Display Mode

        ABAP experts, I want to switch between display mode and edit mode for some columns of ALV Grid. So I set "LVC_S_FCAT-EDIT" "X" for the columns which need to switch mode, and use method "SET_READY_FOR_INPUT" to switch.
        Currently, the function of switch mode has been achieved. But icons of checkbox columns are light but not dark when display mode, although the columns can't be edited. (Please refer to the image below.) I want to make checkbox columns dark as other columns on display mode.
        I tried to use "CL_GUI_ALV_GRID=>MC_STYLE_ENABLED" and "CL_GUI_ALV_GRID=>MC_STYLE_DISABLED", but failed. I also studied sample program "BCALV_EDIT_05" which is related to checkbox in ALV Grid, and compared my program with this program. But I still have not found problems.
        Help me solve this problem, please.
        Part of my codes are as follows.
        Part 1:
    IF iv_is_create_group = abap_true OR iv_is_edit_group = abap_true.
           set_enable( iv_flag = 1 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             CLEAR ls_celltab.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_enabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ELSE.
           set_enable( iv_flag = 0 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_disabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ENDIF.
         CALL METHOD gr_grid->refresh_table_display
    *      EXPORTING
    *        is_stable      =
    *        i_soft_refresh =
           EXCEPTIONS
             finished       = 1
             OTHERS         = 2
         IF sy-subrc <> 0.
    *     Implement suitable error handling here
         ENDIF.
        Part 2:
    METHOD set_enable.
         gr_grid->set_ready_for_input(
             i_ready_for_input = iv_flag
    ENDMETHOD.

    Hi Liu,
        Please go through the below code.
    *& Report  YEDIT_DISPLAY
    REPORT  YEDIT_DISPLAY.
    TABLES : VBAK.
    TYPE-POOLS SLIS.
    TYPES : BEGIN OF TY_VBAK,
              VBELN TYPE VBAK-VBELN,
             END OF TY_VBAK,
             BEGIN OF TY_FINAL,
               BOX TYPE C,
               VBELN TYPE VBAK-VBELN,
             END OF TY_FINAL.
    DATA : IT_VBAK TYPE TABLE OF TY_VBAK,
            WA_VBAK TYPE TY_VBAK,
            IT_FINAL TYPE TABLE OF TY_FINAL,
            WA_FINAL TYPE TY_FINAL,
            IT_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
            WA_FCAT TYPE SLIS_FIELDCAT_ALV.
    START-OF-SELECTION.
       PERFORM FETCH_DATA.
       PERFORM FCAT_DATA.
       PERFORM DISPLAY.
    *&      Form  FETCH_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FETCH_DATA .
       SELECT VBELN INTO TABLE IT_VBAK FROM VBAK UP TO 10 ROWS.
       LOOP AT IT_VBAK INTO WA_VBAK.
         WA_FINAL-VBELN = WA_VBAK-VBELN.
         APPEND WA_FINAL TO IT_FINAL.
         CLEAR : WA_FINAL , WA_VBAK.
       ENDLOOP.
    ENDFORM.                    " FETCH_DATA
    *&      Form  FCAT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FCAT_DATA .
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
       WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FCAT_DATA
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY .
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY
    FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM
                             RTAB TYPE slis_selfield.
       CASE UCOMM.
         WHEN '&IC1'.
           MESSAGE 'SUCESSFUL' TYPE 'S'.
         WHEN '&DATA_SAVE'.
           PERFORM FIL_FCAT.
           PERFORM DISPLAY1.
         WHEN 'BACK'.
           LEAVE TO SCREEN 0.
         WHEN OTHERS.
           LEAVE TO SCREEN 0.
       ENDCASE.
    ENDFORM.
    *&      Form  FIL_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FIL_FCAT .
    CLEAR IT_FCAT.
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
    **  WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FIL_FCAT
    *&      Form  DISPLAY1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY1 .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY1
    Here i written code under the SAVE button , if requires you create your own status and apply.
    Regards,
    Krishna

  • How to put graphics into a JViewport?

    Hi,
    I'm trying to make a simple game, where a block can move around in a 30x30 grid with collision detection. So far, it works alright, but I want the window to hold only 10x10 and for the block that is moving to stay at the center while the painted background moves around. The program reads a .dat file to get the world.
    So is there a way to use the background world Ive painted and put it into a viewport so that it will scroll when the keys are hit to move? Also I'd like to make the block stay at the center of the screen, unless it's at a corner.
    Hopefully this makes sense and someone can help. Thanks.
    Here's my code:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.io.*;
    public class SmallWorld extends JPanel
                              implements KeyListener,
                                         ActionListener {
         //WORLD
         String[][] worldArray = new String[30][30];
         private static Color redBlock = new Color(255,0,0,255);
         private static Color whiteBlock = new Color(255,255,255,150);
         private static Color blackBlock = new Color(0,0,0,150);
         boolean keyUP = false;
         boolean keyDOWN = false;
         boolean keyLEFT = false;
         boolean keyRIGHT = false;
         //Starting coordinates
         int blockPositionX = 1;
         int blockPositionY = 1;
         JTextField typingArea;
         JViewport viewable;
        public SmallWorld() {
            super( );
              createWorld();     
            typingArea = new JTextField(20);
            typingArea.addKeyListener(this);
              typingArea.setEditable( false );
              add(typingArea);
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              String type = "";
              for (int i = 0; i < 30; i++) {
                   for (int j = 0; j < 30; j++) {
                        type = worldArray[i][j];
                             if ( type.equals("1") )
                                  g.setColor(redBlock);
                                  g.fillRect( (j * 50),(i * 50),50,50 );
                             else {
                                  g.setColor(whiteBlock);
                                  g.fillRect( (j * 50),(i * 50),50,50 );          
              g.setColor(blackBlock);
              g.fillRect( (blockPositionX * 50),(blockPositionY * 50),50,50 );     
         //Get the world from the DAT file and translate it into a 2d array to be used by paintComponent
         public void createWorld() {
            String getData = null;
              int countRow = 0;
            try {
                   FileReader fr = new FileReader("world.dat");
                   BufferedReader br = new BufferedReader(fr);
                   getData = new String();
                   while ((getData = br.readLine()) != null) {
                  if(countRow < 30) {
                        for (int i = 0; i < 30; i++) {
                             String temp = "" + getData.charAt(i);
                             worldArray[countRow] = temp;
                        countRow++;
    } catch (IOException e) {
    // catch possible io errors from readLine()
    System.out.println("Uh oh, got an IOException error!");
    e.printStackTrace();
         //Move Block around the world
         public void moveBlock() {
              Graphics g = this.getGraphics();
              Point pt = new Point();
              pt.x = blockPositionX * 50;
              pt.y = blockPositionY * 50;
              if (keyUP) {
                   g.setColor(blackBlock);
              g.fillRect( (blockPositionX * 50),(blockPositionY * 50),50,50 );
              if (keyDOWN) {
                   g.setColor(blackBlock);
              g.fillRect( (blockPositionX * 50),(blockPositionY * 50),50,50 );
              if (keyLEFT) {
                   g.setColor(blackBlock);
              g.fillRect( (blockPositionX * 50),(blockPositionY * 50),50,50 );
              if (keyRIGHT) {
                   g.setColor(blackBlock);
              g.fillRect( (blockPositionX * 50),(blockPositionY * 50),50,50 );
         //check for collisions with blocks
         public boolean checkCollision(int row, int col) {
              if ( worldArray[col][row].equals("1") ) {
                   return true;
              else {
                   return false;
    //If key typed, put action here. none for now
    public void keyTyped(KeyEvent e) {
    /** Handle the key pressed event from the text field. */
    public void keyPressed(KeyEvent e) {
    updateView( e );
    //If key released, put action here. none for now
    public void keyReleased(KeyEvent e) {
    /** Handle the button click. */
    public void actionPerformed(ActionEvent e) {
         //Update the view of the window based on which button is pressed
         protected void updateView( KeyEvent e ) {
              //if UP is pressed
              if ( e.getKeyCode() == 38 ) {
                   keyUP = true;
                   if ( checkCollision( blockPositionX, blockPositionY - 1 ) == false ) {
                        blockPositionY = blockPositionY - 1;
                        this.repaint();
                        moveBlock();
                   keyUP = false;
              //if DOWN is pressed
              if ( e.getKeyCode() == 40 ) {
                   keyDOWN = true;
                   if ( checkCollision( blockPositionX, blockPositionY + 1 ) == false ) {
                        blockPositionY = blockPositionY + 1;
                        this.repaint();
                        moveBlock();
                   keyDOWN = false;
              //if LEFT is pressed
              if ( e.getKeyCode() == 37 ) {
                   keyLEFT = true;
                   if ( checkCollision( blockPositionX - 1, blockPositionY ) == false ) {
                        blockPositionX = blockPositionX - 1;
                        this.repaint();
                        moveBlock();
                   keyLEFT = false;
              //if RIGHT is pressed
              if ( e.getKeyCode() == 39 ) {
                   keyRIGHT = true;
                   if ( checkCollision( blockPositionX + 1, blockPositionY ) == false ) {
                        blockPositionX = blockPositionX + 1;
                        this.repaint();
                        moveBlock();
                   keyRIGHT = false;
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("SmallWorld");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    JComponent newContentPane = new SmallWorld();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.pack();
         frame.setSize(500,520);
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    The world DAT file:
    111111111111111111111111111111
    100010001010001000101000100011
    100010001010001000101000100011
    100011101010000000001000000001
    100010000010000000001000000001
    100110000010000000001000000001
    100000000010000000001000000001
    111100011110000000001000000001
    100000000110001110111000111011
    100000000000001110111000111011
    100000000000000000001000000001
    100010001110000000000000000001
    100010001110001110111000111011
    100011101100000000000000000011
    100010000110001110111000111011
    100110000100000000000000000011
    100000000110000000001000000001
    111100011100000000000000000011
    100000000100000000000000000011
    100000000010000000000000000001
    100000000010000000000000000001
    100010000000000000000000000001
    100010000000001110111000111011
    100011101110000000011000000001
    100010000110000000011000000001
    100110000110000000001000000001
    100000000110001110111000111011
    111100011110000000011000000001
    100000000110000000011000000001
    100000000011111111111111111111

    I know this is an old posting, but I just saw another question similiar to this and I still have my old code lying around that incorporates most of the suggestions made in this posting. So I thought I'd post my code here in case anybody wants to copy/paste the code. You will still need to use the DAT file provide above as well as provide icons to represent the floor and wall.
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class SmallWorld extends JPanel implements KeyListener, ActionListener
         //WORLD
         String[][] worldArray = new String[30][30];
         //Block colors
         private static Color redBlock = new Color(255,0,0,255);
         private static Color whiteBlock = new Color(255,255,255,255);
         private static Color blackBlock = new Color(0,0,0,150);
         //World images
    //     JLabel wall = new JLabel( new ImageIcon("wall.gif") );
    //     JLabel floor = new JLabel( new ImageIcon("floor.gif") );
         ImageIcon wallIcon = new ImageIcon("dukewavered.gif");
         ImageIcon floorIcon = new ImageIcon("copy16.gif");
         //Starting coordinates
         int blockPositionX = 1;
         int blockPositionY = 1;
         //Typing area to capture keyEvent
         JTextField typingArea;
         //Viewable area
         JViewport viewable;
         String type = "";
         JLayeredPane layeredPane;
         JPanel worldBack;
         JPanel panel;
         JPanel player;
         Dimension worldSize = new Dimension(1500, 1500);
         public SmallWorld() {
              super( );
              createWorld();
              layeredPane = new JLayeredPane();
              add(layeredPane);
              layeredPane.setPreferredSize( worldSize );
              worldBack = new JPanel();
              layeredPane.add(worldBack, JLayeredPane.DEFAULT_LAYER);
              worldBack.setLayout( new GridLayout(30, 30) );
              worldBack.setPreferredSize( worldSize );
              worldBack.setBounds(0, 0, worldSize.width, worldSize.height);
              worldBack.setBackground( whiteBlock );
              for (int i = 0; i < 30; i++) {
                   for (int j = 0; j < 30; j++) {
                        JPanel square = new JPanel( new BorderLayout() );
                        worldBack.add( square );
                        type = worldArray[i][j];
                        if ( type.equals("1") )
                             square.add( new JLabel(wallIcon) );
                        else
                             square.add( new JLabel(floorIcon) );
              //Draw the player
              player = new JPanel();
              player.setBounds(50, 50, 50, 50);
              player.setBackground( Color.black );
              player.setLocation(50, 50);
              layeredPane.add(player, JLayeredPane.DRAG_LAYER);
              //set where the player starts
    //          panel = (JPanel)worldBack.getComponent( 31 );
    //          panel.add( player );
              //Create the typing area with keyListener, add to window
              typingArea = new JTextField(20);
              typingArea.addKeyListener(this);
              typingArea.setEditable( false );
              add(typingArea);
         //Get the world from the DAT file and translate it into
         //a 2d array to be used by paintComponent
         public void createWorld() {
              String getData = null;
              int countRow = 0;
              try {
                   //Get file
                   FileReader fr = new FileReader("world.dat");
                   BufferedReader br = new BufferedReader(fr);
                   getData = new String();
                   //read each line from file, store to 2d array
                   while ((getData = br.readLine()) != null) {
                        if(countRow < 30) {
                             for (int i = 0; i < 30; i++) {
                                  String temp = "" + getData.charAt(i);
                                  worldArray[countRow] = temp;
                        countRow++;
              } catch (IOException e) {
              System.out.println("Uh oh, got an IOException error!");
              e.printStackTrace();
         //Move Block around the world
         public void moveBlock() {
              Point pt = new Point();
              pt.x = blockPositionX * 50;
              pt.y = blockPositionY * 50;
              int x = Math.max(0, pt.x - 250);
              int y = Math.max(0, pt.y - 250);
              Rectangle r = new Rectangle(x, y, 550, 550);
              scrollRectToVisible( r );
         //check for collisions with blocks
         public boolean checkCollision(int row, int col) {
              if ( worldArray[col][row].equals("1") ) {
                   return true;
              else {
                   return false;
         public void keyTyped(KeyEvent e) {
         public void keyPressed(KeyEvent e) {
              updateView( e );
              e.consume();
         public void keyReleased(KeyEvent e) {
         public void actionPerformed(ActionEvent e) {
         //Update the view of the window based on which button is pressed
         protected void updateView( KeyEvent e ) {
              //if UP
              if ( e.getKeyCode() == 38 ) {
                   if ( checkCollision( blockPositionX, blockPositionY - 1 ) == false ) {
                        blockPositionY = blockPositionY - 1;
                        moveBlock();
                        player.setLocation(blockPositionX *50, blockPositionY*50);
              //if DOWN
              if ( e.getKeyCode() == 40 ) {
                   if ( checkCollision( blockPositionX, blockPositionY + 1 ) == false ) {
                        blockPositionY = blockPositionY + 1;
                        moveBlock();
                        player.setLocation(blockPositionX *50, blockPositionY*50);
              //if LEFT
              if ( e.getKeyCode() == 37 ) {
                   if ( checkCollision( blockPositionX - 1, blockPositionY ) == false ) {
                        blockPositionX = blockPositionX - 1;
                        moveBlock();
                        player.setLocation(blockPositionX *50, blockPositionY*50);
              //if RIGHT
              if ( e.getKeyCode() == 39 ) {
                   if ( checkCollision( blockPositionX + 1, blockPositionY ) == false ) {
                        blockPositionX = blockPositionX + 1;
                        moveBlock();
                        player.setLocation(blockPositionX *50, blockPositionY*50);
         private static void createAndShowGUI() {
              JFrame frame = new JFrame("SmallWorld");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JComponent newContentPane = new SmallWorld();
              newContentPane.setPreferredSize( new Dimension(1500, 1500) );
              JScrollPane scrollPane = new JScrollPane( newContentPane );
              scrollPane.setPreferredSize( new Dimension(568, 568) );
              frame.getContentPane().add( scrollPane );
              frame.pack();
              frame.setLocationRelativeTo( null );
              frame.setResizable( false );
              //frame.setSize(500,520);
              frame.setVisible( true );
         public static void main(String[] args) {
              javax.swing.SwingUtilities.invokeLater( new Runnable() {
                   public void run() {
                        createAndShowGUI();

  • How to Import file into sap directory.

    Hi all,
    I need to import a .XML file into SAP-BW directory from my local pc.
    By tcod AL11 I can only display all the directories, but I cannot import/upload this file.
    How I Can create my own directory e.g /usr/sap/tmp123
    Help me please.
    thanks.
    Kaustubh.

    Hi Kaustubh,
    Use the FM ARCHIVFILE_CLIENT_TO_SERVER.
    Give Filename + path for both the source and destination and your file will get transferred to the specified directory in AL11.
    But I am not sure about creating your own directory in AL11.
    Reward if helpful.
    Regards
    Hemant Khemani

  • How to put data into textbox using JSP

    How can I put data into a textbox using JSP?
    This code prints to a html page but I want it inside an text area:
    // Print out the type and file name of each row.
            while(ftplrs.next())
                int type = ftplrs.getType();
                if(type == FtpListResult.DIRECTORY)
                    out.print("DIR\t");
                else if(type == FtpListResult.FILE)
                    out.print("FILE\t");
                else if(type == FtpListResult.LINK)
                    out.print("LINK\t");
                else if(type == FtpListResult.OTHERS)
                    out.print("OTHER\t");
                out.print(ftplrs.getName() +"<br>");
            }I have tried with the code below:
    <textarea name="showDirectoryContent" rows="10" cols="70">
    <%
           // Print out the type and file name of each row.
            while(ftplrs.next())
                int type = ftplrs.getType();
                if(type == FtpListResult.DIRECTORY)
    %>
                    <%= "DIR\t" %>
    <%            else if(type == FtpListResult.FILE) %>
                    <%= "FILE\t" %>
    <%            else if(type == FtpListResult.LINK)  %>
                    <%= "LINK\t" %>
    <%            else if(type == FtpListResult.OTHERS) %>
                    <%= "OTHER\t" %>
    <%            String temp = ftplrs.getName() +"<br>");
                  <%= temp > <br>
    %>
    </textarea>I get the following error:
    Location: /myJSPs/jsp/grid-portal-project/processviewfiles_dir.jsp
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:151: 'else' without 'if'.
    else if(type == FtpListResult.FILE)
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:165: 'else' without 'if'.
    else if(type == FtpListResult.LINK)
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:179: 'else' without 'if'.
    else if(type == FtpListResult.OTHERS)
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:193: ';' expected.
    String temp = ftplrs.getName() +"");
    ^
    4 errors, 1 warning
         at org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:898)
         at org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:733)
         at org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:506)
         at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
         at java.lang.Thread.run(Thread.java:536)
    Please help???

    Yes indeed this works:
    <textarea name="showDirectoryContent" rows="10" cols="70">
    <%
           // Print out the type and file name of each row.
            while(ftplrs.next())
                int type = ftplrs.getType();
                if(type == FtpListResult.DIRECTORY)
    {%>
                    <%= "DIR\t" %>
    <%}            else if(type == FtpListResult.FILE)  {%>
                    <%= "FILE\t" %>
    <%}            else if(type == FtpListResult.LINK)  {%>
                    <%= "LINK\t" %>
    <%}            else if(type == FtpListResult.OTHERS) %>
                    <%= "OTHER\t" %>            
                  <%= ftplrs.getName() %>
    <%
    %>

  • How to put checkboxes in a Tree list

    Hi All,
    I have generated a tree structure in my list from a table. The requirement is I have to put checkboxes for the leaves(bottom most level) of the tree. Now the user will be selecting required leaves and thus my logic will continue.
    Can anyone tell me how can i put checkboxes for all the leaves?
    Also, The number of leaves is in thousands. To keep that many check boxes, I have to create that many number of variables, which can be done dynamically.
    So, how to put check boxes and how to create those variables dynamically? How can i meet my requirement?
    Plz guide me in this issue.

    Take a look SAPCOLUMN_TREE_CONTROL_DEMO program screen 100  in SE80 transaction
    ibrahim

  • How to put focus into a particular TextItem ?

    Hi all,
    I have a Form into which there are two TextFields, say name and adress. After adding a record in that screen I go to another screen. And when I return to the first screen then the cursor is at the last item.
    So how to put the cursor at the first item ?
    Thank you very much

    Hi,
    You can try the following code -
    IRecord structure = (IRecord)structureFactory.getStructure(function.getParameter("MYTABSTR").getStructure());
    structure.setString("FIELD1", value1);
    structure.setString("FIELD2", value2);
    importParams.put("MYTABSTR",structure);
    Regards,
    Sudip

  • How to put songs into the 5300 player from compute...

    When i sync or just drop it into the phone it only shows up to the memory card and it won't be on the player on the 5300. How can I put it into the 5300 player? Thanks in advance.

    Drop music files to phone connected as USB-drive;
    On the phone: Menu> Media > Music Player and then in player left soft key> Music Library > Update Library;
    Instead of it all you may simply restart the phone
    Nokia 5300 dark gray / V5.51

Maybe you are looking for

  • Issues with different versions of Oracle.DataAccess.dll

    I have a .net web service application which references version 10.2.0.100 of Oracle.DataAccess.dll. A client has setup Oracle 10g database on the server, but I think the server has a patch set installed so it appears that the versions of Oracle.DataA

  • Acquiring two input signals simultaneously

    Hi, I have an LVDT and a force sensor (both attached to a motor) plugged into my SC board and I am trying to read out & save the output data from both sensors simultaneously while the motor is in motion. The SC-2350 board is connected to the laptop v

  • HT203172 How to reinstall iTunes ?

    To stop: Permissions differ on "Applications/iTunes.app/Contents/Frameworks/iPodUpdater.framework/iPodUpdater" ; should be lrwxr-xr-x ; they are -rwxr-xr-x . Eevrytime I run Permissions in Disk Utility.

  • How to refresh datasource

    since the rows are changed continually,i want add a link to refresh the jsp page,so i do 1.add the following lines in datahandlecompnent.sjp <jbo:OnEvent name="refresh"> <jbo:RefreshDataSource datasource="ds" /> </jbo:OnEvent> <jbo:OnEvent name="crea

  • REDISTRIBUTION WORKLOAD REPORT

    Hi  All have you ever extracted this REPORTING WORKLOAD in the redistribution menu. What exactly this report gives to the business usuage? assume that i have connected with BW ? Why BW report shows in SRM box? How to activate this report:- Workload r