Non-graphical event handling

Hi
I want to make an Object listen to an Event created by another Object, I mean :
Object1 --- Event ---> Object2 ---method---> Finish
so that Object1 is an instance of a class A, Object2 an instance of a class B, and when A creates an Event "CalculDone", B receives it and starts the AfterCalculIsDone method. Unfortunately I don't know how I can handle events that are not created by components but that are created by not-in-a-GUI running code. Could you help me ?

Ok, the thing is, when you say "event" in java, we're specifically referring to GUI stuff. like without events, how would we find out when a button was pressed, etc. it doesn't make sense in java to talk about events outside of that area, as far as I know.
what im thinking is, you need an algorithm that needs to call certain methods upon certain things happening. honeslty, maybe i'm being dense but I still can't understand why you can't say this:
if(test_your_constraint)
call_all_the_other_methods_that_should_know_about_this_to_update_their_class_info
but I'm thinking that if that's not what you're talking about maybe you're talking about a branching algorithm or a backtracking algorithm. ie. when you find out certain constraints, you're equations need to take a different direction or when you find out they're going in the wrong direction, backtrack to start a new way.
btw, what's your programming background, maybe that'll help me figure out what you need.

Similar Messages

  • Event Handling for Graphic Shapes

    Hi guys,
    I have a problem on the implementation of a piece of software that i'm making, to be more specific i implement a GUI. In this GUI i draw rectangles, lines and that kind of things.
    The problem is that i want when clicking on a rectangle, an event to take place such as the drawing of something else, or a message, etc.
    How am i to achieve that? I've tried many things but didn't succeeded it unfortunately. How am i going to "give" life to my rectangles by adding event handling for them? What code should i write?
    Note: My class extends JPanel & i'm using paint(Graphics g) for drawing the shapes
    Thanks,
    John.

    Try this:
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.util.*;
    public class Shapes extends JFrame
         DPanel pan = new DPanel();
    public Shapes()
         addWindowListener(new WindowAdapter()
              public void windowClosing(WindowEvent ev)
                   dispose();
                   System.exit(0);
         setBounds(10,10,400,350); 
         setContentPane(pan);
         setVisible(true);
    public class DPanel extends JPanel implements MouseListener
         Vector shapes = new Vector();
         Shape  cs;
    public DPanel()
         addMouseListener(this);
         shapes.add(new Rectangle(20,20,100,40));
         shapes.add(new Rectangle(40,80,130,60));
         shapes.add(new Line2D.Double(20,150,200,180));
    public void paintComponent(Graphics g)
         super.paintComponent(g);
         Graphics2D g2 = (Graphics2D)g;
         for (int j=0; j < shapes.size(); j++)
              g2.draw((Shape)shapes.get(j));
         g.setColor(Color.red);
         if (cs != null) g2.draw(cs);
    public void mouseClicked(MouseEvent m) {}
    public void mouseEntered(MouseEvent m) {}
    public void mouseExited(MouseEvent m)  {}
    public void mouseReleased(MouseEvent m){}
    public void mousePressed(MouseEvent m)
         for (int j=0; j < shapes.size(); j++)
              Shape s = (Shape)shapes.get(j);
              Rectangle r = new Rectangle(m.getX()-1,m.getY()-1,2,2);
              if (s.intersects(r))
                   cs = s;
                   repaint();
    public static void main (String[] args) 
          new Shapes();
    }Noah

  • Test of Web Dynpro Event Handling : GeoMap business graphics

    Hy guru's, i have this problem: on Test of Web Dynpro Event Handling page i tried to open the GeoMap web dynpro on Business Graphics section but i received this error:
    The URL http://.../sap/bc/webdynpro/sap/wdr_test_events/ was not called due to an error.
    Note
    The following error text was processed in the system BI7 : Exception condition "COMMUNICATION_ERROR" raised.
    The error occurred on the application server bi7-saplab_BI7_08 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: IF_GIS_VIEW~UPDATE of program CL_GIS_VIEW_IGS===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LBUSINESS_GRAPHICS======CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP
    What can I do?
    If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system BI7 in transaction ST22.
    If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server bi7-saplab_BI7_08 in transaction SM21.
    If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 0 in transaction ST11 on the application server bi7-saplab_BI7_08 . In some situations, you may also need to analyze the trace files of other work processes.
    If you do not yet have a user ID, contact your system administrator.
    Error code: ICF-IE-http -c: 100 -u: AMARAVIGLIA -l: E -s: BI7 -i: bi7-saplab_BI7_08 -w: 0 -d: 20071119 -t: 232916 -v: RABAX_STATE -e: RAISE_EXCEPTION
    HTTP 500 - Internal Server Error
    Your SAP Internet Communication Framework Team
    Could you help me?
    Thank's a lot
    Sincerely yours
    Andrea Maraviglia

    Hi,
    did you install the IGS (see the <a href="http://help.sap.com/saphelp_nw70/helpdata/en/37/268841a79f1609e10000000a155106/frameset.htm">documentation</a>) and check if SAP note 1108034 helps?
    Regards, Heidi

  • Where can I find an event handling for non gui purposes good tutorial

    Hello to all, I am searching the net for a good tutorial about java Event and Event handling that is not GUI related.
    All I find on the net are tutorial and examples that are related to GUI components the has pre defined events and handlers.
    please help me find good material to learn from.
    Appreciate it a lot.
    Dan

    I'd say goto the Java tutorial (www.thejavatutorial.com) and check up from there. Just because most event handleing is done in GUI's (swing comes to mind) doesn't imply its limited to that. For an example, check out the JavaBeans trail. Beans have ways to communicate with each other when (for example) a change in the bean occurs. Thats done through an event yet isn't related to GUI's in any way.

  • Event Handler not Working

    Salutations!
    My College teacher was telling me about flash builder and how good it is for mobile applications. I've never done anything with actionscript before and had my first foray into such a few days ago. However I quickly ran into a problem. I've drawn a rectangle and are now wanting to try and use event handlers. For now I was wanting to say add the event handler for clicking on the rectangle. When done so then run a specifed function.
    rectangle.addEventListener(MouseEvent.CLICK, RectClicked);
    But even though there is nothing wrong anywhere in my application upon clicking the first rectangle, nothing happens. This is true for other mouse and keyboard events. My teacher said it may have something to do with having the student flash builder at College and currently having the trial here at home. It may not allow you to use certain functions.
    Do I have to purchase flash builder first before being able to use certain functionality?

    Ah... with all due respect, I think your teacher is wrong. To disable event handling would be somewhat traumatic for Flash which uses event handling as the core of its functionality. In any case, I am not aware of any functions being disabled on a trial version.
    It is far more likey to be a coding error on your part, sorry. There are a number of possibilities:
    1. You may have drawn a rectangle as a primitive (eg <s:Rect />) or as a Shape - both of which are IEventDispatcher but neither of which dispatch mouse events.
    2. You may have added the listener at the wrong point in the timeline so that the listener isn't there when you click.
    3. Some other, unspecified coding error...
    I imagine the first possibility is the most likely.
    Here is a simple pure actionscript clicker:
    [code]
    package
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    public class Clicker extends Sprite
      public function Clicker()
       var s:Sprite = new Sprite();
       s.graphics.beginFill(0xff,1);
       s.graphics.drawRect(0,0,50,50);
       s.x = s.y = 50;
       addChild(s);
       s.addEventListener(MouseEvent.CLICK,rectClicked);
      protected function rectClicked(event:MouseEvent):void {
       trace("Rectangle was clicked.");
    [/code]
    And here is the same in Flex:
    [code]
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
    <fx:Script>
      <![CDATA[
       import mx.graphics.SolidColor;
       protected function group1_clickHandler(event:MouseEvent):void
        trace("Rectangle was clicked.");
      ]]>
    </fx:Script>
    <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Group x="50" y="50" click="group1_clickHandler(event)">
      <s:Rect width="50" height="50" fill="{new SolidColor(0xff,1)}" />
    </s:Group>
    </s:Application>
    [/code]
    G

  • Swing: when trying to get the values from a JTable inside an event handler

    Hi,
    I am trying to write a graphical interface to compute the Gauss Elimination procedure for solving linear systems. The class for computing the output of a linear system already works fine on console mode, but I am fighting a little bit to make it work with Swing.
    I put two buttons (plus labels) and a JTextField . The buttons have the following role:
    One of them gets the value from the JTextField and it will be used to the system dimension. The other should compute the solution. I also added a JTable so that the user can type the values in the screen.
    So whenever the user hits the button Dimensiona the program should retrieve the values from the table cells and pass them to a 2D Array. However, the program throws a NullPointerException when I try to
    do it. I have put the code for copying this Matrix inside a method and I call it from the inner class event handler.
    I would thank you very much for the help.
    Daniel V. Gomes
    here goes the code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import AdvanceMath.*;
    public class MathF2 extends JFrame {
    private JTextField ArrayOfFields[];
    private JTextField DimOfSis;
    private JButton Calcular;
    private JButton Ativar;
    private JLabel label1;
    private JLabel label2;
    private Container container;
    private int value;
    private JTable DataTable;
    private double[][] A;
    private double[] B;
    private boolean dimensionado = false;
    private boolean podecalc = false;
    public MathF2 (){
    super("Math Calcs");
    Container container = getContentPane();
    container.setLayout( new FlowLayout(FlowLayout.CENTER) );
    Calcular = new JButton("Resolver");
    Calcular.setEnabled(false);
    Ativar = new JButton("Dimensionar");
    label1 = new JLabel("Clique no bot�o para resolver o sistema.");
    label2 = new JLabel("Qual a ordem do sistema?");
    DimOfSis = new JTextField(4);
    DimOfSis.setText("0");
    JTable DataTable = new JTable(10,10);
    container.add(label2);
    container.add(DimOfSis);
    container.add(Ativar);
    container.add(label1);
    container.add(Calcular);
    container.add(DataTable);
    for ( int i = 0; i < 10 ; i ++ ){
    for ( int j = 0 ; j < 10 ; j++) {
    DataTable.setValueAt("0",i,j);
    myHandler handler = new myHandler();
    Calcular.addActionListener(handler);
    Ativar.addActionListener(handler);
    setSize( 500 , 500 );
    setVisible( true );
    public static void main ( String args[] ){
    MathF2 application = new MathF2();
    application.addWindowListener(
    new WindowAdapter(){
    public void windowClosing (WindowEvent event)
    System.exit( 0 );
    private class myHandler implements ActionListener {
    public void actionPerformed ( ActionEvent event ){
    if ( event.getSource()== Calcular ) {
    if ( event.getSource()== Ativar ) {
    //dimensiona a Matriz A
    if (dimensionado == false) {
    if (DimOfSis.getText()=="0") {
    value = 2;
    } else {
    value = Integer.parseInt(DimOfSis.getText());
    dimensionado = true;
    Ativar.setEnabled(false);
    System.out.println(value);
    } else {
    Ativar.setEnabled(false);
    Calcular.setEnabled(true);
    podecalc = true;
    try {
    InitValores( DataTable, value );
    } catch (Exception e) {
    System.out.println("Erro ao criar matriz" + e );
    private class myHandler2 implements ItemListener {
    public void itemStateChanged( ItemEvent event ){
    private void InitValores( JTable table, int n ) {
    A = new double[n][n];
    B = new double[n];
    javax.swing.table.TableModel model = table.getModel();
    for ( int i = 0 ; i < n ; i++ ){
    for (int j = 0 ; j < n ; j++ ){
    Object temp1 = model.getValueAt(i,j);
    String temp2 = String.valueOf(temp1);
    A[i][j] = Double.parseDouble(temp2);

    What I did is set up a :
    // This code will setup a listener for the table to handle a selection
    players.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = players.getSelectionModel();
    rowSM.addListSelectionListener(new Delete_Player_row_Selection(this));
    //Class will take the event and call a method inside the Delete_Player object.
    class Delete_Player_row_Selection
    implements javax.swing.event.ListSelectionListener
    Delete_Player adaptee;
    Delete_Player_row_Selection (Delete_Player temp)
    adaptee = temp;
    public void valueChanged (ListSelectionEvent listSelectionEvent)
    adaptee.row_Selection(listSelectionEvent);
    in the row_Selection function
    if(ex.getValueIsAdjusting()) //To remove double selection
    return;
    ListSelectionModel lsm = (ListSelectionModel) ex.getSource();
    if(lsm.isSelectionEmpty())
    System.out.println("EMtpy");
    else
    int selected_row = lsm.getMinSelectionIndex();
    ResultSetTableModel model = (ResultSetTableModel) players.getModel();
    String name = (String) model.getValueAt(selected_row, 1);
    Integer id = (Integer) model.getValueAt(selected_row, 3);
    This is how I got info out of a table when the user selected it

  • Applet Event Handler

    Would someone please help me. I am new to applet development and I get a compile error associated with the event handling in my first ever applet code as follows:
    C:\j2sdk1.4.2_01\bin>javac trajectory_j.java
    trajectory_j.java:248: illegal start of expression
    private class Handler implements ActionListener {
    ^
    trajectory_j.java:248: ';' expected
    private class Handler implements ActionListener {
    ^
    2 errors
    de.
    This is the code:
    // trajectory Analysis Program: trajectory_j.java
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class trajectory_j extends JApplet implements ActionListener {
         private JTextArea introductionArea, resultsArea;
         private JLabel spanLabel, chordLabel,
              thicknessLabel, massLabel, altitudeLabel, velocityLabel,
              trajectory_angleLabel, time_incrementLabel, rotation_factorLabel,
              calculationLabel, resultsLabel;
         private JTextField spanField, chordField, thicknessField,
              massField, altitudeField, velocityField, trajectory_angleField,
              time_incrementField, rotation_factorField;
         private JButton startButton, resetButton, contButton, termButton;
         String introduction_string, span_string, chord_string, thickness_string, mass_string,
              altitude_string, velocity_string, trajectory_angle_string,
              time_increment_string, rotation_factor_string, results_string;
         double span, chord, thickness, mass, altitude, velocity, trajectory_angle, time_increment,
              rotation_factor, distance, velocity_fps, elapsed_time;
         int status_a;
         int status_b;
         int status_c;
    /* deletion of code segment a
              span = 0;
              chord = 0;
              thickness = 0;
              mass = 0;
              altitude = 0;
              velocity = 0;
              trajectory_angle = 0;
              time_increment = 0;
              rotation_factor = 0;
              distance = 0;
              velocity_fps = 0;
              elapsed_time = 0;
              velocity_fps = 0;
              elapsed_time = 0;
         // create objects
         public void init()
              status_a = 0;
              status_b = 0;
              status_c = 0;
              // create container & panel
              Container container = getContentPane();     
              Panel panel = new Panel( new FlowLayout( FlowLayout.LEFT));
              container.add( panel );
              // set up vertical boxlayout
              Box box = Box.createVerticalBox();
              Box inputbox1 = Box.createHorizontalBox();
              Box inputbox2 = Box.createHorizontalBox();
              Box inputbox3 = Box.createHorizontalBox();
              Box buttonbox = Box.createHorizontalBox();
              introduction_string = "This is the introduction";
              // set up introduction
              introductionArea = new JTextArea( introduction_string, 10, 50 );
              introductionArea.setEditable( false );
              box.add( new JScrollPane( introductionArea ) );
              box.add( Box.createVerticalStrut (10) );
              box.add( inputbox1);
              // set up span
              spanLabel = new JLabel( "span (feet)" );
              spanField = new JTextField(5 );
              inputbox1.add( spanLabel );
              inputbox1.add( spanField );
              Dimension minSize = new Dimension(5, 15);
              Dimension prefSize = new Dimension(5, 15);
              Dimension maxSize = new Dimension(Short.MAX_VALUE, 15);
              inputbox1.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up chord
              chordLabel = new JLabel( "chord (feet)" );
              chordField = new JTextField(5 );
              inputbox1.add( chordLabel );
              inputbox1.add( chordField );
              inputbox1.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up thickness
              thicknessLabel = new JLabel( "thickness (feet)" );
              thicknessField = new JTextField(5 );
              inputbox1.add( thicknessLabel );
              inputbox1.add( thicknessField );
              inputbox1.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up mass
              massLabel = new JLabel( "mass (slugs)" );
              massField = new JTextField(5);
              inputbox1.add( massLabel );
              inputbox1.add( massField );
              box.add( Box.createVerticalStrut (10) );
              box.add( inputbox2);
              // set up altitude
              altitudeLabel = new JLabel( "altitude (feet)");
              altitudeField = new JTextField(5 );
              inputbox2.add( altitudeLabel );
              inputbox2.add( altitudeField );
              inputbox2.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up velocity
              velocityLabel = new JLabel( "velocity (Mach Number)");
              velocityField = new JTextField(5);
              inputbox2.add( velocityLabel );
              inputbox2.add( velocityField );
              inputbox2.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up trajectory_angle
              trajectory_angleLabel = new JLabel( "trajectory angle ( -90 degrees <= trajectory angle <= 90 degrees )");
              trajectory_angleField = new JTextField(5);
              inputbox2.add( trajectory_angleLabel );
              inputbox2.add( trajectory_angleField );
              box.add( Box.createVerticalStrut (10) );
              box.add( inputbox3);
              Dimension minSizeF = new Dimension(70, 15);
              Dimension prefSizeF = new Dimension(70, 15);
              Dimension maxSizeF = new Dimension(Short.MAX_VALUE, 15);
              inputbox3.add(new Box.Filler(minSizeF, prefSizeF, maxSizeF));
              // set up time_increment
              time_incrementLabel = new JLabel( "time increment (seconds)" );
              time_incrementField = new JTextField(5);
              inputbox3.add( time_incrementLabel );
              inputbox3.add( time_incrementField );
              inputbox3.add(new Box.Filler(minSizeF, prefSizeF, maxSizeF));
              // set up rotation_factor
              rotation_factorLabel = new JLabel( "rotation factor ( non-negative number)" );
              rotation_factorField = new JTextField(5);
              inputbox3.add( rotation_factorLabel );
              inputbox3.add( rotation_factorField );
              inputbox3.add(new Box.Filler(minSizeF, prefSizeF, maxSizeF));
              box.add( Box.createVerticalStrut (10) );
              box.add( buttonbox);
              // set up start
              startButton = new JButton( "START" );
              buttonbox.add( startButton );
              Dimension minSizeB = new Dimension(10, 30);
              Dimension prefSizeB = new Dimension(10, 30);
              Dimension maxSizeB = new Dimension(Short.MAX_VALUE, 30);
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up reset
              resetButton = new JButton( "RESET" );
              buttonbox.add( resetButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up cont
              contButton = new JButton( "CONTINUE" );
              buttonbox.add( contButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up term
              termButton = new JButton( "END" );
              buttonbox.add( termButton );
              box.add( Box.createVerticalStrut (10) );          
              // set up results
              resultsArea = new JTextArea( results_string, 10, 50 );
              resultsArea.setEditable( false );
              box.add( new JScrollPane( resultsArea ) );
              // add box to panel
              panel.add( box );
              // register event handlers
              Handler handler = new Handler();
              spanField.addActionListener( handler );
              chordField.addActionListener( handler );          
              thicknessField.addActionListener( handler );
              massField.addActionListener( handler );
              altitudeField.addActionListener( handler );
              velocityField.addActionListener( handler );          
              trajectory_angleField.addActionListener( handler );
              time_incrementField.addActionListener( handler );
              rotation_factorField.addActionListener( handler );
              startButton.addActionListener( handler );
              resetButton.addActionListener( handler );
              contButton.addActionListener( handler );
              termButton.addActionListener( handler );
    // private inner class for event handling
    private class Handler implements ActionListener {
         // process handler events
         public void actionPerformed( ActionEvent event )
              // process resetButton event
              if ( event.getSource() == resetButton )
                   reset();
              // process contButton event
              if ( event.getSource() == contButton )
                   cont();
              // process endButton event
              if ( event.getSource() == termButton )
              // process span event
              if( event.getSource() == spanField ) {
                   span = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( span_string );
                   status_b++;
              // process chord event
              if( event.getSource() == spanField ) {
                   span = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( chord_string );
                   status_b++;     
              // process thickness event
              if( event.getSource() == thicknessField ) {
                   thickness = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( thickness_string );     
                   status_b++;
              // process mass event
              if( event.getSource() == massField ) {
                   mass = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( mass_string );
                   status_b++;     
              // process altitude event
              if( event.getSource() == altitudeField ) {
                   altitude = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( altitude_string );     
                   status_b++;
              // process velocity event
              if( event.getSource() == velocityField ) {
                   velocity = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( velocity_string );
                   status_b++;
              // process trajectory_angle event
              if( event.getSource() == trajectory_angleField ) {
                   trajectory_angle = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( trajectory_angle_string );
                   status_b++;
              // process time_increment event
              if( event.getSource() == time_incrementField ) {
                   time_increment = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( time_increment_string );
                   status_b++;
              // process rotation_factor event
              if( event.getSource() == rotation_factorField ) {
                   rotation_factor = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( rotation_factor_string );
                   status_b++;
              // process startButton event
              if ( event.getSource() == startButton && status_b == 9 ) {
                   status_c = 1;
         } // end method event handler
    } // end Handler class
         } // end method init
         public void strtb()
    /* deletion of code segment 1
              startButton.addActionListener(
                   new ActionListener() {  // anonymous inner class
                        // set text in resultsArea
                        public void actionPerformed( ActionEvent event )
                        if( status_c == 1 ){
                        calculate();
                        results();
                        resultsArea.setText( results() );
    /* deletion of code segment 2                    
                        }// end method actionPerformed1
                   } // end anonymous inner class1
              ); // end call to addActionlistener1
         } // end method strtb
         public void reset()
    /* deletion of code segment 3
              resetButton.addActionListener(
                   new ActionListener() {  // anonymous inner class
                        // set text in resultsArea
                        public void actionPerformed( ActionEvent event )
                        span_string = "";
                        chord_string = "";
                        thickness_string = "";
                        mass_string = "";
                        altitude_string = "";
                        velocity_string = "";
                        trajectory_angle_string = "";
                        time_increment_string = "";
                        rotation_factor_string = "";
                        results_string = "";
                        spanField.setText( span_string );
                        chordField.setText( chord_string );
                        thicknessField.setText( thickness_string );
                        massField.setText( mass_string );
                        altitudeField.setText( altitude_string );
                        velocityField.setText( velocity_string );
                        trajectory_angleField.setText( trajectory_angle_string );
                        time_incrementField.setText( time_increment_string );
                        rotation_factorField.setText( rotation_factor_string );
    resultsArea.setEditable( true );
                        resultsArea.setText( results_string );
    resultsArea.setEditable( false );
                        span = 0;
                        chord = 0;
                        thickness = 0;
                        mass = 0;
                        altitude = 0;
                        velocity = 0;
                        trajectory_angle = 0;
                        time_increment = 0;
                        rotation_factor = 0;
                        distance = 0;
                        velocity_fps = 0;
                        elapsed_time = 0;
    /* deletion of code segment 4               
                        } // end method actionPerformed2
                   } // end anonymous inner class2
              ); // end call to addActionlistener2
         } // end method reset
         public void cont()
         //later
         public void calculate()
         distance = 1;
         altitude = 2;
         trajectory_angle = 3;
         velocity_fps = 4;
         elapsed_time = 5;
         public String results()
         results_string =
         "Distance =\t\t" + distance + " miles\n"
         + "Altitude =\t\t" + altitude + " feet\n"
         + "Trajectory Angle =\t" + trajectory_angle + " degrees\n"
         + "Velocity =\t\t" + velocity_fps + " feet per second\n"
         + "Elapsed Time =\t\t" + elapsed_time + " seconds\n"
         + "\nstatus_a = " + status_a + "\nstatus_b = "
         + status_b + "\nstatus_c = " + status_c;
         return results_string;
    public void start()
    if(status_a == 0 )
    strtb();
    if (status_b == 0)
    reset();
    }// end method start
    } //end class trajectory_a

    The following are copies of html and java source code files for a prior runnable version ( trajectory_b ) of this program which can enlighten some functionality intended by the program.
    (trajectory_b.html):
    <html>
    <appletcode = "trajectory_b.class" width = "800" height = "600">
    </applet>
    </html>
    (trajectory_b.java):
    // trajectory Analysis Program: trajectory_b.java
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class trajectory_b extends JApplet implements ActionListener {
         private JTextArea introductionArea, resultsArea;
         private JLabel spanLabel, chordLabel,
              thicknessLabel, massLabel, altitudeLabel, velocityLabel,
              trajectory_angleLabel, time_incrementLabel, rotation_factorLabel,
              calculationLabel, resultsLabel;
         private JTextField spanField, chordField, thicknessField,
              massField, altitudeField, velocityField, trajectory_angleField,
              time_incrementField, rotation_factorField;
         private JButton startButton, resetButton, contButton, termButton;
         String introduction_string, span_string, chord_string, thickness_string, mass_string,
              altitude_string, velocity_string, trajectory_angle_string,
              time_increment_string, rotation_factor_string, results_string;
         double span, chord, thickness, mass, altitude, velocity, trajectory_angle, time_increment,
              rotation_factor, distance, velocity_fps, elapsed_time;
         int status_a;
         int status_b;
         int status_c;
    /* deletion of code segment a
              span = 0;
              chord = 0;
              thickness = 0;
              mass = 0;
              altitude = 0;
              velocity = 0;
              trajectory_angle = 0;
              time_increment = 0;
              rotation_factor = 0;
              distance = 0;
              velocity_fps = 0;
              elapsed_time = 0;
              velocity_fps = 0;
              elapsed_time = 0;
         // create objects
         public void init()
              status_a = 0;
              status_b = 0;
              status_c = 0;
              // create container & panel
              Container container = getContentPane();     
              Panel panel = new Panel( new FlowLayout( FlowLayout.LEFT));
              container.add( panel );
              // set up vertical boxlayout
              Box box = Box.createVerticalBox();
              Box inputbox1 = Box.createHorizontalBox();
              Box inputbox2 = Box.createHorizontalBox();
              Box inputbox3 = Box.createHorizontalBox();
              Box buttonbox = Box.createHorizontalBox();
              introduction_string = "This is the introduction";
              // set up introduction
              introductionArea = new JTextArea( introduction_string, 10, 50 );
              introductionArea.setEditable( false );
              box.add( new JScrollPane( introductionArea ) );
              box.add( Box.createVerticalStrut (10) );
              box.add( inputbox1);
              // set up span
              spanLabel = new JLabel( "span (feet)" );
              spanField = new JTextField(5 );
              inputbox1.add( spanLabel );
              inputbox1.add( spanField );
              Dimension minSize = new Dimension(5, 15);
              Dimension prefSize = new Dimension(5, 15);
              Dimension maxSize = new Dimension(Short.MAX_VALUE, 15);
              inputbox1.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up chord
              chordLabel = new JLabel( "chord (feet)" );
              chordField = new JTextField(5 );
              inputbox1.add( chordLabel );
              inputbox1.add( chordField );
              inputbox1.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up thickness
              thicknessLabel = new JLabel( "thickness (feet)" );
              thicknessField = new JTextField(5 );
              inputbox1.add( thicknessLabel );
              inputbox1.add( thicknessField );
              inputbox1.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up mass
              massLabel = new JLabel( "mass (slugs)" );
              massField = new JTextField(5);
              inputbox1.add( massLabel );
              inputbox1.add( massField );
              box.add( Box.createVerticalStrut (10) );
              box.add( inputbox2);
              // set up altitude
              altitudeLabel = new JLabel( "altitude (feet)");
              altitudeField = new JTextField(5 );
              inputbox2.add( altitudeLabel );
              inputbox2.add( altitudeField );
              inputbox2.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up velocity
              velocityLabel = new JLabel( "velocity (Mach Number)");
              velocityField = new JTextField(5);
              inputbox2.add( velocityLabel );
              inputbox2.add( velocityField );
              inputbox2.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up trajectory_angle
              trajectory_angleLabel = new JLabel( "trajectory angle ( -90 degrees <= trajectory angle <= 90 degrees )");
              trajectory_angleField = new JTextField(5);
              inputbox2.add( trajectory_angleLabel );
              inputbox2.add( trajectory_angleField );
              box.add( Box.createVerticalStrut (10) );
              box.add( inputbox3);
              Dimension minSizeF = new Dimension(70, 15);
              Dimension prefSizeF = new Dimension(70, 15);
              Dimension maxSizeF = new Dimension(Short.MAX_VALUE, 15);
              inputbox3.add(new Box.Filler(minSizeF, prefSizeF, maxSizeF));
              // set up time_increment
              time_incrementLabel = new JLabel( "time increment (seconds)" );
              time_incrementField = new JTextField(5);
              inputbox3.add( time_incrementLabel );
              inputbox3.add( time_incrementField );
              inputbox3.add(new Box.Filler(minSizeF, prefSizeF, maxSizeF));
              // set up rotation_factor
              rotation_factorLabel = new JLabel( "rotation factor ( non-negative number)" );
              rotation_factorField = new JTextField(5);
              inputbox3.add( rotation_factorLabel );
              inputbox3.add( rotation_factorField );
              inputbox3.add(new Box.Filler(minSizeF, prefSizeF, maxSizeF));
              box.add( Box.createVerticalStrut (10) );
              box.add( buttonbox);
              // set up start
              startButton = new JButton( "START" );
              buttonbox.add( startButton );
              Dimension minSizeB = new Dimension(10, 30);
              Dimension prefSizeB = new Dimension(10, 30);
              Dimension maxSizeB = new Dimension(Short.MAX_VALUE, 30);
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up reset
              resetButton = new JButton( "RESET" );
              buttonbox.add( resetButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up cont
              contButton = new JButton( "CONTINUE" );
              buttonbox.add( contButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up term
              termButton = new JButton( "END" );
              buttonbox.add( termButton );
              box.add( Box.createVerticalStrut (10) );          
              // set up results
              resultsArea = new JTextArea( results_string, 10, 50 );
              resultsArea.setEditable( false );
              box.add( new JScrollPane( resultsArea ) );
              // add box to panel
              panel.add( box );
              // register event handlers
              Handler handler = new Handler();
              spanField.addActionListener( handler );
              chordField.addActionListener( handler );          
              thicknessField.addActionListener( handler );
              massField.addActionListener( handler );
              altitudeField.addActionListener( handler );
              velocityField.addActionListener( handler );          
              trajectory_angleField.addActionListener( handler );
              time_incrementField.addActionListener( handler );
              rotation_factorField.addActionListener( handler );
              startButton.addActionListener( handler );
              resetButton.addActionListener( handler );
              contButton.addActionListener( handler );
              termButton.addActionListener( handler );
    } // end method init
         // process handler events
         public void actionPerformed( ActionEvent event )
              // process resetButton event
              if ( event.getSource() == resetButton )
                   reset();
              // process contButton event
              if ( event.getSource() == contButton )
                   cont();
              // process endButton event
              if ( event.getSource() == termButton )
              // process span event
              if( event.getSource() == spanField ) {
                   span = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( span_string );
                   status_b++;
              // process chord event
              if( event.getSource() == spanField ) {
                   span = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( chord_string );
                   status_b++;     
              // process thickness event
              if( event.getSource() == thicknessField ) {
                   thickness = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( thickness_string );     
                   status_b++;
              // process mass event
              if( event.getSource() == massField ) {
                   mass = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( mass_string );
                   status_b++;     
              // process altitude event
              if( event.getSource() == altitudeField ) {
                   altitude = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( altitude_string );     
                   status_b++;
              // process velocity event
              if( event.getSource() == velocityField ) {
                   velocity = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( velocity_string );
                   status_b++;
              // process trajectory_angle event
              if( event.getSource() == trajectory_angleField ) {
                   trajectory_angle = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( trajectory_angle_string );
                   status_b++;
              // process time_increment event
              if( event.getSource() == time_incrementField ) {
                   time_increment = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( time_increment_string );
                   status_b++;
              // process rotation_factor event
              if( event.getSource() == rotation_factorField ) {
                   rotation_factor = Double.parseDouble( event.getActionCommand() );
                   spanField.setText( rotation_factor_string );
                   status_b++;
              // process startButton event
              if ( event.getSource() == startButton && status_b == 9 ) {
                   strtb();
         } // end method event handler
         public void strtb()
              startButton.addActionListener(
                   new ActionListener() {  // anonymous inner class
                        // set text in resultsArea
                        public void actionPerformed( ActionEvent event )
                        calculate();
                        results();
                        resultsArea.setText( results() );
                        }// end method actionPerformed1
                   } // end anonymous inner class1
              ); // end call to addActionlistener1
         } // end method strtb
         public void reset()
              resetButton.addActionListener(
                   new ActionListener() {  // anonymous inner class
                        // set text in resultsArea
                        public void actionPerformed( ActionEvent event )
                        span_string = "";
                        chord_string = "";
                        thickness_string = "";
                        mass_string = "";
                        altitude_string = "";
                        velocity_string = "";
                        trajectory_angle_string = "";
                        time_increment_string = "";
                        rotation_factor_string = "";
                        results_string = "";
                        spanField.setText( span_string );
                        chordField.setText( chord_string );
                        thicknessField.setText( thickness_string );
                        massField.setText( mass_string );
                        altitudeField.setText( altitude_string );
                        velocityField.setText( velocity_string );
                        trajectory_angleField.setText( trajectory_angle_string );
                        time_incrementField.setText( time_increment_string );
                        rotation_factorField.setText( rotation_factor_string );
    resultsArea.setEditable( true );
                        resultsArea.setText( results_string );
    resultsArea.setEditable( false );
                        span = 0;
                        chord = 0;
                        thickness = 0;
                        mass = 0;
                        altitude = 0;
                        velocity = 0;
                        trajectory_angle = 0;
                        time_increment = 0;
                        rotation_factor = 0;
                        distance = 0;
                        velocity_fps = 0;
                        elapsed_time = 0;
                        } // end method actionPerformed2
                   } // end anonymous inner class2
              ); // end call to addActionlistener2
         } // end method reset
         public void cont()
         //later
         public void calculate()
         distance = 1;
         altitude = 2;
         trajectory_angle = 3;
         velocity_fps = 4;
         elapsed_time = 5;
         public String results()
         results_string =
         "Distance =\t\t" + distance + " miles\n"
         + "Altitude =\t\t" + altitude + " feet\n"
         + "Trajectory Angle =\t" + trajectory_angle + " degrees\n"
         + "Velocity =\t\t" + velocity_fps + " feet per second\n"
         + "Elapsed Time =\t\t" + elapsed_time + " seconds\n"
         + "\nstatus_a = " + status_a + "\nstatus_b = "
         + status_b + "\nstatus_c = " + status_c;
         return results_string;
    public void start()
    if(status_a == 0 )
    strtb();
    if (status_b == 0)
    reset();
    }// end method start
    } //end class trajectory_b

  • Event Handling in Fullscreen Exclusive Mode???????

    WIndows XP SP2
    ATI 8500 All-In-Wonder
    JDK 1.6
    800x600 32dpi 200 refresh
    1-6 buffer strategy.
    the graphic rendering thread DOESN'T sleep.
    Here's my problem. I have a bad trade off. In fullscreen exclusive mode my animation runs <30 fps and jerks when rendering. i.e. stop and go movement (not flickering/jittering just hesitant motion) when the animation is running. I solved this problem by raising the thread priority of the rendering (7-8). . . this resulted in latency/no activity for my input events both key and mouse. For instance closing the program alt-f4 will arbitrarily fail or be successful when the thread priority is raised above 6.
    How does one accomplish a >30 fps and Instant event handling simultaneously in Fullscreen Exclusive Mode?
    Is there a way to raise thread priority for event handling?
    Ultimately I want to be able to perform my animations and handle key and mouse input events without having a visible 'hiccups' on the screen.
    Much Appreciated!

    If I remember correctly the processor is a 1.4(or)6ghz AMD Duron
    Total = 1048048kb
    Available = 106084kb
    Sys Cache = 211788kb
    PF Usage = 1.01 GB
    I solved some of the problem after posting this thread. . . .
    I inserted a thread.sleep(1) and my alt-f4 operation worked unhindered with the elevated thread priority.
    I haven't tested it with mouse event or any other key event but at the moment it looks I may have solved the problem.
    If so, my next question will be is there a way to reduce the amount of cpu power needed to run the program.
    I'm afraid that the other classes that I'm adding will actually become even more process consuming than the actually rendering thread.
    public class RenderScreen extends Thread
      // Screen Rendering status code
      protected final static int RUNNING = 0,
                                 PAUSED = -1;
      // frames per second and process time counters
      protected long now = 0, fps = 0, fpsCount = 0, cycTime = 0;
      // thread status
      protected int status = 0;
      protected Screen screen;
      public void setStatus(int i){ status = i; };
      public void setTarget(Screen screen){ this.screen=screen; };
      public void run()
        setName("Screen Render");
        screen.createBufferStrategy(1);
        screen.strategy = screen.getBufferStrategy();
        for(;;)
          if(status == RUNNING)
            now = System.currentTimeMillis();
            while(System.currentTimeMillis() <= now+1000)
              // call system processes
              // fps increment / repaint interface
              fpsCount++;
              screen.renderView();
              try { Thread.sleep(1);}catch(InterruptedException ie){ ie.printStackTrace(); }
            fps = fpsCount;
            cycTime = System.currentTimeMillis() - (now + 1000);
            fpsCount=0;
      public RenderScreen(){};
      public RenderScreen(Screen screen){ this.screen=screen; };
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class Screen extends Window
      BufferedImage image = new BufferedImage(800,600,BufferedImage.TYPE_INT_RGB);
      Graphics2D gdd = image.createGraphics();
      MediaTracker tracker = new MediaTracker(this);
      Image bground = getToolkit().getImage("MajorityRule.jpg"),
            bawl = getToolkit().getImage("bawl.gif");
      RenderScreen rScreen = new RenderScreen(this);
      BufferStrategy strategy;
      Graphics g;
      Rectangle rect = new Rectangle(400,0,150,150);
      //Game game = new Game();
      public void renderView()
        g = strategy.getDrawGraphics();
        //--------- Game Procedures [start]
        gdd.drawImage(bground,0,0,this);
        gdd.drawString("fps: ["+rScreen.fps+"] Cycle Time: ["+rScreen.cycTime+"]",0,10);
        //--------- Game Procedures [end]
        //---------test
        gdd.drawImage(bawl,rect.x,rect.y,rect.width,rect.height,this);
        rect.translate(0,1);
        g.drawImage(image,0,0,this);
        //g.dispose();
        strategy.show();
      public Screen(JFrame frame)
        super(frame);
        try
          tracker.addImage(bground,0);
          tracker.addImage(bawl,1);
          tracker.waitForAll();
        catch(InterruptedException ie){ ie.printStackTrace(); }
        setBackground(Color.black);
        setForeground(Color.white);
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MajorityRule extends JFrame
      // Graphic System Handlers
      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice gd = ge.getDefaultScreenDevice();
      GraphicsConfiguration gc = gd.getDefaultConfiguration();
      Screen screen = new Screen(this);
      Paper paper = new Paper();
      public void windowed()
        paper.setSize(getWidth(),getHeight());
        getContentPane().add(paper);
        setResizable(false);
        setVisible(true);
      public void fullscreen()
        DisplayMode dMode = new DisplayMode(800,600,32,200);
        screen.setBounds(0,0,800,600);
        if (gd.isFullScreenSupported()) gd.setFullScreenWindow(screen);
        if (gd.isDisplayChangeSupported()){ gd.setDisplayMode(dMode); };
        screen.setIgnoreRepaint(true);
        screen.setVisible(true);
        screen.rScreen.setPriority(Thread.MAX_PRIORITY);
        screen.rScreen.start();
        screen.requestFocus();
      public MajorityRule(String args[])
        setTitle("Majority Rule [Testing Block]");
        setBounds(0,0,410,360);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        getContentPane().setLayout(null);
        if (args.length > 0 && args[0].equals("-window")) windowed();
        else fullscreen();
      public static void main(String args[])
        new MajorityRule(args);
    };

  • Event Handler Exception

    Hi Friends,
    I am trying to call a BAPI from a webdynpro application when a user
    hits a button in a table. The table will have a button for each entry.
    There is an iView that has the table, a custom controller that executes
    the BAPI (model).
    I am setting the value of the custom controller context at the onAction event handler of the iView and calling the method executeBAPI once the user hits the button. The problem is it works fine for the first time. If the user hits another button of the table on the same screen it throws a nullPointer exception. ie all the subsequent calls fail.
    What could be wrong?
    java.lang.NullPointerException
         at com.sap.tc.prototype.ITView.onActionEventSelect(ITView.java:160)
         at com.sap.tc.prototype.wdp.InternalITView.wdInvokeEventHandler(InternalITView.java:160)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
         at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)
         at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
    Thanks in advance.
    Nathan.

    Hi,
      wdThis.wdGetTCRegisterCustController().wdGetContext().currentBapi_InputElement().setCount(count);
    This is what i am doing at line 160. And i am setting some more values for the node.
    I tried to debug it. I executed this line in the debugger and it shows the following error:
    Evaluation failed. Reason(s):
              Attempt to send a message to a non object value
    Thanks
    Nathan.

  • Event handler doesn't work for a Canvas inside a canvas (Possible bug in Flex 4)

    Hi Guys,
    I have a canvas sitting inside another canvas. When i try to catch the mouseClick event in the child canvas, im not able to do it. When i change the child canvas component to a 'Panel', the event handler works perfectly fine. Any suggestions/solutions?

    ok a few things you should know... it is recomended to use the spark components when working with flash builder 4 thought the mx components are available spark is much litghter in weight. also if you want to use the equivalent of a canvas in spark then you want to use a "group" but ill warn you they dont support inline styles, a border container looked more appropiate for what you were trying to do below.  However. i did fix your code for flex 4.0
    look below.
    component:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx"
        creationComplete ="canvas2_creationCompleteHandler(event)">
    <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
      <![CDATA[
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    public function canvas1_clickHandler(event:MouseEvent):void
    Alert.show("Clicked");
    public function canvas2_creationCompleteHandler(event:Event):void
    {// TODO Auto-generated method stub//
    kenaCan.addEventListener(MouseEvent.CLICK, canvas1_clickHandler);
      ]]>
    </fx:Script> 
    <mx:Canvas id="kenaCan"
          width="400"
          height="300"
          borderStyle="solid"
          borderColor="black"
          backgroundColor="white"
          />
    </mx:Canvas>
    application:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
          xmlns:local1="local.*">
    <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <local1:canvas/>
    </s:Application>
    if this post answers your question please mark it as such thanks

  • Button Event Handler in a JList, Please help.

    Hi everyone,
    I have created a small Java application which has a JList. The JList uses a custom cell renderer I named SmartCellRenderer. The SmartCellRenderer extends JPanel and implements the ListCellRenderer. I have added two buttons on the right side inside the JPanel of the SmartCellRenderer, since I want to buttons for each list item, and I have added mouse/action listeners for both buttons. However, they don't respond. It seems that the JList property overcomes the buttons underneath it. So the buttons never really get clicked because before that happens the JList item is being selected beforehand. I've tried everything. I've put listeners in the Main class, called Editor, which has the JList and also have listeners in the SmartCellRenderer itself and none of them get invoked.
    I also tried a manual solution. Every time the event handler for the JList was invoked (this is the handler for the JList itself and not the buttons), I sent the mouse event object to the SmartCellRenderer to manually check if the point the click happened was on one of the buttons in order to handle it.
    I used:
    // Inside SmartCellRenderer.java
    // e is the mouse event object being passed from the Editor whenever
    // a JList item is selected or clicked on
    Component comp = this.getComponent (e.getX(), e.getY())
    if(!(comp instanceof JButton)) {
              System.out.println("Recoqnized Event, but not a button click...");
              //return;
    } else {
              System.out.println("Recognized Event, IT IS A MOUSE CLICK, PROCESSING...");
              System.out.println("VALUE: "+comp.toString());
    What I realized is that not only this still doesn't work (it never realizes the component as a JButton) it also throws an exception for the last line saying comp is null. Meaning with the passed x,y position the getComponent() returns a null which happens when the coordinates passed to it are outside the range of the Panel. Which is a whole other problem?
    I have yet to find an example on the web, using Google, that demonstrated using buttons inside a JList.
    Can anyone help me with this. Thanks.

    A renderer is not a component, so you can't click on it. A renderer is just used to paint a representation of a component at a certain position in your JList.
    I have yet to find an example on the web, using Google, that demonstrated using buttons inside a JList.Thats probably because this is not a common design. The following two designs are more common:
    a) Create a separate panel for your JButtons. Then when you click on the button it would act on each selected row in the JList
    b) Or maybe like windows explorer. Select the items in the list and then use a JPopupMenu to perform the desired functionality.
    I've never tried to add a clickable button to a panel, but this [url http://forum.java.sun.com/thread.jspa?threadID=573721]posting shows one way to add a clickable JButton as a column in a JTable. You might be able to use some of the concepts to add 2 button to the JPanel or maybe you could use a JTable with 3 columns, one for your data and the last two for your buttons.

  • Getting task id in boundary event handler

    Oracle BPM 11.1.1.6
    I have a human task in my process and I want to send out some very customized notification ( very different to the original assignment notification) to the assignee if the task is not actioned within a certain duration. For this I am having a non interrupting boundary event handler attached to the task which connects to a notification activity. The notification content needs to include an URL , which has the task id as part of it. ( we are using a custom worklist app ). Question: is there a way to get the taskid of the task for including it in the content of notification activity ?
    TIA,
    Atheek

    Hi
    UBR and UER are amounts that system calculate for the entire draft invoice and the entire draft revenue.
    Since usually invoice and revenue are generated at the project level, the task id is not a valid parameter for AA, since there could be multiple tasks on the same document.
    If in your case you are sure the revenue and invoice document always contains a single task, you could try a workaround using AA rule based on SQL statement. The logic will be to select any bill item within the invoice or revenue (either EI RDL or an Event) and read the task id of that item.
    Dina

  • Action Event Handler on Tree nodes

    I have an actionListener event handler registered on a tree node as follows:
    <af:tree value="#{bindings.SomeViewObj1.treeModel}" var="node" rowSelection="none" id="t1"
    binding="#{EditFormBean.tree1}" displayRow="selected" summary="Tree"
    partialTriggers=":::cb1 :::cb2">
    <f:facet name="nodeStamp">
    <af:panelGroupLayout id="pgl3">
    <af:outputText value="#{node}" id="ot1"/>
    <af:commandImageLink text="E" id="cil3" partialSubmit="true"
    *actionListener="#{EditFormBean.onEdit}"* binding="#{EditFormBean.cmdImageLink}">
    <af:setPropertyListener from="#{node.hiertType.structureDefName}" type="action"
    to="#{viewScope.formView}"/>
    <f:attribute name="node" value="#{node}"/>
    </af:commandImageLink>
    <af:commandImageLink text="A" id="cil1"/>
    <af:commandImageLink text="D" id="cil2"/>
    </af:panelGroupLayout>
    </f:facet>
    </af:tree>
    I have at each node stamp facet a panelGroup Layout that contains the node value and a command Image link. The tree has two hierarchical levels. When I press the command Image link on the first tree noe level, the actioListener method in teh managed bean (EditFormBean.onEdit) gets called. When I press the same commandImage link on the second tree level, the same action listener does not get called. I need to get past this problem before I code the actionListener which needs to set the current row in the iterator based on the key selected on the tree node. I simply have a print statement in the action listener method which shows something when the first level command image link is clicked but does not print anything when the second level command image link is clicked.
    I am using JDeveloper 11.1.2.1.0
    There is also adf faces code around this snippet that uses an af:switcher facea component to display the appropriate form based on the nodee level in which the comman d image link is clicled but it is irrelevant to the problem I am getting.
    Any help on that would be appreciated

    Hi,
    hard to say . Didn't see this before. Can yoiu remove "binding="#{EditFormBean.cmdImageLink}"" from the command link. The tree stamps its children so that it doesn't make sense to keep a handle to the component instance
    Frank

  • OIM 11gR2 - RoleUser PostProcess Event Handler not triggered

    Hi,
    I'm trying to create a postprocess event-handler for RoleUser entity so that when a role is assigned (or removed) to a user an UDF is populated with the list of its roles.
    I developed my event-handler and registered it following instructions on http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/oper.htm#OMDEV4749 but the event-handler is not triggered.
    I've read and tried a lot of things but nothing seems to work.
    I use System.out.println() and a Logger in the event-handler methods as well as breakpoints debugging via Eclipse, all this indicates the event-handler is not triggered.
    I checked the event-handler is registered by using getEventHandlers(RoleUser,CREATE) method on IAMAppDesignMBean through Enterprise Manager. Result is :
    Postprocess,-2147483648,PostProcessingInitiation,/metadata/iam-features-request/event-definition/EventHandlers.xml,true
    Postprocess,FIRST,MyHandler,Plugin:MyHandler,false
    Postprocess,FIRST,MyHandler,Plugin:MyHandler,false
    Postprocess,FIRST,MyHandler,Plugin:MyHandler,false
    Postprocess,FIRST,MyHandler,Plugin:MyHandler,false
    Postprocess,1020,RoleGrantPostProcessActionHandler,/metadata/iam-features-identity/event-definition/EventHandlers.xml,false
    Postprocess,9988,AsyncHandler,/metadata/iam-features-asyncwsclient/EventHandlers.xml,true
    Postprocess,3000000,CallBackOAACGWithApprove,/metadata/iam-features-rolesod/EventHandlers.xml,true
    Postprocess,2147483647,RequestCompleted,/metadata/iam-features-request/event-definition/EventHandlers.xml,true
    Note that I dont understand why the handler appears four times..
    Also, when I unregister it, it still appears one time.
    Here is my event handler XML file (in META-INF folder of the plugin zip) :
    <?xml version='1.0' encoding='utf-8'?>
    <eventhandlers
      xmlns="http://www.oracle.com/schema/oim/platform/kernel/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernel orchestration-handlers.xsd">
      <action-handler
      class="package.MyHandler"
      entity-type="RoleUser"
      operation="ANY"
      name="MyHandler"
      stage="postprocess"
      order="FIRST"
      sync="TRUE" />
    </eventhandlers>
    plugin.xml file (root of plugin zip) :
    <?xml version="1.0" encoding="UTF-8"?>
    <oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
      <plugin
      pluginclass="package.MyHandler"
      version="1.0"
      name="Myhandler" />
      </plugins>
    </oimplugins>
    Java code (in a JAR in lib folder of plugin zip) :
    public class MyHandler implements PostProcessHandler {
    @Override
    public EventResult execute(long processId, long eventId, Orchestration orchestration) {
      System.out.println("Inside EventResult execute ");
      LOGGER.log(Level.SEVERE, "Inside eventResult execute");
      // Some code
      return new EventResult();
    @Override
    public BulkEventResult execute(long processId, long eventId, BulkOrchestration orchestration) {
      String operation = orchestration.getOperation().trim().toString();
      System.out.println("<---------- Calling " + getClass().getName() + ": Operation[" + operation + "] Execute ---------->");
      LOGGER.log(Level.SEVERE, "Inside BulkEventResult execute");
      // Some code
      return new BulkEventResult();
    Maybe I'm missing something ? Any help would be really appreciated
    Thanks,
    Gael
    EDIT :
    Also note that I see these messages in the logs but I'm not sure it concern my event handler from what I read on some pages :
    XML schema validation failed for XML eventhandlers and it will not be loaded by kernel.
    [CALLBACKMSG] Found 0 possible matches for applicable policies for step POST_PROCESS, entity RoleUser, operation CREATE.
    Related link : Post process event handler when a role is created or modified in OIM

    I eventually got it working but I'm not sure of how.. !
    I changed the name of the handler (it was not "MyHandler" but something very long, I shortened it). I copy and paste exactly what was described here : Post process event handler when a role is created or modified in OIM. I did purge cache. I tried to apply it on another entity (Role), it was triggered, then I applied it back to RoleUser and it still works.
    If it can help someone, my plugin zip contains :
    plugin.xml :
    <?xml version="1.0" encoding="UTF-8"?>
    <oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
      <plugin pluginclass="fr.xxx.RoleUserProcessor"
      version="1.0" name="RoleUserProcessor" />
      </plugins>
    </oimplugins>
    META-INF/EventHandlers.xml :
    <?xml version="1.0" encoding="UTF-8"?>
    <eventhandlers xmlns="http://www.oracle.com/schema/oim/platform/kernel"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernel orchestration-handlers.xsd">
      <action-handler class="fr.xxx.RoleUserProcessor"
      entity-type="RoleUser" operation="ANY" name="RoleUserProcessor" order="9999"
      stage="postprocess" sync="TRUE" />
    </eventhandlers>
    lib/xxx.jar/RoleUserProcessor.java :
    @Override
      public EventResult execute(long processId, long eventId, Orchestration orchestration) {
      LOGGER.log(Level.INFO, "Execution RoleUserProcessor EventHandler (mode non bulk)");
      String operation = orchestration.getOperation().trim().toString();
      LOGGER.log(Level.INFO, "Operation : " + operation);
      return new EventResult();
      @Override
      public BulkEventResult execute(long processId, long eventId, BulkOrchestration orchestration) {
      LOGGER.log(Level.INFO, "Execution RoleUserProcessor EventHandler (mode bulk)");
      String operation = orchestration.getOperation().trim().toString();
      LOGGER.log(Level.INFO, "Operation : " + operation);
      return new BulkEventResult();
    Thank you
    Also, a thing that may help some people, I found out that the ORCHEVENTS table in OIM schema contains the history of handlers triggered.

  • Event handling to the drop down list in the WEB DYNPRO ALV.

    Hi Experts,
    I posted same thing in the UI programing in the morning
    For better Visiblity(as i didnt get any replies) of my issue i am posting the same thing in the ABAP General as well.
    In my dynpro ALV i have 5 fields. in that 2ed field has the drop down list.
    if i select any of from the list, based on the particular selected value, some value should be reflect in the 3rd field of the ALV.
    Ex:
    dropdown list of  2ed fields inclued like below
    AUXILIARY CONTROLLER
    AXLE ASSEMBLY, NON-OSCILLATING
    ACTUATOR, LINEAR
    AIR CONDITIONER
    BLADE, EARTHMOVING
    if i select ACTUATOR, LINEAR the value ( ACT - first three letters ) should automaticaly reflects in the 3rd field of the ALV like below
    Filed 2                Field 3
    ACTUATOR, LINEAR       ACT
    I thnk we have to do the some Event handling for that dropdown.
    I checkd in the SCN but i didnt find any solution to my issue.
    Any solutions/sample code is appriciated.
    Regards!

    Make sure that the Location Bar is not set to "Nothing": Tools > Options > Privacy > Location Bar: When using the location bar, suggest: History, Bookmarks, History and Bookmarks
    See [[Smart Location Bar]]

Maybe you are looking for

  • How do I align photos in a slideshow?

    Hello, I have been trying to find out how to align photos in a slideshow so that they don't "jump around" in the page, when they have different formats. Unfortunately I just read this discussion and learned that it isn't possible. http://forums.adobe

  • Error message IPC 6023 for the Bt sport channels 5...

    Had this problem for a week now and although help desk has been helpful the problem is still not resolved. One chap says its the broadband another says its the youview box.  I have a technical back ground and i think the broadband is working fine Hub

  • How do you get rid of Blue Highlighting????

    I just purchased Adobe Acrobat 9 Pro. When you use the bookmarks, you then have to click back onto the document page if you want to do anything with it, such as change the zoom. When you click on the page, it turns blue. I HATE that!!! How can I get

  • Finder freezes every 10min or so, necessitating Relaunch to continue working

    I have a MacBook Air (purchased Aug 2013) and am using OSX version 10.9.5. Processor = 1.3 GHz Intel Core i5 Memory = 4GB 1600MHz DDR3 Storage = 8.75GB available out of 120.47GB At the moment I am sorting through photo files (.jpg) on an external por

  • Acrobat FormsCentral Javascript

    If I want to add Javascript to the components in a form, my workaround is to export the online form from FormsCentral and save as a PDF, open in Acrobat Pro then use the Tools/Form option to add Javascript to the Submit buttom and textboxes. Is this