Beginner in SDK Programming

Hi,
  I am a fresher in SDK-Programming.
I want to know the initial steps for programming in SDK.
How to set the project references and all.
I am using VB editor.
Regards,
Muni

Hi Muni,
You can also check the SDK landing page which has alot of information for users getting started on the Business One SDK: [Landing Page|https://websmp201.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000707558&_SCENARIO=01100035870000000183&_ADDINC=&_OBJECT=011000358700000622642008E]
If that link doesn't work for you, go to -> service.sap.com/smb/sbo -> Support -> Support Self-Help & Library -> Software Development Kit.
Regards,
Niall

Similar Messages

  • How much time does it take an SDK program to save an AR Invoice?

    Hi Guys,
    I know there are lots of things that I need to consider to know the answer to this question but I'm gonna ask it anyway.
    I have an HP Proliant ML370g5, with two intel zeon 1.86ghz quad core processors, 4gb ddr3 400mhz.
    Do you have an idea how long does it take an sdk program to save an AR invoice? Everynight, I need to automatically save around 600 invoices with an estimated 500 detail lines per invoice. The data are coming from a temporary table that is filled up by a remote program (not SDK) by day. At night, the SDK will get those data and post it to SBO as AR Invoice.
    I hope I made my explanation clear. PLease help.
    Thanks,

    Hi Joel,
    Why don't you just test one invoice? I know when you're in the user interface it gets very slow when posting big documents, but the SDK should be similar speed as the user interface when clicking the Add button.
    I haven't posted such big documents with the SDK. Another drawback of such big documents is that when you scroll through them via the user interface it takes very long to retrieve those documents and makes the entire user interface slow.
    Hope it helps,
    Adele

  • A PROBLEM WITH Mesh Suite to the SDK Programer

    The Great SDK Programer.I have two probleam to ask you, and Thank you for your help.
    1.How to conver a closed path object to Mesh object in sdk.
    2.How to use the MapPoints function?
    /** The function f is assumed to have continuous first derivative. The points of
    the mesh are transformed according to the function. */
    AIAPI AIErr (*MapPoints) (AIArtHandle mesh, AIMeshPointMap f, void* userData);
    I don't know the datastructer of the AIMeshPointMap f,and void* userData?
    Thank you very much for you help!

    I can't even turn mine on since the update! Booked in to the genius bar tomorrow. Can you borrow someone's phone? I'd book online to go into your closest genius bar and if it starts working in the meantime, just cancel the appointment. Good luck, I hope it fixes itself before bubs comes along.

  • Code Samples for SDK programming in Java

    I need a complete set of Code Samples for SDK programming in Java, like the one that is available in VB and .Net.
    For Example, if you look at the following directory of machine where SDK is installed,
    C:\ProgramFiles\SAP\SAP Business One SDK\Samples\COM DI\VB.NET
    we have following Sample programs in C Sharp, VB6, VB.Net
    01.BasicOperations
    02.MetaDataOperations
    03.UsingSBObob
    04.SerialAndBatch
    05.OrderAndInvoice
    06.ObjectsSchemas
    07.Permissions
    08.LoadFromXML
    09.BudgetEditor
    10.Messages Service
    11.Basic Company Settings
    12. Report Layout Service
    13.SaveXML
    14.ItemCycleCount
    15.ApprovalStagesAndTemplateServices
    16.Alert Management Service
    Iam looking for Samples like what is available above so that we can understand JCO better.

    Hi Sridharan,
    The only JCO samples I know of are posted in the [thread|;.
    Regards,
    Vítor Vieira

  • Book Adobe InDesign CS3/CS4 SDK Programming by Kris Coppieters

    Hi there, I would like to ask if anybody knows whether Adobe® InDesign® CS3/CS4 SDK Programming Book by Kris Coppieters is available as ebook, since I could find only printed version on Lulu.com. Thanks for your help

    Hi Maciej,
    No, I've never released my book as an ebook. Not sure if it would be worth the effort - it's an awfully small market! I have my book up on Lulu primarily for my own use, as course notes that I use when I run an InDesign SDK training session - so I can quickly print some nice quality handouts for my students.
    Cheers,
    Kris

  • How to learn Indesign CS3  SDK programming for windows

    Hi,<br /><br />I am very new to plugin development.I am working in Indesign CS3 SDK (windows).<br /><br />But I am not able to write /understand the syntax of InterfacePtr.<br /><br />for eg :<br /><br />InterfacePtr<IClassIDData> orgDocFileHandlerData(doc, IID_ORGICLASSIDDATA); <br /><br />We get Pointer of any Interface , and pass some arguments .<br /><br />So can anybody help how to learn this programming , I am not finding any <br /><br />books or tutorials on this so that I can read from the basic. I have only <br /><br />referred to Programming Guide(CS3). Can anybody please help/explain  me how <br /><br />to learn it?<br /><br />Thanks.<br /><br />Ravi Sharma

    It's only my way of understanding about InDesign SDK :<br /><br />* SDK objects are know as 'boss(es)' and are accessed thru interfaces.<br />* You can imagine object as collection of interfaces. And you can even aggregate new interfaces to existing objects.<br />* When you have a reference to an interface of a boss, you can access other interfaces (of the same boss - or object) using the *amazing* syntax : (here, doc is a probably an IDocument interface on a kDocBoss object, and you want to access it's IClassIDData interface)<br />InterfacePtr<IClassIDData> orgDocFileHandlerData(doc, IID_ORGICLASSIDDATA); <br />* And finally, InterfacePtr has a reference counter, which allows the framework to destroy the interface object - not the boss of course, only the memory used by the object - when it's non mre referenced.<br /><br />HTH !

  • Workshop: Adobe InDesign SDK Programming - How To Get Started

    Registration for InDesign SDK Dev Workshop in @CSBU Dev Summit in Seattle closes April 16. Don't delay - see below for links to registration info.
    Learning to program the InDesign SDK can easily take between two to six months of non-productive time.
    Kris Coppieters will return with his acclaimed one-day workshop that will slash the time it takes to get up to speed. This class is run in conjunction with the Developer Summit - there is an additional cost, and registration is handled separately from the Adobe Developer Summit.
    For more details and registration, go to
    http://www.rorohiko.com/wordpress/workshop-getting-started-with-the-indesign-sdk/
    Track: Product Specific Technologies
    Date, Time and Location:Monday May 3, 2010
    Starts at 9:00 am, lasts 8 hours
    Adobe University 1 
    Don't delay-register now!
    http://niemannross.host.adobe.com/2010csbuDeveloperSummit/conference/index.php
    http://niemannross.host.adobe.com/2010csbuDeveloperSummit/conference/eachSession.php?id=44
    Cheers,
    Kris

    FYI - Enrollment for the InDesign SDK course is about to close (official close date is April 16). Later enrollments will be accepted but might incur an extra fee.
    http://www.rorohiko.com/wordpress/2010/03/30/workshop-getting-started-with-the-indesign-sd k-2/

  • SDK Program Suggestion...

    I would like to see someone create a program like ichat or better for the iphone that is NOT SAFARI BASED...

    http://www.apple.com/feedback/iphone.html
    The above link is the closest you will get here.
    NO one knows what will come from the SDK or who will get it. All that is known is it is coming out at the end of February (just the kit not the programs themselves)

  • Beginner producer, which programs?

    Long story short, I've been using Garageband that came with my macbook for a while, and let's just say, I find it very limited. I finally saved up 400 dollars for a music program, and considering Reason 6. Are there any other considerations for other programs I should make? my main interests are Hip Hop and electronic. I'm looking for a software where I'm able to sample other tracks(cut them up and such), have a wide variety of drums,kicks,snare,claps,etc. The basics technically. I just want a wide variety of instruments/sounds where I can experiment with different genre's too. Another aspect I would like to see is being able to install plug-ins. So any thoughts?  PS- my equipment roster: M-audio Axiom 49-key,(1st gen) along with my macbook, and garageband. Tis I have so far
    So whats the best for a beginner? I'm mainly interested in Hip Hop,Pop, electronic, and house. Everything is mainly hip hop, but I always want an option to try something I haven't done before and may try something other than hip hop, i want that option 
    In the software, I want: 
    To chop samples up
    Have a huge kit of synths and all that jazz 
    Thing is, Reason is VST compatible, but maintains a huge library of sounds. Logic Pro on the other hand is compatible.  
    So which one is better? By the way, I have a usb turntable from numark that I will use, so what do I need to have that compatible with the software? Also, I tried Reason 6 on the demo for my macbook, I like it, but seems a bit hard to get use to. Which books should be recommended?
    Sorry this is a copy of my question(s) from another site. Can you guys help me out?

    Hi ilbra
    Please check this link for the programs available as part of Creative Cloud - https://www.adobe.com/ie/creativecloud/catalog/desktop.html
    Thanks
    Bev

  • A beginner in socket programming

    Ok I am been stuck on this program for the whole day trying to figure out why I cannot connect to my server computer using sockets and threads.
    I am trying to implement a instant messenger program where each user acts has both client/server. Each client creates a listening socket and all use a common port number, (in this case port 4444).
    If client 1 wants to interact with client 2, client 1 query�s my MySQL database for their status. Now if their status is online, retrieve their current ip address. So far so good. My program does not with no problem.
    Now comes the painful part. Now that client 1 knows client 2 is online and has his/hers ip, the next step is to connect to client 2�s listening socket using their ip and the port number 4444. Now after connecting to that socket, a new chat dialog gui is suppose to open from the client 2�s side. This new chat dialog gui (jframe) is a thread so that if other users wishes to interact with client 2, another new chat dialog thread will appear!
    But in my case nope! Has soon as client 1 tries to establish a connection with client 2, boom. Error, connection refused: connect!!
    Now I been searching through Google trying to understand what this means and so far I found null� now I posted before asking what that means and someone told me it means that I forgot to close the sockets and input, output streams. But how can I close it when I cannot even establish a connection with client 2??
    Things I have tried:
    I tried inputting myself, the actual ip of client 2 and guess what� no luck
    I tried the client 2�s computer name, and same thing!
    I tried to create a whole new main class just so that I can open and close the sockets and input/output stream and nope, no luck at all..
    Now that you have a good understanding of my program. Here comes the code:
    I�l start with the user_window, which is the main menu as you call it: this jframe once opened, is suppose to create a server socket to listen for connections. If a connection is made, load the chatdialog gui thread�
    * user_window.java
    * Created on 10 February 2006, 11:50
    package icomm;
    import java.sql.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.net.*;
    import java.io.*;
    * @author jonathan
    public class user_window extends javax.swing.JFrame implements WindowListener {
    protected String crnt_user;
    protected String crnt_ip;
    protected String dummy = "";
    /** Creates new form user_window */
    public user_window() {
    initComponents();
    listeningSocket();
    addWindowListener( this );
    public user_window(String users_name)
    initComponents();
    addWindowListener( this );
    this.crnt_user = users_name;
    private void exit()
    MySQL_queries offline = new MySQL_queries();
    offline.off_status(crnt_user);
    JOptionPane.showMessageDialog(null, "you are about to close the program " + crnt_user, null, JOptionPane.ERROR_MESSAGE);
    MySQL_queries query = new MySQL_queries();
    query.off_status(crnt_user);
    query.reset_ip(crnt_user);
    System.exit(0);
    public void windowClosing(WindowEvent e)
         exit();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
    try {
    Buddie_list =(javax.swing.JTree)java.beans.Beans.instantiate(getClass().getClassLoader(), "icomm.user_window_Buddie_list");
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    } catch (java.io.IOException e) {
    e.printStackTrace();
    label = new javax.swing.JLabel();
    demo = new javax.swing.JButton();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    Close = new javax.swing.JMenuItem();
    jMenu2 = new javax.swing.JMenu();
    profile = new javax.swing.JMenuItem();
    jMenu3 = new javax.swing.JMenu();
    getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    getContentPane().add(Buddie_list, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, 230, 310));
    getContentPane().add(label, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 390, -1, -1));
    demo.setText("talk to shienna");
    demo.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    demoActionPerformed(evt);
    getContentPane().add(demo, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 360, -1, -1));
    jMenu1.setText("File");
    jMenu1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jMenu1ActionPerformed(evt);
    Close.setLabel("Close");
    Close.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    CloseActionPerformed(evt);
    jMenu1.add(Close);
    jMenuBar1.add(jMenu1);
    jMenu2.setText("Option");
    profile.setText("Edit Profile");
    profile.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    profileActionPerformed(evt);
    jMenu2.add(profile);
    jMenuBar1.add(jMenu2);
    jMenu3.setText("Help");
    jMenuBar1.add(jMenu3);
    setJMenuBar(jMenuBar1);
    pack();
    // </editor-fold>
    private void demoActionPerformed(java.awt.event.ActionEvent evt) {                                    
    // TODO add your handling code here:
    ChatDialog_c chatting = new ChatDialog_c(crnt_user, dummy);
    chatting.setTitle("I-comm");
    chatting.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    chatting.setSize(360, 500);
    chatting.getSize();
    chatting.setLocation(420,200);
    chatting.setVisible(true);
    private void CloseActionPerformed(java.awt.event.ActionEvent evt) {                                     
    // TODO add your handling code here:
    private void demo1ActionPerformed(java.awt.event.ActionEvent evt) {                                     
    // TODO add your handling code here:
    private void show_chat_window()
    ChatDialog chat_gui = new ChatDialog();
    chat_gui.setTitle("chat");
    chat_gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    chat_gui.setSize(366, 480);
    chat_gui.getSize();
    chat_gui.setLocation(420,200);
    chat_gui.setVisible(true);// TODO add your handling code here:
    private void log_offActionPerformed(java.awt.event.ActionEvent evt) {                                       
    private void locate_ip()
    try
    InetAddress a;
    a = InetAddress.getLocalHost(); //get ip addrees
    this.crnt_ip = a.getHostAddress(); //then store it in this variable
    catch(UnknownHostException e)
    JOptionPane.showMessageDialog(null, "Error, cant detect localhost", null, JOptionPane.ERROR_MESSAGE);
    public void windowActivated(WindowEvent e) {}
         public void windowClosed(WindowEvent e) {}
         public void windowDeactivated(WindowEvent e) {}
         public void windowDeiconified(WindowEvent e) {}
         public void windowIconified(WindowEvent e) {}
         public void windowOpened(WindowEvent e)
    locate_ip();
    MySQL_queries new_ip = new MySQL_queries();
    new_ip.update_ip(crnt_user, crnt_ip);
    JOptionPane.showMessageDialog(null,"hello " + crnt_user + " your ip is" + crnt_ip, null, JOptionPane.ERROR_MESSAGE);
    private void listeningSocket()
    ServerSocket serverSocket = null;
    boolean listening = true;
    try
    //listen in port 4444;
    serverSocket = new ServerSocket(4444);
    catch(IOException x)
    JOptionPane.showMessageDialog(null, "cannot listen to port 4444", null, JOptionPane.ERROR_MESSAGE);
    while(listening)
    try
    ChatDialog chat = new ChatDialog(serverSocket.accept());
    catch(IOException x)
    JOptionPane.showMessageDialog(null, "could not open chat window", null, JOptionPane.ERROR_MESSAGE);
    private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {                                      
    // TODO add your handling code here:
    private void profileActionPerformed(java.awt.event.ActionEvent evt) {                                       
    // TODO add your handling code here:
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new user_window().setVisible(true);
    Now for the chatdialog class: I forgot to mention that I have two versions of this class. One that is a thread and the other makes a connection to a thread, hope that makes sence�
    package icomm;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class ChatDialog_c extends javax.swing.JFrame implements WindowListener {
        protected String messege;
        private Socket socket = null;
        protected String ip2;
        private PrintWriter out = null;
        private BufferedReader in = null;
        private String user_name;
        private String status;
        /** Creates new form ChatDialog_c */
        public ChatDialog_c()
            initComponents();
            addWindowListener( this );
         public ChatDialog_c(String ip1)
            initComponents();
            addWindowListener( this );
            this.ip2 = ip1;
            //OptionPane.showMessageDialog(null, "error in closing sockdswdset " + ip2, null, JOptionPane.ERROR_MESSAGE);
         public ChatDialog_c(String user, String status)
            initComponents();
            addWindowListener( this );
            this.user_name = user;
        public void windowClosing(WindowEvent e)
            public void windowActivated(WindowEvent e) {}
         public void windowClosed(WindowEvent e) {
                try
                    in.close();
                    out.close();
                    socket.close();
                catch(IOException x)
                    x.printStackTrace();
                    JOptionPane.showMessageDialog(null, "error in closing socket " + x.getMessage() + ip2, null, JOptionPane.ERROR_MESSAGE);
         public void windowDeactivated(WindowEvent e) {}
         public void windowDeiconified(WindowEvent e) {}
         public void windowIconified(WindowEvent e) {}
          public void windowOpened(WindowEvent e)
              MySQL_queries get_ip = new MySQL_queries();
              this.ip2 = get_ip.find_client(user_name);
               JOptionPane.showMessageDialog(null, user_name + ip2, null, JOptionPane.ERROR_MESSAGE);
                //create socket connection
                try
                    socket = new Socket ("Shienna", 4444);
                    out = new PrintWriter(socket.getOutputStream(), true);
                    in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                catch(UnknownHostException x)
                    x.printStackTrace();
                    JOptionPane.showMessageDialog(null, "unknown  " + x.getMessage() + ip2, null, JOptionPane.ERROR_MESSAGE);
                catch(IOException x)
                    x.printStackTrace();
                    JOptionPane.showMessageDialog(null, "2 " + x.getMessage(), null, JOptionPane.ERROR_MESSAGE);
                 try
                    in.close();
                    out.close();
                    socket.close();
                catch(IOException x)
                    x.printStackTrace();
                    JOptionPane.showMessageDialog(null, "error in closing socket " + x.getMessage() + ip2, null, JOptionPane.ERROR_MESSAGE);
                while(true)
                    try
                        String line = in.readLine();
                        convo_txt.append(line);
                    catch(IOException x)
                        x.printStackTrace();
                        JOptionPane.showMessageDialog(null, "3 " + x.getMessage(), null, JOptionPane.ERROR_MESSAGE);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            jScrollPane1 = new javax.swing.JScrollPane();
            convo_txt = new javax.swing.JTextArea();
            jScrollPane2 = new javax.swing.JScrollPane();
            txt_messege = new javax.swing.JTextArea();
            send = new javax.swing.JButton();
            jMenuBar1 = new javax.swing.JMenuBar();
            jMenu1 = new javax.swing.JMenu();
            jMenu2 = new javax.swing.JMenu();
            getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jScrollPane1.setViewportView(convo_txt);
            getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 220, 280));
            txt_messege.setLineWrap(true);
            jScrollPane2.setViewportView(txt_messege);
            getContentPane().add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 330, 220, 70));
            send.setText("Send");
            send.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    sendActionPerformed(evt);
            getContentPane().add(send, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 420, -1, -1));
            jMenu1.setText("File");
            jMenu1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jMenu1ActionPerformed(evt);
            jMenuBar1.add(jMenu1);
            jMenu2.setText("Option");
            jMenuBar1.add(jMenu2);
            setJMenuBar(jMenuBar1);
            pack();
        // </editor-fold>                       
        private void sendActionPerformed(java.awt.event.ActionEvent evt) {                                    
            String text = txt_messege.getText();
            out.println();
            txt_messege.setText(new String(""));
            convo_txt.append(text);
        private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {                                      
    // TODO add your handling code here:
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new ChatDialog_c().setVisible(true);
        }///////////////////////chat dialog thread/////////////////////
    package icomm;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class ChatDialog extends javax.swing.JFrame implements WindowListener, Runnable {
        protected String messege;
        private Socket client_user = null;
        /** Creates new form ChatDialog */
        public ChatDialog()
            initComponents();
            addWindowListener( this );
        public ChatDialog(String txt_messege)
            initComponents();
            addWindowListener( this );
            this.messege = txt_messege;
         public ChatDialog(Socket user)
             initComponents();
             addWindowListener( this );
             this.client_user = user;
        public void run()
            BufferedReader in = null;
            PrintWriter out = null;
            String error = "error has occured ";
            String messege = null;
             try
                //create input and output streams
                in = new BufferedReader(new InputStreamReader (client_user.getInputStream()));
                out = new PrintWriter(client_user.getOutputStream(), true);
                while(true)
                   //read messege sent by user
                   messege = in.readLine();
                   //send data back to user
                   out.println(messege);
                   //append data on the text field
                   convo_txt.append(messege + "\n");
                   //chat_gui.setVisible(true);
                   //-=inputs = new ChatDialog(messege);
               //out.close();
                //in.close();
                //client_user.close();
            catch (IOException e)
                //error messege
                e.printStackTrace();
                JOptionPane.showMessageDialog(null, error + e.getMessage(), null, JOptionPane.ERROR_MESSAGE);
        }If I can sort this problem out I would of completed the main part of my program. I have spent days on this and hope that anyone of you guys can take the time out and help me with my current situation. Thanks

    update:
    i have managed to sort out the connection refused
    i know have anotehr problem: both client2 program freezes as soon as client 1 tries to initiate a connection to client 2!!!!!!!!
    when client 2 logs into teh system. it freezes as soon as i press the button! but when client 1 attempts to conenct to client 2, client 2's program stops freezing and the chatdialog comes up showing nothing and freezes! my chadialog is suppose to show a file menu i made but it doesnt,. both clients freezes at this point. no error messeges occur...

  • Beginner with a programming problem

    I am getting quite frustrated trying to figure out how to proceed with a Java program I've been assigned. I'm hoping that my problem is not too amorphous to warrant assistance.
    The program is an exercise in Swing and creating GUI's, and at this stage, I only need to create an array of dice objects which can paint themselves on a JPanel. The instructor has given us two files -- one extending JPanel and containing a main method to test the classes, and another which represents a die.
    Some issues are
    1) I don't know where to call repaint.
    2) When the overridden paintComponent method is called, it wipes out
    the background color on my panel, which I set in the constructor.
    3) I got null pointer exceptions when I ran the instructor 's main method... I moved the setVisible up in the chain and they went away (Though he stated not to alter the main method, I don't know enough about Java Graphics to know if it's his mistake or mine)
    4) I'd just like to see some something appear.
    I should add that I rewrote this whole thing in one file (without using an array) and was able to get the graphics to paint.
    Sorry for posting copious amounts of code, but hopefully it will clear up what I'm trying to do. If anyone could just give me some pointers in the right direction, I would greatly appreciate it. Thank you for your time.
    //      File:  DicePanel.java
    public class DicePanel extends JPanel
      private int number_of_dice = 0;
      private DiceDrawn [] dice; 
      /** The x,y coordinates where the first die is drawn */
      private int xCoordinate = 5; //default
      private int yCoordinate = 5; //default
      /** Constructor with default properties */
      public DicePanel()
        this.setSize(getPreferredSize());
        this.setBackground(Color.blue);
        // set size and color
      /*  Set the Dice array  */
      public void setDice(DiceDrawn[] d)
      }// end setDice
      /** Return xCoordinate */
      public int getXCoordinate()
        return xCoordinate;
      /** Set a new xCoordinator */
      public void setXCoordinate(int x)
         xCoordinate = x;
      /** Return yCoordinator */
      public int getYCoordinate()
        return yCoordinate;
      /** Set a new yCoordinator */
      public void setYCoordinate(int y)
         yCoordinate = y;
      /** Paint the Dice Panel */
      protected void paintComponent(Graphics g)
        super.paintComponent(g);
        for (int i = 0; i < dice.length; i++ )
          dice.drawDie(g, xCoordinate, yCoordinate);
    setXCoordinate(getXCoordinate() + 41);
    // draw each die using default start coordinates,
    // moving right each time
    /** Override get method for preferredSize */
    public Dimension getPreferredSize()
    return new Dimension(200, 50);
    // the main method to test DicePanel and DiceDrawn
    // do not change this method.
    public static void main(String [] args)
    JFrame f = new JFrame();
    // f.setVisible(true);
    f.setTitle("Draw Dice");
    f.setSize(500,400);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container cp = f.getContentPane();
    // show 6 dice initially
    DiceDrawn [] dice = new DiceDrawn [6];
    for(int i = 0; i < dice.length; i++)
    dice[i] = new DiceDrawn(i+1);
    DicePanel dicePanel = new DicePanel();
    dicePanel.setDice(dice);
    System.out.println(dice.length);
    cp.add(dicePanel, BorderLayout.NORTH);
    f.setVisible(true);
    // show only one die for the rest of the program
    dice = new DiceDrawn [1];
    System.out.println("Dice Drawn Class Test");
    int i = Io.readInt("Enter an integer between 1 and 6");
    while( i > 0 )
    dice[0] = new DiceDrawn(i);
    dice[0].setSelected( i%2 == 0 ? true : false);
    dicePanel.setDice(dice);
    i = Io.readInt("Enter an integer between 1 and 6");
    System.exit(0);
    // File: DiceDrawn.java
    public class DiceDrawn
    private final int SIZE = 36;
    private final int QUARTER = SIZE/4;
    private int face; // face value
    private boolean selected; // pressed = true
    public DiceDrawn( int f)
    setFace(f);
    setSelected(true);
    }// end DiceDrawn
    public void setSelected( boolean s )
    selected = s;
    public boolean isSelected()
    return selected;
    public void setFace(int i)
    face = i;
    public int getFace()
    return face;
    // Draw a die starting at the given coordinates
    public void drawDie(Graphics g, int xcoor, int ycoor)
    g.setColor(Color.WHITE);
    g.fillRect(xcoor,ycoor, SIZE, SIZE);
    g.setColor(Color.BLACK);
    switch(face)
    case 1:
    g.fillOval((xcoor-4)+(2*QUARTER), (ycoor-4)+(2*QUARTER), SIZE/8, SIZE/8);
    break;
    case 2:
    g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + QUARTER, SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+(3*QUARTER), (ycoor-4)+(3*QUARTER), SIZE/8, SIZE/8);
    break;
    case 3:
    g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + QUARTER, SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+(3*QUARTER), (ycoor-4)+(3*QUARTER), SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+(2*QUARTER), (ycoor-4)+(2*QUARTER), SIZE/8, SIZE/8);
    break;
    case 4:
    g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + QUARTER, SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+(3*QUARTER), (ycoor-4)+(3*QUARTER), SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + (3*QUARTER), SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+ (3*QUARTER), (ycoor-4)+ QUARTER, SIZE/8, SIZE/8);
    break;
    case 5:
    g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + QUARTER, SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+(3*QUARTER), (ycoor-4)+(3*QUARTER), SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + (3*QUARTER), SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+ (3*QUARTER), (ycoor-4)+ QUARTER, SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+(2*QUARTER), (ycoor-4)+(2*QUARTER), SIZE/8, SIZE/8);
    break;
    case 6:
    g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + QUARTER, SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+(3*QUARTER), (ycoor-4)+(3*QUARTER), SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+ QUARTER, (ycoor-4)+(2*QUARTER), SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+ (3*QUARTER), (ycoor-4)+(2*QUARTER), SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+ QUARTER, (ycoor-4) + (3*QUARTER), SIZE/8, SIZE/8);
    g.fillOval((xcoor-4)+ (3*QUARTER), (ycoor-4)+ QUARTER, SIZE/8, SIZE/8);
    break;
    // draw a die using a rectangle of 36 by 36 pixels
    // at the coordinates given.
    // use a switch statement to draw the appropriate face.
    }// end DrawDie
    }// end DiceDrawn

    Once you get beyond your initial problems, you'll find that there is another problem. When it displays the dice corresponding to the numbers you select, the x coordinate eventually becomes greater than the frame width. You need to make a change to the paintComponent method so it looks like:
      /** Paint the Dice Panel */
      protected void paintComponent(Graphics g)
        super.paintComponent(g);
        for (int i = 0; i < dice.length; i++ )
          dice.drawDie(g, xCoordinate, yCoordinate);
    if(dice.length > 1)
    setXCoordinate(getXCoordinate() + 41);
    // draw each die using default start coordinates,
    // moving right each time
    Note that I have added an if above the setXCoordinate so that it will only add to the X coordinate when it is displaying the 6 dice initially. It won't add anything when it is displaying the single dice.

  • Structure Changes in Database make SDK program crash.

    Hi, is there an event I can catch when the database gets a structure change? Say a new table or field added?. Becuase everytime this happens the program crashes.
    Thanks.
    Jose.

    Sorry I didnt specify it was in DI
    I testit it and added a field to a MarketingDocument and after that the program halted in this line of code:
    SAPbobsCOM.StockTransfer _oTraspaso = (SAPbobsCOM.StockTransfer)Global.COMPANY.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer);
    I dont understand the error, it says:
    Exception from HRESULT: 0xFFFFFB9E
    Thank you.

  • Beginner to MUS program

    Dears,
    I am a beginner to using Director's multiuser server
    functions. I am looking
    for advises here. Is there any good websites, technotes or
    books recommanded
    for beginners just like me?
    Pls. advise.
    Thx a lot.
    Athena

    I dont know if Im posting in the right area. but what I need
    to know is when a message is sent from my server to my client
    software how can I get that message to pop up in a flash screen?
    and suggestions?
    [email protected]

  • C programming beginner | Feedback on programs would be much apreciated

    Hello,
    I am taking a free c programming course ( CS50 OpenCourseWare, Introduction to Computer Science 1 | http://cs50.tv/2011/fall/ ).
    I did not realize that writing code was so much complicated. I find the course very challenging but also (and more importantly) "extremely" interesting :-)
    However, at the present time the idea that I could even in a "really" remote future, become "programming-literate" (I hope it is a real word) :-) seems to be an utopia.
    Attempting to reach a preliminary understanding which extends beyond the appearances of complexity is... disturbing.
    Anyway, could it be possible to receive some feedback on the two versions of a program ( credit.c ) that I have written for the  problem set 1 ?
    Here is the program specification: http://ideone.com/UOjA3
    the first version of credit.c : http://ideone.com/nT0xI
    the second (and I hope improved) version: http://ideone.com/nT0xI
    P.S. By the way, I have been using arch for a little bit more than a year  ...    NICE :-)
           Thanks to all of you that make it possible.

    ewaller wrote:
    Moderator comment:
    pxavier,
    Welcome to the forums.  I am obliged to point out our policy on homework.
    I thank you for being candid that it is classwork.  I will leave this thread open, for now.  I ask that anyone helping do so in the role of a teacher, not a peer.  I don't mind a bit of Socratic method to point you in the right direction.  The moderators will shut this down if others start showing you how to do it.
    ewaller, Thanks for directing me to the homework section of the forum etiquette and for not shutting this thread down .                                               
    I do apologize for not having checked it before posting. Could I have some clarifications regarding the policy ?                                                           
    The course - cs50 dot tv - is an initiative of Harvard university to make the content of its computer science introductory course - cs50 dot net -                       
    and few others, freely available to anyone who might be interested. Videos of the lectures and sections (recitations), lecture notes, slides, source codes used   during the lectures, problem sets and quizzes can be accessed from the cs50.tv website :-). A google group has even been set up which provides a  place to turn to when faced with technical difficulties (the actual course instructor takes the time to offer some help).                                             
    Be that as it may, in order to receive feedback on "completed" problem sets, one need to "effectively" take the course (enrolling at Harvard                               
    and take the course on-site or online). By posting my completed problem set on the cs50 google group, I only get feedback from people                                   
    who, like me, are in the process of learning the c programming language.                                                                                                 
    Quote from the cs50 google group (someone seeking feedback):                                                                                                             
    << - That means if i "post" my code in a mail, your team will evaluate and                                                                                                 
             give me feedback?                                                                                                                                                     
           - that depends, but I'm going to say "usually not"                                                                                                                       
             David and Glenn occasionally give clues to difficult problems (stuff like pointers and strange bugs you may have),                                                     
             I don't think I've ever seen them look at someone's code and say "well commented, fast, well thought out, good logic"                                                 
             if you want that from them, then you'll have to pay for the class.                                                                                                     
             There are other people on here who occasionally give feedback to code, but this is generally a "teach yourself" group.                                                 
             I would say the most helpful thing is to make your code look like the sample code in the pdfs that go with every week's lectures. >>                                   
    I am not asking for solutions to the problem sets, had I been a Harvard student, this is (  unfortunately   ) what I would have submitted.                               
    I just wish to receive some comments, suggestions and criticisms which will allow me to correct the stupid things that I usually do.                                     
    The "Socratic method" is absolutely fine by me                                                                                                                        
    In that context, would it be ok for me to keep on posting "completed" problem sets in the future ?                                                                       
    I also have to apologize regarding the links to the source codes that I have provided, they both are the same and point to the older version (credit.c),                 
    here are the correct links:                                                                                                                                               
    credit.c (old version)    --> http://ideone.com/nT0xI                                                                                                                     
    new_credit.c (new version) --> http://ideone.com/gUDcm
    ewaller wrote:A couple comments:
    First, all of your functions (with the exception of main) are void.  I see that your functions report their results to the console, but do you think they might be more useful if they were to return information the routine that called them?  Just because there is a return value, the called function can choose to just ignore it.
    In the new version, I tried to make functions which use the return values of other functions as parameters.
    ewaller wrote:Second, I would rather not see "Magic Numbers" hard coded into case statements.  I prefer to define the magic numbers in one place (in a header file, or at least, at the top of main.c)
    I also tried to avoid "Magic Numbers" by using #define, however I did not think about doing so into the case statements, thanks.
    ewaller wrote:edit:  Third comment.  How much do you trust the person entering the card data?  Can they do something  evil to you?
    Regarding checking users inputs, the GetLongLong() function (CS50 library - cs50.h), takes care of it for us. However in the new version I have not                       
    used <cs50.h>, I tried to verify the input myself... It looks very shaky to me
    Blµb wrote:
    A note:
    char temp_credit_card_number[17];
    The 17 bytes here include the terminating null byte. So, when you later conver the number to a string,
    and the number is 17 digits, the 17th digit will not be in this string, and strlen() will return 16.
    But you recognize 16 as the correct length for VISA.
    I know you have some other checks in there, but you should allow this check to fail as well, and use at least 18, or even more.
    I understand, thanks :-)
    Blµb wrote:
    A change:
    - snprintf(temp_credit_card_number, 17, "%lld", credit_card_number);
    + snprintf(temp_credit_card_number, sizeof(temp_credit_card_number), "%lld", credit_card_number);
    Description:
    sizeof: Gets the size of a type in bytes. (Note while this works well for an array, you cannot generally use it for pointers, since pointers have their own size independent from the data they're pointing to)
    Reason:
    If you always use sizeof, you can change the size of temp_credit_card_number at its definition without having
    to worry about the places you're using it at.
    Should I also use sizeof in the new version http://ideone.com/gUDcm  at line 51, instead of BUFFER_SIZE ? What about line 53 ?                                         
    In such cases what are the pros and cons of using either sizeof or #define BUFFER_SIZE ?
    Blµb wrote:
    A note
    // "credit_card_number" converted to a string in order to determine its length
    snprintf(temp_credit_card_number, 17, "%lld", credit_card_number);
    int credit_card_number_length = strlen(temp_credit_card_number);
    This works, however, you can actually skip the conversion, and simply count how often you can divide by 10 before the number becomes 0: count = 0; for (temp = cardnumber; temp; temp /= 10) ++count;
    You then don't need a buffer, don't need to worry about passing the right size to snprintf, and don't need to actually go through printf's formatting algorithm.
    That's what I have done in the new version.
    Blµb wrote:
    And another change:
    You do this a few times, consider the replacement:
    - printf("%s\n", card_type[3]);
    + printf("%s\n", card_type[INVALID]);
    I do need to think about that one...
    Blµb wrote:A last note: 'INVALID' is quite a general name. In C, we tend to prefix constants and variables based on their purpose, since C has no namespaces. If at some point you add something else that can be INVALID, its INVALID could have a different number.
    So you could instead do something like: enum credit_card_type { CREDIT_CARD_AMEX, ..., CREDIT_CARD_INVALID };
    Thanks, I will.
    stqn wrote:
    } else if ((mastercard_two_first_digits == 51)
    || (mastercard_two_first_digits == 52)
    || (mastercard_two_first_digits == 53)
    || (mastercard_two_first_digits == 54)
    || (mastercard_two_first_digits == 55)) {
    This could be shorter.
    Edit: “type” should probably not be a global variable. It doesn’t need to be one and it’s easy to make it local.
    Ok, I will try to shorten the elseif statement and make "type" a local variable". thanks

  • Beginner to game programming

    hello everyone
    I am trying to write a he-man fighting game. I have just started and am pretty new to game devlopment, but thanks to java.sun I found the animation to walk. I used that code and edited for jumping and throwing a basic punch. my problem is this. all the images I have are jpgs from the old cartoon show. how do I render them in java to look like "video game images" (an actual part of the game, instead of an image moving in a back ground
    thanks

    if its Image manipulation your doing, then you need a Paint package such as PhotoShop or Paint Shop Pro (the later being freely downloadable shareware)
    as for making them look Professional - thats what Professional game artists do :)
    There are lots of packages for building 3D scenes and rendering them out as 2D images.
    Most of them cost a stack of [$$$|���|<place your currency here>].
    3D Studio Max, Lightwave and Maya are the ones that immediately spring to mind, but there are lots of others.

Maybe you are looking for