Help please with my action method

Hello everybody,
Actually I'm working in a CRM 4.0 development project and I'm totally new in ABAP Programming.
My question is the following:
I have to develop an action method which delete several partner functions from partner tab in a sales order (for all included items and always the same partner functions, ZO1, ZO2 and ZO3 for example).
Which is the best way to do it? Maybe using CRM_ORDER_MAINTAIN function?
Could anybody help me posting some example code or any guideline?
Thanks in advance.

hi, I think you need a way to delete partner of SD.
I do the similar functionality for PO, so I think the situation is same.
I think some FM can be helpful to you.
try this:
SD_SALESDOCUMENT_CHANGE
it has a TABLE parameter PARTNERCHANGES and PARTNERS.
Hope it will be helpful
thanks

Similar Messages

  • Little help please with forwarding traffic to proxy server!

    hi all, little help please with this error message
    i got this when i ran my code and requested only the home page of the google at my client side !!
    GET / HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
    Accept-Language: en-us
    UA-CPU: x86
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.2; .NET CLR 2.0.50727)
    Host: www.google.com
    Connection: Keep-Alive
    Cookie: PREF=ID=a21457942a93fc67:TB=2:TM=1212883502:LM=1213187620:GM=1:S=H1BYeDQt9622ONKF
    HTTP/1.0 200 OK
    Cache-Control: private, max-age=0
    Date: Fri, 20 Jun 2008 22:43:15 GMT
    Expires: -1
    Content-Type: text/html; charset=UTF-8
    Content-Encoding: gzip
    Server: gws
    Content-Length: 2649
    X-Cache: MISS from linux-e6p8
    X-Cache-Lookup: MISS from linux-e6p8:3128
    Via: 1.0
    Connection: keep-alive
    GET /8SE/11?MI=32d919696b43409cb90ec369fe7aab75&LV=3.1.0.146&AG=T14050&IS=0000&TE=1&TV=tmen-us%7Cts20080620224324%7Crf0%7Csq38%7Cwi133526%7Ceuhttp%3A%2F%2Fwww.google.com%2F HTTP/1.1
    User-Agent: MSN_SL/3.1 Microsoft-Windows/5.1
    Host: g.ceipmsn.com
    HTTP/1.0 403 Forbidden
    Server: squid/2.6.STABLE5
    Date: Sat, 21 Jun 2008 01:46:26 GMT
    Content-Type: text/html
    Content-Length: 1066
    Expires: Sat, 21 Jun 2008 01:46:26 GMT
    X-Squid-Error: ERR_ACCESS_DENIED 0
    X-Cache: MISS from linux-e6p8
    X-Cache-Lookup: NONE from linux-e6p8:3128
    Via: 1.0
    Connection: close
    java.net.SocketException: Broken pipe // this is the error message
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:115)
    at java.io.DataOutputStream.writeBytes(DataOutputStream.java:259)
    at SimpleHttpHandler.run(Test77.java:61)
    at java.lang.Thread.run(Thread.java:595)
    at Test77.main(Test77.java:13)

    please could just tell me what is wrong with my code ! this is the last idea in my G.p and am havin difficulties with that cuz this is the first time dealin with java :( the purpose of my code to forward the http traffic from client to Squid server ( proxy server ) then forward the response from squid server to the clients !
    thanx a lot,
    this is my code :
    import java.io.*;
    import java.net.*;
    public class Test7 {
    public static void main(String[] args) {
    try {
    ServerSocket serverSocket = new ServerSocket(1416);
    while(true){
    System.out.println("Waiting for request");
    Socket socket = serverSocket.accept();
    new Thread(new SimpleHttpHandler(socket)).run();
    socket.close();
    catch (Exception e) {
    e.printStackTrace();
    class SimpleHttpHandler implements Runnable{
    private final static String CLRF = "\r\n";
    private Socket client;
    private DataOutputStream writer;
    private DataOutputStream writer2;
    private BufferedReader reader;
    private BufferedReader reader2;
    public SimpleHttpHandler(Socket client){
    this.client = client;
    public void run(){
    try{
    this.reader = new BufferedReader(
    new InputStreamReader(
    this.client.getInputStream()
    InetAddress ipp=InetAddress.getByName("192.168.6.29"); \\ my squid server
    System.out.println(ipp);
    StringBuffer buffer = new StringBuffer();
    Socket ss=new Socket(ipp,3128);
    this.writer= new DataOutputStream(ss.getOutputStream());
    writer.writeBytes(this.read());
    this.reader2 = new BufferedReader(
    new InputStreamReader(
    ss.getInputStream()
    this.writer2= new DataOutputStream(this.client.getOutputStream());
    writer2.writeBytes(this.read2());
    this.writer2.close();
    this.writer.close();
    this.reader.close();
    this.reader2.close();
    this.client.close();
    catch(Exception e){
    e.printStackTrace();
    private String read() throws IOException{
    String in = "";
    StringBuffer buffer = new StringBuffer();
    while(!(in = this.reader.readLine()).trim().equals("")){
    buffer.append(in + "\n");
    buffer.append(in + "\n");
    System.out.println(buffer.toString());
    return buffer.toString();
    private String read2() throws IOException{
    String in = "";
    StringBuffer buffer = new StringBuffer();
    while(!(in = this.reader2.readLine()).trim().equals("")){
    buffer.append(in + "\n");
    System.out.println(buffer.toString());
    return buffer.toString();
    Edited by: Tareq85 on Jun 20, 2008 5:22 PM

  • Help please with FaceTime. The built in app seems to have disappeared from my iPad2. Bought it in Australia

    Help please with FaceTime. My built in app seems to have disappeared.

    If K Penguin's suggestion doesnt work, you will have to go to you iTunes and do a reset, that is if you do not have it in your back up library.

  • Can anyone help please with my Time Machine, I have been getting the following message The backup disk image "/Volumes/Mac Backup/Stephen Smith's iMac.sparsebundle" is already in use.

    Can anyone help please with my Time Machine, I have been getting the following message The backup disk image “/Volumes/Mac Backup/Stephen Smith’s iMac.sparsebundle” is already in use.

    See > http://pondini.org/TM/C12.html

  • Help please with 2006 Macbook 13inch, for tv hook up.

    Help please with 2006 Macbook 13inch, to hook up to tv for streaming. The display works through VGA but the audio isn't working. Got a plug that goes into headphone jack on computer and connects into the audio jack on the back of tv but no sound. I'm not quite sure what the issue is, whether its the wrong plug, the tv, or the computer. Best Buy says this is the right plug and it seems that it would be, but who knows. If anyone has any experience in this, I would appreciate the help!

    Make sure those audio plugs are matched with the VGA plug. With your MacBook running something with audio switch between your sources on the TV Component, Composite and such. See if the sound is coming from another source. If so then you've got your audio plugs in the wrong jacks.
    Also could you post the make and model number of your TV.

  • Help Please with Driver

    I need to install the ADB Interface for the X2 onto my computer. Does any one know how or where I can get this driver?

    <Duplicate post.  Please see Help Please with Driver  for any replies.  This post will be closed.>

  • Can you help me with mouse pressed method please?

    hi
    can you help me with my problem please, player label doesn't show up in the applet and the draw string method it doesn't draw any strings like X or O for the game I don't know what is the problem maybe it is with MousePressed method which is in Board class. I tried to write the code of the location many times I'm not sure if the problem comes from there.
    there is no error in my code, but it doesn't work.
    this is class Board which has the mouseListener
    class Board extends JPanel  implements MouseListener, MouseMotionListener
        private JLabel playerlabel; 
         private boolean play;
         private boolean start;
        private int turn; 
        private Square squares[][];
      private Player myplayer[][];
         public Board()
              setBackground( Color.WHITE );
              playerlabel = new JLabel( "X player first" );
              //playerlabel.setLayout(null);
         //     playerlabel.setLocation(500,500);
              add( playerlabel );
              play = true;
              turn = 1;
             squares = new Square[3][3];
             myplayer = new Player[3][3];
             int x = 40;
              int y = 40;
              for (int i=0; i<3; i++){
                   x = 40;
                   for (int j=0; j<3; j++){
                        Square s = new Square( x,y );
                        squares[i][j] = s;
                        x +=50;
                   y +=50;
                this.addMouseListener(this);
            this.addMouseMotionListener(this);
          public void mouseClicked( MouseEvent event ){}
          public void mouseMoved( MouseEvent event ){}
          public void mouseEntered( MouseEvent event ){}
          public void mouseExited( MouseEvent event ){}
          public void mousePressed( MouseEvent event )
          {int xPos = event.getX();
                  int yPos = event.getY();
                    if(play && turn ==1){
                    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "X";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(1);
                                       playerlabel.setText( "O Player Turn" );
                                       turn = 2;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 2;
                                       playerlabel.setText( "O Player Turn" );
                                       repaint();
              if ( play && turn ==2 )
    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "O";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(2);
                                       playerlabel.setText( "X Player Turn" );
                                       turn = 1;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 1;
                                       playerlabel.setText( "X Player Turn" );
                                       repaint();
          public void mouseReleased( MouseEvent event )
          public void mouseDragged( MouseEvent event )
         public void Win(){
              if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
                   if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Vertically win
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Diagonal win
                    if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
         }//end win
    public void setTurn(int t)
              turn = t;
              playerlabel.setText( "X Player Plays First" );
         public void paintComponent( Graphics g )
               super.paintComponent( g );
               this.setBackground( Color.WHITE );
              for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                        g.setColor( Color.BLACK );
                         g.drawRect( squares[i][j].getX(), squares[i][j].getY(), 50, 50 );     
               for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                         myplayer[i][j].draw(g);     
            //End of paintComponent   
    }and this is the whole code of my program.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    class Player{
         private int xCoordinate;
         private int yCoordinate;
        private String playerText;
      public   Player(int x, int y, String t)
            playerText = t;
            xCoordinate = x;
            yCoordinate = y;
        public void draw(Graphics g)
               g.drawString(playerText,  xCoordinate, yCoordinate);
         public void SetText(String t)
         { playerText = t;
    }//end player
    class Square
         private int x;
         private int y;
         private int occupied;
         public Square(int x1, int y1)
              x = x1;
              y= y1;
              occupied = 0;
         public void setX(int x1)
              x = x1;
         public int getX()
              return x;
         public void setY(int y1)
              y = y1;
         public int getY()
              return y;
         public void setOccupied(int o)
              occupied = o;
         public int getOccupied()
              return occupied;
    public class TicTac extends JApplet implements ActionListener
    { private JPanel panel;
         private JButton newgame;
         private Board B;
         public void init()
              B = new Board();
              add( B, BorderLayout.CENTER );
              panel = new JPanel();
               newgame = new JButton( "New Game" );
               panel.add( newgame);
               add( panel, BorderLayout.SOUTH );
               newgame.addActionListener(this);
              public void actionPerformed( ActionEvent ev)
               {     Object source = ev.getSource();
         if (source == newgame)
                    {remove(B);
                   repaint();
              B = new Board();
                   add( B, BorderLayout.CENTER );
         B.setTurn(1);
                   repaint();
                   validate();
            }//end class TicTac
    class Board extends JPanel  implements MouseListener, MouseMotionListener
        private JLabel playerlabel; 
         private boolean play;
         private boolean start;
        private int turn; 
        private Square squares[][];
      private Player myplayer[][];
         public Board()
              setBackground( Color.WHITE );
              playerlabel = new JLabel( "X player first" );
              //playerlabel.setLayout(null);
         //     playerlabel.setLocation(500,500);
              add( playerlabel );
              play = true;
              turn = 1;
             squares = new Square[3][3];
             myplayer = new Player[3][3];
             int x = 40;
              int y = 40;
              for (int i=0; i<3; i++){
                   x = 40;
                   for (int j=0; j<3; j++){
                        Square s = new Square( x,y );
                        squares[i][j] = s;
                        x +=50;
                   y +=50;
                this.addMouseListener(this);
            this.addMouseMotionListener(this);
          public void mouseClicked( MouseEvent event ){}
          public void mouseMoved( MouseEvent event ){}
          public void mouseEntered( MouseEvent event ){}
          public void mouseExited( MouseEvent event ){}
          public void mousePressed( MouseEvent event )
          {int xPos = event.getX();
                  int yPos = event.getY();
                    if(play && turn ==1){
                    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "X";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(1);
                                       playerlabel.setText( "O Player Turn" );
                                       turn = 2;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 2;
                                       playerlabel.setText( "O Player Turn" );
                                       repaint();
              if ( play && turn ==2 )
    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "O";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(2);
                                       playerlabel.setText( "X Player Turn" );
                                       turn = 1;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 1;
                                       playerlabel.setText( "X Player Turn" );
                                       repaint();
          public void mouseReleased( MouseEvent event )
          public void mouseDragged( MouseEvent event )
         public void Win(){
              if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
                   if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Vertically win
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Diagonal win
                    if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
         }//end win
    public void setTurn(int t)
              turn = t;
              playerlabel.setText( "X Player Plays First" );
         public void paintComponent( Graphics g )
               super.paintComponent( g );
               this.setBackground( Color.WHITE );
              for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                        g.setColor( Color.BLACK );
                         g.drawRect( squares[i][j].getX(), squares[i][j].getY(), 50, 50 );     
               for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                         myplayer[i][j].draw(g);     
            //End of paintComponent   
            Edited by: mshadows on May 18, 2008 7:53 AM

    I was playing with this a little bit and came up with this game model, something that I'm sure can be improved upon greatly:
    TttXO.java
    an enum to encapsulate X vs O. I could use a boolean here since it has 2 states, but this seems more intuitive to me
    package dy08.m05.ttt;
    * tic tac toe encapsulation of X vs O
    * @author Pete
    public enum TttXO
        X, O
    }TttCell.java
    encapsulates an individual cell in the tictactoe grid.
    package dy08.m05.ttt;
    * Tic Tac Toe Game cell
    * can be occupied or not
    * can hold TttXO X or O or null 
    * @author Pete
    public class TttCell
        private boolean occupied = false;
        private TttXO xo = null;
        public TttCell()
         * sets a Square for either x or o
         * @param TttXO
         * @return true if successful, false if already occupied
        public boolean setXO(TttXO xo)
            if (occupied)
                return false;
            else
                occupied = true;
                this.xo = xo;
                return true;
        public void reset()
            occupied = false;
            xo = null;
        public boolean isOccupied()
            return occupied;
        public TttXO getXO()
            return xo;
        // used to test and debug the class
        public String toString()
            if (occupied)
                return xo.toString();
            else
                return "-";
    package dy08.m05.ttt;
    * Tic Tac Toe game model
    * @author Pete
    public class TttGameModel
        private TttCell[][] cellGrid = new TttCell[3][3];
        private boolean xTurn = true;
        private boolean win = false;
        public TttGameModel()
            for (int i = 0; i < cellGrid.length; i++)
                for (int j = 0; j < cellGrid.length; j++)
    cellGrid[i][j] = new TttCell();
    public void reset()
    xTurn = true;
    win = false;
    for (int i = 0; i < cellGrid.length; i++)
    for (int j = 0; j < cellGrid[i].length; j++)
    cellGrid[i][j].reset();
    public boolean isXTurn()
    return xTurn;
    public boolean isWin()
    return win;
    * @param row
    * @param col
    * @return true if valid move, false if game already over or cell occupied
    public boolean takeTurn(int col, int row)
    TttXO currentXO = TttXO.O;
    TttCell cell = cellGrid[row][col];
    if (win)
    return false;
    if (cell.isOccupied())
    return false;
    if (xTurn)
    currentXO = TttXO.X;
    cell.setXO(currentXO);
    win = checkWin(col, row, currentXO);
    xTurn = !xTurn; // toggle xturn
    return true;
    public boolean checkWin(int col, int row, TttXO xo)
    boolean win = false;
    // first rows and columns
    boolean temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[row][i].getXO() == xo;
    win |= temp;
    temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[i][col].getXO() == xo;
    win |= temp;
    if (row == col) // if slash diagonal
    temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[i][i].getXO() == xo;
    win |= temp;
    if (row + col == 2) // if backslash diagonal
    temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[i][2 - i].getXO() == xo;
    win |= temp;
    return win;
    // used to test and debug the class
    public String toString()
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < cellGrid.length; i++)
    for (int j = 0; j < cellGrid[i].length; j++)
    sb.append(cellGrid[i][j] + " ");
    sb.append("\n");
    if (win)
    sb.append("win! Game over");
    else
    sb.append("No winner yet");
    return sb.toString();
    // test the class
    public static void main(String[] args)
    TttGameModel model = new TttGameModel();
    checkMove(model, 0, 0);
    checkMove(model, 1, 0);
    checkMove(model, 1, 1);
    checkMove(model, 2, 0);
    checkMove(model, 1, 0); // bad move
    checkMove(model, 2, 2);
    // to test the class
    private static void checkMove(TttGameModel model, int i, int j)
    System.out.println("OK move: " + model.takeTurn(i, j));
    System.out.println(model + "\n");

  • Problem with seting action method to a Hyperlink object

    Hi there,
    as the subject says, I have a problem wih setting the action method of a Hyperlink object. Here is how the program is organized:
    I have an external bean which generates an ArrayList of Hyperlink objects. In the backing bean of my web page I call a method from the above mentioned external bean to generate the list of hyperlink objects. After that in the page bean I insert the hyperlink objects in GridPanel component. So far everything works fine, but the action method of the Hyperlink objects is not called and I can't understant why.
    Here is how I add the objects to the GridPanel component:
    private void populateGridPanel()
            Hyperlink hyper;
            for(int i=0; i< checkboxList.size(); i++)
                    hyper = (Hyperlink) hyperlinkList.get(i);
                    vehicleGridPanel.getChildren().add(hyper);
        }All properties of the Hyperlink objects are set in the external bean not in the page bean, here is how:
    //action method executed when the hyperlink is clicked
    MethodBinding mb = (MethodBinding) FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{Page1.hyperlink_action}", null);
    veHyperlink.setAction(mb);The populateGridPanel() method is called in the init() method of the page bean, after the initialization of all other components.
    An interesting fact is that if I manually drag-n-drop a hyperlink object to my page and programatically set its action method with the code above everything works fine. But using the same code for the dynamically generated hyperlink objects inserted in the grid panel doesn't work.
    Any kind of help is highly appreciated.
    Thanks!
    Message was edited by:
    panayot

    I got this use case to work as follows:
    1. Drag a Grid Panel and set its columns property to 1.
    2. Drag a Message Group.
    3. Use the following code in Page1:
    public void prerender() {
    populateGridPanel();
    private void populateGridPanel() {
    if (gridPanel1.getChildren().size() > 0) {return;}
    for (int i = 0; i < 3; i++) {
    Hyperlink veHyperlink = new Hyperlink();
    //action method executed when the hyperlink is clicked
    MethodBinding mb = (MethodBinding) FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{Page1.hyperlink_action}", null);
    veHyperlink.setAction(mb);
    veHyperlink.setText("dynamic hyperlink " + i);
    veHyperlink.setId("dynamicHyperlink" + i);
    gridPanel1.getChildren().add(veHyperlink);
    public void hyperlink_action() {
    info("Yup it worked at: " + new java.util.Date());
    4. Fix imports, Run, and then click on the hyperlinks.

  • Need Help Please with Flash Professional - No Cursor Change on Buttons/Links in Mac OS

    Hi Folks, I am relatively new to Flash Professional but I recently built a very nice flash website with very little problems.  I noticed after I uploaded my site to my server, that my mouse cursor did not change from an arrow to a finger on any of my buttons.  It did change on the hyperlinks, but not on the buttons.  Everything still worked fine but there was no indication to the user that an object was in fact an interactive button.  I found this code:  button1.buttonMode = true; button1.useHandCursor = true; and inserted it for all my buttons and that seemed to fix everything, I tested the site on firefox, ie, and safari.  I am using a PC with windows 7.  When I went to check the website on a Mac powerbook, the cursor did not change on any of the buttons and it does not change on any of my hyperlinks either.  I have searched all over trying to find a solution and have had no luck.  Can anyone please help me with this problem or point me in the right direction?  Any advice would be very much appreciated.  Thanks so much!!!

    Thank you so much for replying!  I did in fact let flash professional create the HTML page for the site and have not altered it at all.  Would you have any other suggestions as to why it's not displaying my links/buttons on a Mac?  I checked out the browsers Firefox, ie, and safari on my pc, but looking thru safari on the Mac, the cursor does not change on any of my links or buttons.  Thanks again so much for the reply, nice to hear from a human instead of reading thousands of posts!  Very much appreciated!!!!!

  • Help please with my navigation buttons

    Can anyone please help me with my vertical navigation buttons. I'm trying to set up my nav bar so that all the buttons have a background image (button.jpg) behind them at all times and the only thing that changes when touched or the mouse rolls over them is that the colour of the text changes, except when the sub buttons appear, because the name of some of the sub buttons are so long i have created another button image that is longer (button2.jpg), i only want this to appear on sub buttons otherwise the buttons will end up taking most of the pages space. I'm having great difficulties getting the sub buttons to appear with the correct image (button2.jpg) and am getting increasingly frustrated with it, can anyone please help!!!
    www.milesfunerals.com/index2.html

    index2.html is a broken link for sure. The main index page looks like it's working fine.
    A little styling critique if it's okay... Personally I'd have gone with a CSS or Javascript multi-level menu across the bottom of the header. Saves visitors from having to scroll all the way down the page to see every menu item. And I'd rethink the color of the "Miles & Daughters" in the header image. It kinda gets lost in the roses.
    If you have a link to the "broken" page please put it up so we can analyze it.

  • Help please :) with do not disconnect.

    I disconnected my ipod and I still get that "Do not disconnect message" And it doesnt even flash.
    Can somone please help me with this

    Try Resetting your iPod. Hold down the MENU and SELECT (centre) buttons for five or ten seconds until you see the Apple logo appear then the menu button to go to the normal display. Have a look at this link as well:
    iPod won't turn on
    iPod stops responding or will not waken from sleep

  • Urgent help please with MIDI pedal

    I just got an old awesome midi pedal called the X-15 Ultrafoot.
    The pedal has two expression pedals, and 10 pushbuttons/pads. (and two buttons to cycle through additional banks, and a "mode" and "bypass" button)
    Somebody please help I am on the verge to having amazing control.
    What I want to do is have each pushbutton be assigned to a parameter, which is easy to program. Then I want to make the expression pedal(s) also be assigned to that last selected parameter. How do I do this?
    How can I make the expression pedals control over the parameter remain exclusive to just the last selected parameter?!
    Somebody save me please thanks

    mr kglad i really hope my ( too many replies and questions ) don't bother you.. but please excuse me if they sound foolish or something im a beginner as mentioned...
    There must be something wrong with whatever im doing ... ( im so desperate and since you are the only one who replied on me i really need your help please.. )
    1- i published the first fla as a swf (10.3 ) with a button with the code you've given me )
    2- i published the second fla as a swf (10.3) with another button with the same code you've given me )
    3- i made a main page where there are two buttons.. one for english and one for foreign language
      English button with this code :
    Engbutton.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_4);
    import fl.display.ProLoader;
    var fl_ProLoader_4:ProLoader;
    //This variable keeps track of whether you want to load or unload the SWF
    var fl_ToLoad_4:Boolean = true;
    function fl_ClickToLoadUnloadSWF_4(event:MouseEvent):void
        if(fl_ToLoad_4)
            fl_ProLoader_4 = new ProLoader();
            fl_ProLoader_4.load(new URLRequest("englishformFIN.swf"));
            addChild(fl_ProLoader_4);
        else
            fl_ProLoader_4.unload();
            removeChild(fl_ProLoader_4);
            fl_ProLoader_4 = null;
        // Toggle whether you want to load or unload the SWF
        fl_ToLoad_4 = !fl_ToLoad_4;
    and the other button with the same code ( the second fla )
    IT DOESNT WORK WHEN I TEST THE MOVIE.. the return buttons nor the main ones..why why why why why... ???
    i really need your help
    THANK YOU in advance

  • Help please, with port forwarding settings

    I have an MSI RG60 wireless router (Ethernet hard wired to my XP Home PC) and don't know what settings to use for port forwarding, to enable my WinMX and BitTorrent clients to work successfully.
    I have the port numbers, and assume that this information goes in the Service Port box, i.e. 6699, or 6881-6889.
    I know which ports are TCP and which are UDP, but I don't know what IP address to enter or which Common Service Port type to choose. Can anyone help please?
    I'm pretty sure that other settings in my PC are OK as I have successfully been running a Belkin router for a couple of years, and have only replaced it with the new MSI unit due to reliability problems.

    It does indeed have port triggering, but it wants incoming and trigger port protocol info, along with trigger and incoming port numbers.
    How can I type ipconfig into either of teh clients...WinMx or Bit Torrent?

  • Help Please With iPod Player On My 3GS

    Hello, Could anyone help me with a problem with my iPod part of my iPhone 3GS. The iPod will start to play my desired Playlist, but during the playback, the track album covers forget the last played track and franticly search for it. The album covers can rotate for ever and eventually lock the phone up and steel the album cover images at random. I have to then re-sync with iTunes to get them back. My last 3G phone did the same thing and I had it replaced, but still the same with the new 3G. Now I have a new 3GS, so the problem must be in iTunes Folder. I have a lot of tracks & platlists so I don't want to rush to reformat iTunes. Any ideas please? Jeff

    I'm having the same issue - did you ever find a solution?

  • Help please with caurina

    Hi, I have a bunch of logos in a file and want to animate with caurina, so I had create a timer to show ( fade in - fade out) the logos one by one;
    I had previously fade all the logos with alpha =0; but don´t any idea about how to call it inside the caurina function. my logos all are called logo1, logo2,logo3 etc and I try it to create a variable to hold a number and them put the first part of the name(logo) + the variable to call the movieclip but it didn´t work.Please if someone could help me with this problem.
    //this variable hold the 2nd part of the name
    var logoContador:Number = 1;
    var miTimer:Timer = new Timer(3000);
    miTimer.addEventListener(TimerEvent.TIMER, goTimer);
    function goTimer(TimerEvent:Event):void
    Tweener.addTween(logo+logoContador,{alpha:1,time:1,transition:"easeInQuad",});
    Tweener.addTween(logo+logoContador,{alpha:0,time:1, delay:1.7,transition:"easeInQuad",});
    logoContador++
    miTimer.start();

    yes, you where right it was the extra coma before the end, works very soft and cool, and even using a conditional inside can use it as a  loop.
    Thanks so much for your help, here is the whole script, could be useful to other people.
    import caurina.transitions.*;
    //this variable hold the 2nd part of the name
    var logoContador:Number = 1;
    var miTimer:Timer = new Timer(3000);
    miTimer.addEventListener(TimerEvent.TIMER, goTimer);
    function goTimer(TimerEvent:Event):void
    Tweener.addTween(this["logo"+String(logoContador)],{alpha:1,time:1,transition:"easeInQuad" });
    Tweener.addTween(this["logo"+String(logoContador)],{alpha:0,time:1, delay:1.7,transition:"easeInQuad"});
    if(logoContador>=6)
        logoContador = 1;
    else
    logoContador++
    trace("im runing");
    trace(logoContador);
    miTimer.start();
    //- end of script

Maybe you are looking for