Accessing objects in the Call Stack

Hi all,
is there any way to access in your ABAP program, objects in the previous levels of the call stack (the way we can display them in the debugger using the (program)object syntax).
Thanks,
Z

I got the solution.
I tried out the (program)object syntax with different kinds of statements.
The one with field-symbols works:
  ASSIGN ('(ZTESTPROGRAM)LS_OBJ') TO <fs>.
Where ZTESTPROGRAM contains the object LS_OBJ

Similar Messages

  • How to access objects in the Child Form from Parent form.

    I have a requirement in which I have to first open a Child Form from a Parent Form. Then I want to access objects in the Child Form from Parent form. For example, I want to insert a record into a block present in Child Form by executing statements from a trigger present in Parent Form.
    I cannot use object groups since I cannot write code into Child Form to first create object groups into Child Form.
    I have tried to achieved it using the following (working of my testcase) :
    1) Created two new Forms TESTFORM1.fmb (parent) and TESTFORM2.fmb (child).
    2) Created a block named BLK1 manually in TESTFORM1.
    3) Created two items in BLK1:
    1.PJC1 which is a text item.
    2.OPEN which is a push button.
    4) Created a new block using data block wizard for a table EMPLOYEE_S1. Created items corresponding to all columns present in EMPLOYEE_S1 table.
    5) In WHEN-NEW-FORM-INSTANCE trigger of TESTFORM1 set the first navigation block to BLK1. In BLK1 first navigable item is PJC1.
    6) In WHEN-NEW-ITEM-INSTANCE of PJC1, code has been written to automatically execute the WHEN-BUTTON-PRESSED trigger for the "Open" button.
    7) In WHEN-BUTTON-PRESSED trigger of OPEN item, TESTFORM2 is opened using the following statement :
    open_form(‘TESTFORM2',no_activate,no_session,SHARE_LIBRARY_DATA);
    Since its NO_ACTIVATE, the code flows without giving handle to TESTFORM2.
    8) After invoking OPEN_FORM, a GO_FORM(‘TESTFORM2’) is now called to set the focus to TESTFORM2
    PROBLEM AT HAND
    ===============
    After Step 8, I notice that it passes the focus to TESTFORM2, and statements after go_form (in Parent Form trigger) doesnot executes.
    I need go_form with no_activate, similar to open_form.
    Edited by: harishgupt on Oct 12, 2008 11:32 PM

    isn't it easier to find a solution without a second form? If you have a second window, then you can navigate and code whatever you want.
    If you must use a second form, then you can handle this with WHEN-WINDOW-ACTIVATED and meta-data, which you have to store in global variables... ( I can give you hints if the one-form-solution is no option for you )

  • Accessing object of the main class from the thread

    Hi, I'm having problem accessing object of the main class from the thread. I have only one Thread and I'm calling log.append() from the Thread. Object log is defined and inicialized in the main class like this:
    public Text log;  // Text is SWT component
    log = new Text(...);Here is a Thread code:
    ...while((line = br.readLine())!=null) {
         try {
              log.append(line + "\r\n");
         } catch (SWTException swte) {
              ErrorMsg("SWT error: "+swte.getMessage());
    }Error is: org.eclipse.swt.SWTException: Invalid thread access
    When I replace log.append(...) with System.out.println(..) it works just fine, so my question is do the log.append(..) the right way.

    This is NOT a Java problem but a SWT specific issue.
    It is listed on the SWT FAQ page http://www.eclipse.org/swt/faq.php#uithread
    For more help with this you need to ask your question on a SWT specific forum, there is not a thing in these forums. This advice isn't just about SWT by the way but for all specific API exceptions/problems. You should take those questions to the forum or mailing list for that API. This forum is for general problems and exceptions arising from using the "core" Java libraries.

  • Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

    Hi,
    I am trying to run a long running process, by redirecting to the LongRunningView using the code below. But its throwing exception Can anyone please help
    string strCurrentUrl = SPUtility.OriginalServerRelativeRequestPath;
    strCurrentUrl = strCurrentUrl + "?ListName=" + strListName;
    ////Initiates the Excel Import
    if (ObjdtExcel != null && ObjdtExcel.Rows.Count > 0)
    ExcelImportJob objJob = new ExcelImportJob(strTabName, ObjdtExcel, strFileExt, SPContext.Current.Site.ID, SPContext.Current.Web.ID, strWorkflow, strListName);
    objJob.Title = "Excel Import Job";
    //// Redirect the user to another page when finished.
    objJob.RedirectWhenFinished = false;
    //// Specify if the user can cancel this.
    objJob.UserCanCancel = false;
    //// Specify the refresh rate of the job, here, the page polls every 5 seconds for completion.
    objJob.MillisecondsToWaitForFinish = 15000;
    //// Finally, start the job on a web.
    objJob.Start(SPContext.Current.Web);
    string strUrl = string.Format("{0}?JobId={1}&Source={2}", PROGRESS_PAGE_URL, objJob.JobId, strCurrentUrl);
    SPUtility.Redirect(strUrl, SPRedirectFlags.Default, HttpContext.Current);
    The exception being "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."
    Arjun Menon U.K

    Hi Arjun,
    Any update?
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • Getting the call stack up to a certain location.

    Dear friends,
    I am searching for a function or method that can give me
    the call stack(like in debug mode).
    If you know of a function that provides this information
    please let me know, its very urgent.
    Thanks in advance,
    Eitan Illuz.

    Hello Eli
    You may have a look at thread:
    [Get the name of a function module within a function module|Get the name of a function module within a function module;
    Sample coding to retrieve the calling function module:
    data:
      lt_callstack TYPE abap_callstack.
    CALL FUNCTION 'SYSTEM_CALLSTACK'
      IMPORTING
        callstack = lt_callstack.
    READ TABLE lt_callstack
      WITH KEY blocktype = 'FUNCTION'
        blockname = 'CRM_ORDER_COPY_SINGLE_OW'
      TRANSPORTING NO FIELDS.
    CHECK sy-subrc NE 0.
    Reference: [http://martins.de/call_stack_lesen.html]
    Regards
      Uwe

  • How to print the call stack of a thread?

    I would like to print out the call stack of a thread, something that looks like the output of pstack.
    From within the thread itself, I suppose I can fork1() to duplicate the thread and fork another process to run pstack on the duplicated thread.
    I would much rather use some api to print out the stack directly. Any pointer would be appreciated.

    Hi,
    The code below will do what you want.
    All that needs to be done is to call csprintstack() from within
    your application. Remember to link in the dynamic linking library,
    libdl.so, as dynamic library functions are used.
    Cheers.
    Jon Haslam<br>
    Developer Technical Support<br>
    Sun Microsystems<br>
    <pre>
    #include <ucontext.h>
    #include <sys/frame.h>
    #include <dlfcn.h>
    #include <setjmp.h>
    #include <sys/procfs_isa.h>
    #include <stdio.h>
    #if defined(sparc) || defined(__sparc)
    #define FRAME_PTR_REGISTER REG_SP
    #endif
    #if defined(i386) || defined(__i386)
    #define FRAME_PTR_REGISTER EBP
    #endif
    struct frame *
    csgetframeptr()
    ucontext_t u;
    (void) getcontext(&u);
    return (((struct frame *)
    u.uc_mcontext.gregs[FRAME_PTR_REGISTER])->fr_savfp);
    void
    cswalkstack(struct frame * fp, int (*operate_func)(void *, void *),
    void * usrarg)
    void * savpc;
    struct frame * savfp;
    while (fp &&
    (savpc = (void*)fp->fr_savpc) &&
    (*operate_func)(savpc, usrarg) == 0) {
    fp = fp->fr_savfp;
    static int
    csprintaddress(void pc, void usrarg)
    Dl_info info;
    char * func;
    char * lib;
    if(dladdr(pc, & info) == 0) {
    func = "??";
    lib = "??";
    else {
    lib = (char *) info.dli_fname;
    func = (char *) info.dli_sname;
    fprintf((FILE *) usrarg,
    "%s:%s+0x%x\n",
    lib,
    func,
    (unsigned int)pc - (unsigned int)info.dli_saddr);
    return(0);
    void
    csprintstack(FILE * f)
    cswalkstack(csgetframeptr(), csprintaddress, (void *) f);
    </pre>

  • To access a package, the calling class must reside in the root/parent direc

    My goal was to be able to access my package from anywhere within the
    high level root folder (d:\zJava). But it seems the invoking class MUST
    RESIDE IN THE TOP LEVEL PARENT DIRECTORY of the package. Was Java
    designed to behave this way?
    D:\zJava\zsamples\com\zswingpackage1>     <-- packages successfully compiled here
         swing_optgrp_eg1.{class/java}
              package com.zswingpackage1;
              public class swing_optgrp_eg1 extends JFrame implements ItemListener {
    D:\zJava\zsamples\com> <-- classes residing here could NOT successfully                    access the package 'com.zswingpackage1'. The third                    level subfolder is 'com'.
         package_test4.java
              /* Following import stmt. causing RUN-TIME error "Exception in thread     "main" java.lang.NoClassDefFoundError: com/zswingpackage1/swing_optgrp_eg1". */
              import com.zswingpackage1;
         Package_Test4.class          
         /* Unsuccessful remedies:
         i) D:\zJava\zsamples\com>java Package_Test4
                   -classpath .;d:\zJava\zsamples\com\zswingpackage1
                   -classpath .;d:\zJava\zsamples\com
                   -classpath .;d:\zJava\zsamples (also used in compile)
                   -classpath .;d:\zJava
         ii) ran from the root/parent directory of the package d:\zJava\zsamples),with and without classpath i.e.
              D:\zJava\zsamples>java com\Package_Test4 [-classpath .;d:\zJava\zsamples]
         iii) ran from the top level directory (d:\zJava), with and without classpath i.e.
              D:\zJava>java zsamples\com\Package_Test4 [-classpath .;d:\zJava\zsamples]
         Possible causes:
              - maybe the above behaviours are by design i.e. the calling class/program CANNOT be stored within the package hierarchy?
    D:\zJava\zsamples\net> <-- classes residing here could NOT successfully access the package 'com.zswingpackage1'. The third level subfolder is 'net'.
         package-test6.java
              /* Following import stmt. causing RUN-TIME error "Exception in thread "main" java.lang.NoClassDefFoundError: com/zswingpackage1/swing_optgrp_eg1". */
              import com.zswingpackage1;
         Package_Test6.class
         /* Unsuccessful remedies:
         i) D:\zJava\zsamples\net>java Package_Test6
                   -classpath .;d:\zJava\zsamples\com\zswingpackage1
                   -classpath .;d:\zJava\zsamples\com
                   -classpath .;d:\zJava\zsamples (also used in compile)
                   -classpath .;d:\zJava
         ii) ran from the root/parent directory of the package (d:\zJava\zsamples), with and without classpath i.e.
              D:\zJava\zsamples>java net\Package_Test6 [-classpath .;d:\zJava\zsamples]
         iii) ran from the top level directory (d:\zJava), with and without classpath i.e.
              D:\zJava>java zsamples\net\Package_Test6 [-classpath .;d:\zJava\zsamples]
         Possible causes:
              - maybe the above behaviours are by design i.e. the calling class/program MUST be stored in the parent folder of the package hierarchy?
    **D:\zJava\zsamples>     <-- classes residing here SUCCESSFULLY accessed package 'com.zswingpackage1'. NO -classpath parms. were necessary!
    D:\zJava\ <-- classes residing here could NOT successfully access the package 'com.zswingpackage1'. Similar scenarios as above.
    D:\zJavaB\ <-- classes residing here could NOT successfully access the package 'com.zswingpackage1'. I purposely created another folder with the 'B' suffix. Similar scenarios as above.
    My PC configuration:
         java version "1.4.0_01"
         Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
         Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
         JRun 4 (Build 47304)
         WinNT 4.0 SP5
         IE 5.50
         CLASSPATH=.;D:\jakarta-tomcat-3.3.1\lib\common\servlet.jar;
              C:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes
         JAVA_HOME=C:\j2sdk1.4.0_01
         Path=C:\j2sdk1.4.0_01\bin;C:\WINNT\system32;C:\WINNT;
              C:\Program Files\Network Associates\PGPNT;C:\Program Files\MTS;d:\MSSQL7\BINN
    Thank you so much for your expertise.

    Hello,
    I think that you use the import-declarations incorrectly.
    Your code says:
    import com.zswingpackage1;
    ... The meaning of the above declaration is the following: Import the class "zswingpackage1" from the package "com". The compiler cannot find that class, but it is probably never asked to find it in your code, so it won't report an error.
    If you want to import the whole package use the following declaration instead:
    import com.zswingpackage1.*;
    ... That means: import all classes from from the package "com.zswingpackage1".
    You can also import just the classes needed, e.g.:
    import com.zswingpackage1.swing_optgrp_eg1;
    ... I hope that does the job.
    S&oslash;ren

  • Moving a method down the call stack

    This is partially a blazeds question as well, which I have already inquired about there.
    My situation is that I have a consumer.subscribe followed by the rpc, followed by the consumer expected to handle the results of the rpc.  What seems to be happening is a race condition between the subscribe and the rpc call - with the results being returned back before some of teh consumers have finished subscribing.  This is all being handled in one method.  For the most part, it needs to be encapsulated like this because we're using the parsley IoC container.  By creating a new context on a button click, it automatically instantiates and initalizes the consumers.  A retrievedataevent is then fired straight away.
    Is there anyway around this?  I noticed that if i create a Timer and set it to 1 millisecond, it somehow fixes itself.  Does timer somehow drop the current method down the callstack?  Or deprioritize it?
    Thanks in advance.  I'm banging my head against the wall here

    This is the way that Aperture works by design - you just need to get comfortable with album picks, every album can have a different album pick from the same stack, it will be the image that shows up at when the stack is closed.
    These may help
    [Aperture Organization|http://photo.rwboyer.com/2008/07/apple-aperture-21-organization>
    [Aperture Stacks and Albums|http://photo.rwboyer.com/2008/09/aperture-2-organization-tip-more-on-sta cks-and-albums>
    [Aperture Album picks and image versions|http://photo.rwboyer.com/2008/12/aperture-2-quick-tip-album-picks-and- image-versions>
    Maybe even this that explains how Aperture stacks work vs. Lightroom stacks
    [Aperture vs Lightroom stacks|http://photo.rwboyer.com/2008/10/aperture2-vs-lightroom2-stacks>
    RB

  • Retreiving Parameters From The Call Stack

    I'm trying to solve the following:
    I have a procedure:
    procedure widget1(parm1 in varchar2)
    which calls:
    procedure widget2;
    Is there any way that widget 2 can look at a call stack to find out the value of parm1 that was passed to widget 2? If so, how?
    Effectively, widget1 is a procedure invoked by oracle application server, and widget2 is a generic error handler that should log the function that was called and the values of the paramters that were provided. I can get the function off the FORMAT_CALL_STACK routine, but I don't know how/where to find the parameter values.

    Hi,
    You can use SY_CPROG -  caller in external procedures, bye using this u can get the progam name.
    Regards,
    kavitha.k

  • Q. re interpreting the call stack traceback

    I am trying to diagnose a segv crash in our application but All I have to go on is a call stack traceback that was harvested at the time of the crash. This is workshop 4.0 vintage running on Solaris 2.6. The application was built with level 2 optimisation.
    one line of the traceback follows:
    00098de8 CSax_ExchApi::WriteData(CEis_OutMsgContext*)(88f1e4, 539878, 894750, 3a5e8c, 1, 5ae118) + 114
    My questions are:
    1. What does the + 114 signify?
    2. Is it correct that the 1st arg shown (88f1e4) is the value of the this ptr?
    3. Is it correct that the 2nd arg shown (539878) is the value of the parameter?
    4. Do the values of the rest of the args have any significance?
    Thanks

    Apologies all for the mis-post. This belongs in the C++ forum

  • How to get the report name from the call stack

    Hi,
    I have a question about how to get the caller information dynamically in a function module.
    For example.
    ZGET_CALLER_INFORAMTION,
    get the caller name -- how ??
    Thanks in advance
    Best Regards,
    Johnney

    Hi,
    You can use SY_CPROG -  caller in external procedures, bye using this u can get the progam name.
    Regards,
    kavitha.k

  • How to get Refrence of the calling Object in the called method

    Is there any way to achive below without having explicitly passing or storing a's refrence.??
    class A {
    public void run(){
    B b= new B();
    b.doStuff();
    public static void main(String [] args){
    A a = new A();
    a.run();
    class B {
    public void doStuff(){
    /* ??????????? Is it possible to get Instance of A, a's refrence without changing doStuff() signature */
    If not, how does the following join() method of Thread gets the refrence of the Instance of Calling Instance(t1 & t2) , so as to attach the calling Thread at the end of called Thread(t) ??
    class TestThread extends Thread{
    public void run(){
    for (int i=0; i < 10; i++)
         System.out.println("Iteration:"+i+" of TestThread");
    class A extends Thread{
    Thread t;
    public A(Thread t){
    this.t=t;
    public void run(){
    try {
    t.join();
    }catch (InterruptedException e){}
    for (int i=0; i < 10; i++)
         System.out.println("Iteration:"+i+" of A Instance"+this);
    public class Main{
    public static void main(String [] args) {
    TestThread t = new TestThread();
    A t1 = new A(t);
    A t2 = new A(t);
    t1.start();
    t2.start();
    t.start();
    }

    Reposting with markup.
    class A {
        public void run(){
            B b= new B();
            b.doStuff();
        public static void main(String [] args){
            A a = new A();
            a.run();
    class B {
        public void doStuff(){
             * ??????????? Is it possible to get Instance of A, a's
             * refrence without changing doStuff() signature
    }If not, how does the following join() method of Thread gets the refrence of the Instance of Calling Instance(t1 & t2) , so as to attach the calling Thread at the end of called Thread(t) ??
    class TestThread extends Thread{
        public void run(){
            for (int i=0; i < 10; i++) System.out.println("Iteration:"i" of TestThread");
    class A extends Thread{
        Thread t;
        public A(Thread t){
            this.t=t;
        public void run(){
            try {
                t.join();
            }catch (InterruptedException e){}
            for (int i=0; i < 10; i++) System.out.println("Iteration:"i" of A Instance"+this);
    public class Main{
        public static void main(String [] args) {
            TestThread t = new TestThread();
            A t1 = new A(t);
            A t2 = new A(t);
            t1.start();
            t2.start();
            t.start();
    }

  • Unable to access objects under the schema after refresh

    Hi,
    I refreshed one of my schema (XXX) from a Production to QA.
    I checked and found that all the objects have been refreshed correctly.
    But when I try to query the object from the schema, I get the error. ORA-00942: table or view does not exists.
    When I query it using, XXX.table_name -> I get the desired output.
    What am I missing here? Some privileges? Could someone please help me on this?
    Thanks!

    user9104898 wrote:
    Hi,
    I refreshed one of my schema (XXX) from a Production to QA.
    I checked and found that all the objects have been refreshed correctly.
    But when I try to query the object from the schema, I get the error. ORA-00942: table or view does not exists.
    When I query it using, XXX.table_name -> I get the desired output.
    What am I missing here? Some privileges? Could someone please help me on this?
    Thanks!Hi.How you refresh your "XXX" schema from according production schema?,drop and create objects again?.If yes then that is possible because all privileges(in this case object) which related these objects was lost, therefore you get an error as "ORA-00942: table or view does not exists".You have to give grant(select or other) again related these objects to desired users.

  • How do I access objects from the original Thread?

    I have this simple JApplet that just makes a circle bounce around the screen. Here it is:
    import java.awt.Color;
    import javax.swing.JApplet;
    import java.awt.Graphics;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class TestApplet3 extends JApplet implements MouseListener {
        private int lastX;          // x coordinate of circle
        private int lastY;          // y coordinate of circle
        private int d = 15;          // diameter of circle
        public void paint(Graphics g) {
        public void init() {
            addMouseListener(this);
        public void mouseClicked(MouseEvent event) {
            Graphics gx = this.getGraphics();
            for (int x = 0, y = 0, count = 0, horiz = 2, vert = 2, k = 2; count < 1000; x = x + horiz, y = y + vert, count++) {
                if ((x + d) >= 350) {
                    horiz = -horiz;
                if ((x <= 0) && (horiz < 0)) {
                    horiz = -horiz;
                if ((y + d) >= 200) {
                    vert = -vert;
                if ((y <= 0) && (vert < 0)) {
                    vert = -vert;
                gx.setColor(Color.WHITE);
                gx.fillOval(lastX, lastY, d, d);
                gx.setColor(Color.RED);
                lastX = x;
                lastY = y;
                gx.fillOval(lastX, lastY, d, d);
                try {
                    Thread.sleep(20);
                } catch (Exception ex) {
                    System.out.println(ex.getMessage());
        public void mouseEntered(MouseEvent event) {
        public void mouseExited(MouseEvent event) {
        public void mousePressed(MouseEvent event) {
        public void mouseReleased(MouseEvent event) {
    }But now I'd like to change it so that when the mouse is clicked a new Thread is spawned to run the code within the mouseClicked method..... this will allow multiple circles to bounce around and will also keep the applet responsive to new mouse clicks... so I've tried changing it below:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package runninggraph;
    * @author epuknol
    import java.awt.Color;
    import javax.swing.JApplet;
    import java.awt.Graphics;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class TestApplet3 extends JApplet implements MouseListener, Runnable {
        private int lastX;          // x coordinate of circle
        private int lastY;          // y coordinate of circle
        private int d = 15;          // diameter of circle
        public void paint(Graphics g) {
        public void init() {
            addMouseListener(this);
        public void run() {
            Graphics gx = this.getGraphics();
            for (int x = 0, y = 0, count = 0, horiz = 2, vert = 2, k = 2; count < 1000; x = x + horiz, y = y + vert, count++) {
                if ((x + d) >= 350) {
                    horiz = -horiz;
                if ((x <= 0) && (horiz < 0)) {
                    horiz = -horiz;
                if ((y + d) >= 200) {
                    vert = -vert;
                if ((y <= 0) && (vert < 0)) {
                    vert = -vert;
                gx.setColor(Color.WHITE);
                gx.fillOval(lastX, lastY, d, d);
                gx.setColor(Color.RED);
                lastX = x;
                lastY = y;
                gx.fillOval(lastX, lastY, d, d);
                try {
                    Thread.sleep(20);
                } catch (Exception ex) {
                    System.out.println(ex.getMessage());
        public void mouseClicked(MouseEvent event) {
            (new Thread(new TestApplet())).start();       
        public void mouseEntered(MouseEvent event) {
        public void mouseExited(MouseEvent event) {
        public void mousePressed(MouseEvent event) {
        public void mouseReleased(MouseEvent event) {
    }but this doesn't work - I think because the this.getGraphics() doesn't refer back to the same object ..... I've tried some other things too - like defining the Graphics gx as a class variable and initializing it before spawning the new Thread ... but I can't access gx using that technique either.
    Can somebody please help me get where I'm trying to go?
    Thanks.

    Aw heck, got bored. For instance, this draws a bunch of balls without a direct call to Thread anything:
    BouncingCircles.java
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Point;
    import java.awt.RenderingHints;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JPanel;
    import javax.swing.Timer;
    * creates a JPanel that draws bouncing circles within it. 
    * @author Pete
    public class BouncingCircles {
      private static final int DELAY = 15;
      private static final int DIAMETER = 15;
      private static final int DELTA = 5;
      List<Ball> ballList = new ArrayList<Ball>(); // list of all balls
      private JPanel mainPanel = new JPanel() {
        @Override
        protected void paintComponent(Graphics g) {
          super.paintComponent(g);
          myPaint(g);
      // Swing Timer that tells the balls to move and tells the JPanel to then draw them
      private Timer sTimer = new Timer(DELAY, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          timerAction(e);
      public BouncingCircles() {
        mainPanel.setPreferredSize(new Dimension(400, 400));
        mainPanel.addMouseListener(new MouseAdapter() {
          @Override
          // add new ball with each mouse press
          public void mousePressed(MouseEvent e) {
            ballList.add(new Ball(e.getPoint(), new Point(DELTA, DELTA)));
        sTimer.start();
      public JPanel getPanel() {
        return mainPanel;
      private void timerAction(ActionEvent e) {
        Dimension d = mainPanel.getSize();
        for (Ball ball : ballList) {
          if (ball.getPoint().x < 0) {
            ball.setXDirectionRight(true);
          } else if (ball.getPoint().x + DIAMETER > d.width) {
            ball.setXDirectionRight(false);
          if (ball.getPoint().y < 0) {
            ball.setYDirectionDown(true);
          } else if (ball.getPoint().y + DIAMETER > d.height) {
            ball.setYDirectionDown(false);
          ball.increment();
        mainPanel.repaint();
       * paintComponent method draws all balls in List
       * @param g
      private void myPaint(Graphics g) {
        g.setColor(Color.red);
        Graphics2D g2d = (Graphics2D) g;
        RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setRenderingHints(rh);
        for (Ball ball : ballList) {
          g.fillOval(ball.getPoint().x, ball.getPoint().y, DIAMETER, DIAMETER);
      private class Ball {
        private Point point = new Point();
        private Point velocity = new Point();
        public Ball(Point point, Point velocity) {
          this.point = point;
          this.velocity = velocity;
        public Point getPoint() {
          return point;
        public Point getVelocity() {
          return velocity;
        public void increment() {
          point = new Point(point.x + velocity.x, point.y + velocity.y);
        public void setXDirectionRight(boolean right) {
          int newVelocityX = Math.abs(velocity.x);
          if (!right) {
            newVelocityX = -newVelocityX;
          velocity = new Point(newVelocityX, velocity.y);
        public void setYDirectionDown(boolean down) {
          int newVelocityY = Math.abs(velocity.y);
          if (!down) {
            newVelocityY = -newVelocityY;
          velocity = new Point(velocity.x, newVelocityY);
    }And this displays the JPanel produced above in a standard JApplet.
    BouncingCircApplet.java
    import java.lang.reflect.InvocationTargetException;
    import javax.swing.JApplet;
    import javax.swing.SwingUtilities;
    public class BouncingCircApplet extends JApplet {
      @Override
      public void init() {
        try {
          SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
              getContentPane().add(new BouncingCircles().getPanel());
        } catch (InterruptedException e) {
          e.printStackTrace();
        } catch (InvocationTargetException e) {
          e.printStackTrace();
    }

  • Access object on the stage using an as3 widget

    I am trying to use a FlashPro as3 widget and Captivate 6, to toggle an image on the Captivate stage (hide/show) and can't find enough information on how to access the stage objects.
    I can use 
    var numKids:int = parent.parent.parent.numChildren() 
    to see the number of children (of the stage object?) , but can't seem to figure out how to hide or show the child objects (image, button or anything).
    My image names in my Captivate Project are Img_Einstein1 and Img_Einstein2.  They reside on a blank slide along with two buttons and another widget.
    I have looked at Tristen's web site and found a lot of useful information, but I guess I am just not putting it all together.  Because I am a contractor I can't use the Widget Factory or purchase outside widgets.
    Any help will be greatly appreciated!

    On 6 you don't have shared actions yet. I don't understand the explanation with 20 and 10. There are several examples of toggle buttons on my blog. For showing/hiding here a simple one:
    http://blog.lilybiri.com/blog-after-posterous-clickclick

Maybe you are looking for

  • Bottom right corner resize controls trump vertical scroll button if set to appear in the bottom corner

    My bottom right corner square of the Firefox window normally sits below the bottom of the vertical scroll bar and right of the horizontal scroll bar if one exists. The square is used to click and drag to resize the window's right and bottom boundarie

  • Knowledge on Transaction log ?

    Hi All, I have couple of questions? Question-1: I need to know will running import/export wizard increase the T-log growth? OR will running simple select statement increase the T-log. To my little knowledge data modification (insert, update, or delet

  • Come faccio a fare funzionare digital av adapter nel ipad 2

    Ho aquistato l' adattatore digitale av,quando lo collego al mio iPad 2 mi appare la scritta (accesorio non supportato) questo accessorio richiede un aggiornamento iOS.Ho provato ad aggiornarlo ma non va lo stesso, sapete cosa posso fare? grazie!

  • Oracle Express and regedit

    Hi! I installed Oracle Express on Windows XP and I want to use PL/SQL Developer (could be any other tool) to develop with pl/sql. But I realize that the Express installation does not creates the usual HOME0 or HOME1 nor ALL_HOMES Oracle entries in th

  • Does anyone know how they did this?

    The images that cycle through on the top of this page:  http://www.fsu.edu/ There is a transparency "curtain" that is used to transition between the images.  Does anyone have any suggestions on how this can be replicated? Thanks, kyle.