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();

Similar Messages

  • 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 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.

  • 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.

  • 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

  • How to put userinfo into session?

    Hi everyone:
    I have a login page.I want to put all the user information into user's session if the user logon successfully.How can I do it?
    I means that if the user input the "name" and "password" is correct then put the user's address,age,registetime,city,lastname ..etc into user's session.
    Thks.

    Hi,
    just create class(bean) User with any of these name, age... setter and getter methods and put it into session. So, during the session you will have one user in your hand.
    Then you'll be able to use user.getAge() user.setAge and all that stuff and what is the most important - you will have ONE session variable.
    Using beans you can make very smart application.
    good luck

  • How to put pictures into folders

    How do I put pics into folders?

    These links may be helpful.
    How To Create Photo Albums http://tinyurl.com/cxm4eoq
    How to Add New Albums in the Photos App on the iPad & Add Photos to the Album
    http://tinyurl.com/7qep7fs
     Cheers, Tom

  • 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 2 PUT VIDEOS INTO FIFTH GENERATION IPOD?!

    ookay..i'm trying 2 put vids wif formats like .avi , .mpeg , .mpg ... but how 2 convert it into ipod format?? ppl have tried telling mi 2 put it into Itunes n convert it frm there..but d video dat i want 2 convert doesn't appear on iTunes wen i ask it 2 play wif iTunes...i think i may need a converter of some sort...does any1 noe how 2 get a good 1 without viruses? plz help!! thxx

    Quicktime or Quicktime Pro (which da iTunes uses wif everyfin) dun't convrt "muxed" ( muxed means multiplexed were da audio and da video r stored on da same track) vidio files proper. It onli plays da video and nut da audio.
    See:iPod plays da video but not da audio.
    U need a 3rd party converter to convert da file with both da audio and da video u noe?.
    C dis 4 sum help: Guide to converting video for da iPod (Mac/Windows).

  • How to put music into iphone 5 with another Itunes 11??

    I have a computer back at home which i originally used with my Iphone 5. Im at college right now and i just bought a laptop, downloaded Itunes 11, and have some music i want to put on to my Iphone but i cant. I just realized that you cannot put music into your Iphone without the original computer you synced it with. Even though i have authorized this laptop; this laptop being the second authorized, cant seem to put music into my Iphone. I then tried to check off the Manually manage music and videos box and it prompted me by saying i have to delete everything in my Iphone and get it synced with the itunes on my laptop in order to put in music and videos. I dont want to do this. Does anyone know another way around this???? I know with an Ipod you dont go through this kind of crap. Any kind of help would be appreciated! My IOS for my iphone5 is 6.1.4. I dont know if this effects anything.

    There's the easy way and the hard way. The easy way is to copy the backup that you should have kept of your old computer to the new computer's iTunes (see: http://support.apple.com/kb/HT4527). Then just sync the iPhone. The hard way is to extract the data from your phone. The phone was never intended as a backup device, so you will not get everything back perfectly, but it's as close as you can get. See: Syncing to a "New" Computer or replacing a "crashed" Hard Drive

  • How to save graphics into file?

    I've written application "Drawing Pad" - simple draw line, scribble, etc. I need to save into file graphics from the pad. How to do it, please help!!!
    I've tried the following:
    File outputFile=new File("mylife.txt"); // declare a file output object
    FileOutputStream out = new FileOutputStream(outputFile);
         try
              DrawPad fileData = pad;
              out.write(fileData);
              out.close();
         catch (Exception e)
              System.err.println ("Error writing to file");
         }It doesn't work. Do I need to convert data into string? Or what else to do?

    ...what exactly are you trying to do? If you want to save the image your pad shows, it's pretty easy:
    1. Create a BufferedImage with the same size as your pas
    2. Call pad.paint(image.getGraphics()); to put the pad's content into the image
    3. Use ImageIO.write(...) to store your image in a jpg/png file.
    If, on the other hand, you are trying to store your pad object in a byte stream (which is generally not a good idea for long time persistence), you will have to use ObjectOutputStream as mentioned above and have your DrawPad class implement java.io.Serializable. Check out the tutorials on this issue, but i really doubt this is what you are trying to do.

  • How to put data into a array element in the BPEL

    Hi,
    I have a element in the WSDL which is of type Array. (i.e accepts unlimited data for the same element). How should i put a data into a array in the BPEL.
    Example:
    The below Example gives u an idea about wht iam asking:pasting a piece of my requirement:
    <s:element minOccurs="0" maxOccurs="1" name="parameters" type="tns:ArrayOfCSParameters" />
    <s:complexType name="ArrayOfCSParameters">
    <s:sequence>
    <s:element minOccurs="0" maxOccurs="unbounded"
    name="CSParameters" nillable="true" type="tns:CSParameters" />
    </s:sequence>
    </s:complexType>
    <s:complexType name="CSParameters">
    <s:sequence>
    <s:element minOccurs="0" maxOccurs="1" name="RevenueItem" type="tns:RevenueItem" />
    <s:element minOccurs="0" maxOccurs="1" name="AccountURIs" type="tns:ArrayOfString" />
    <s:element minOccurs="0" maxOccurs="1" name="GroupURIs" type="tns:ArrayOfString" />
    <s:element minOccurs="1" maxOccurs="1" name="Percentage" nillable="true" type="s:decimal" />
    </s:sequence>
    <s:attribute name="Version" type="s:decimal" use="required" />
    <s:attribute name="URI" type="s:string" />
    </s:complexType>
    Any suggestion is appreciated.
    Regards
    pavan

    You have 2 options i guess.
    Use the transformation and the for-each to construct the array-list
    or like Richard said, use a loop in bpel, assign in the loop an variable of element type="CSParameters" and append this variable to your variable with accepts the arraylist.

  • XI Alert - How to put messageid into Subseq. Activities Link

    Hi,
    I have control step to throw alert whenever error occur in the BPM.
    How can i put the messageid into the Subseq. Activities link so the user can only click the link and open the message in the message monitoring.
    I gave the URL below in the subseq.activity tab.
    http://hostname:50900/rwb_mdt/index.jsp?rwb=true&objectName=name=is.09.hostname,type=XIServerEngine&messageid=&SXMS_MSG_GUID&
    But the value of the message id is not reflecting in the url.
    Regards
    Divia

    Hi Sreedivia Narath,
    how are you reading the Message ID in the BPM process.
    Please Refer this Link:
    http://help.sap.com/saphelp_nw04/helpdata/en/d0/d4b54020c6792ae10000000a155106/frameset.htm
    You cannot use these container variables for alerts of the Business Process Engine (BPE).

  • How to put ActionScript into Catalyst project via Flash Builder?

    I don't know if this is the wrong place to put this, but I need to add some ActionScript into my Catalyst project... from what I understand, it can only be done via Flash Builder. Am I right? How?

    Hi Alex,
    To edit the code of a Flash Catalyst project, you can import it into Flash Builder as follows:
    File > Import > Flash Builder Project
    Select the FXP file from Catalyst
    Make sure "Import new copy of project" is selected, then hit Finish
    I'm not sure where you got the ActionScript code that you're planning to use, but it may be difficult to integrate into your project if it's not designed for use with Flex (a lot of AS code snippets you'll find online are just for general use in Flash, not tailored for Flex applications).  But you'll probably want to do something like this:
    Locate the image you want to make random.  If you're having trouble doing this, switch the view to Design mode, select the image with the mouse, and then switch back to Code mode to see the corresponding code highlighted.
    If there's no id attribute set on the image, add one (so you can refer to it in code later).
    If the tag is s:BitmapImage, change it to mx:Image (this is needed to make the contents dynamic)
    If the root s:Application tag doesn't have a creationComplete handler, add one (type it partway, then hit Ctrl+Space, then choose "Generate Handler").
    In the handler, add your code to randomly select an image filename.
    Then set <your image's id>.source = <filename>
    Hope that helps!
    - Peter

Maybe you are looking for