Integrating code for mouse click!

Hello!
I'm trying to get this code working where I want to integrate a shortcut for clicking an button made in Egde Animate.
The code snippets you see is just some copied areas of the whole working code,
Serial.print(c);
        if (c == '\n') {
          if (readString.indexOf("?") <0)
            //do nothing
          else
             if(readString.indexOf("UP=UP") >0)
                 movetiltupstep();
// now output HTML data starting with standard header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          //set background to green
          client.print("<body style=background-color:green>");
          client.println("<hr />");
          client.println("<center>");
          client.println("<h1>Servo control</h1>");
          client.println("<form method=get name=SERVO>");
          client.println("<input type=submit value=UP name=UP style=\"width:100px\"><br>");
          client.println("<input type=submit value=LT name=LT style=\"width:100px\"><input type=submit value=CN name=CN style=\"width:100px\"><input type=submit value=RT name=RT style=\"width:100px\"><br>");
          client.println("<input type=submit value=DN name=DN style=\"width:100px\">");
          client.println("</form>");
          client.println("</center>");
          client.println("</body></html>");
          //clearing string for next read
          readString="";
          //stopping client
          client.stop();
void movetiltupstep(){
  tiltpos = tilt.read();
  Serial.println(tiltpos);
  if (tiltpos >= 66)
  tilt.write(tiltpos - 2);
This is just an overview of my setup for a webpage, where I can move a servo with a button and this is called movetiltupstep();
The button is made here, ("<input type=submit value=UP name=UP style=\"width:100px\"><br>"); and I want to use this with the button in Edge Animate.
For a button this is the setup, function(sym, e) and I tried to integrate something like this:
// insert code for mouse click here
sym.$("<input type=submit value=UP name=UP>")  but not working.
How would i proceed with this problem, ideas anyone?
Regards, Tor

import javax.swing.*;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.awt.*;
public class MouseTracker extends JFrame implements MouseListener, MouseMotionListener
    private JLabel statusBar;
    public MouseTracker()
        super("Demonstrating Mouse Events");
        statusBar = new JLabel();
        getContentPane().add(statusBar, BorderLayout.SOUTH);
        addMouseListener(this);
        addMouseMotionListener(this);
        setSize(275, 100);
        setVisible(true);
    public static void main(String[] args)
        MouseTracker application = new MouseTracker();
        application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    public void mouseClicked(MouseEvent e)
        statusBar.setText("Clicked at [" + e.getX() + ", " + e.getY() + "]");
    public void mouseReleased(MouseEvent e)
        statusBar.setText("Released at [" + e.getX() + ", " + e.getY() + "]");
    public void mouseEntered(MouseEvent e)
        statusBar.setText("Clicked at [" + e.getX() + ", " + e.getY() + "]");
        getContentPane().setBackground(Color.GREEN);
    public void mousePressed(MouseEvent e)
        statusBar.setText("Pressed at [" + e.getX() + ", " + e.getY() + "]");
    public void mouseExited(MouseEvent e)
        statusBar.setText("Mouse outside window");
        getContentPane().setBackground(Color.WHITE);
    public void mouseDragged(MouseEvent e)
        statusBar.setText("Dragged at [" + e.getX() + ", " + e.getY() + "]");
    public void mouseMoved(MouseEvent e)
        statusBar.setText("Moved at [" + e.getX() + ", " + e.getY() + "]");
}

Similar Messages

  • Multiple Buttons in JTable Headers:  Listening for Mouse Clicks

    I am writing a table which has table headers that contain multiple buttons. For the header cells, I am using a custom cell renderer which extends JPanel. A JLabel and JButtons are added to the JPanel.
    Unfortunately, the buttons do not do anything. (Clicking in the area of a button doesn't appear to have any effect; the button doesn't appear to be pressed.)
    Looking through the archives, I read a suggestion that the way to solve this problem is to listen for mouse clicks on the table header and then determine whether the mouse clicks fall in the area of the button. However, I cannot seem to get coordinates for the button that match the coordinates I see for mouse clicks.
    The coordinates for mouse clicks seem to be relative to the top left corner of the table header (which would match the specification for mouse listeners). I haven't figured out how to get corresponding coordinates for the button. The coordinates returned by JButton.getBounds() seem to be relative to the top left corner of the panel. I hoped I could just add those to the coordinates for the panel to get coordinates relative to the table header, but JPanel.getBounds() gives me negative numbers for x and y (?!?). JPanel.getLocation() gives me the same negative numbers. When I tried JPanel.getLocationOnScreen(), I get an IllegalComponentStateException:
    Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
    Can someone tell me how to get coordinates for the button on the JTableHeader? Or is there an easier way to do this (some way to make the buttons actually work so I can just use an ActionListener like I normally would)?
    Here is relevant code:
    public class MyTableHeaderRenderer extends JPanel implements TableCellRenderer {
    public MyTableHeaderRenderer() {
      setOpaque(true);
      // ... set colors...
      setBorder(UIManager.getBorder("TableHeader.cellBorder"));
      setLayout(new FlowLayout(FlowLayout.LEADING));
      setAlignmentY(Component.CENTER_ALIGNMENT);
    public Component getTableCellRendererComponent(JTable table,
                                                     Object value,
                                                     boolean isSelected,
                                                     boolean hasFocus,
                                                     int row,
                                                     int column){
      if (table != null){
        removeAll();
        String valueString = (value == null) ? "" : value.toString();
        add(new JLabel(valueString));
        Insets zeroInsets = new Insets(0, 0, 0, 0);
        final JButton sortAscendingButton = new JButton("1");
        sortAscendingButton.setMargin(zeroInsets);
        table.getTableHeader().addMouseListener(new MouseAdapter(){
          public void mouseClicked(MouseEvent e) {
            Rectangle buttonBounds = sortAscendingButton.getBounds();
            Rectangle panelBounds = MyTableHeaderRenderer.this.getBounds();
            System.out.println(Revising based on (" + panelBounds.x + ", "
                               + panelBounds.y + ")...");
            buttonBounds.translate(panelBounds.x, panelBounds.y);
            if (buttonBounds.contains(e.getX(), e.getY())){  // The click was on this button.
              System.out.println("Calling sortAscending...");
              ((MyTableModel) table.getModel()).sortAscending(column);
            else{
              System.out.println("(" + e.getX() + ", " + e.getY() + ") is not within "
                                 + sortAscendingButton.getBounds() + " [ revised to " + buttonBounds + "].");
        sortAscendingButton.setEnabled(true);
        add(sortAscendingButton);
        JButton button2 = new JButton("2");
        button2.setMargin(zeroInsets);
        add(button2);
        //etc
      return this;
    }

    I found a solution to this: It's the getHeaderRect method in class JTableHeader.
    table.getTableHeader().addMouseListener(new MouseAdapter(){
      public void mouseClicked(MouseEvent e) {
        Rectangle panelBounds = table.getTableHeader().getHeaderRect(column);
        Rectangle buttonBounds = sortAscendingButton.getBounds();
        buttonBounds.translate(panelBounds.x, panelBounds.y);
        if (buttonBounds.contains(e.getX(), e.getY()) && processedEvents.add(e)){  // The click was on this button.
          ((MyTableModel) table.getModel()).sortAscending(column);
    });

  • BDC Ok-Code for Double Click

    Hi ,
    Could anyone let me know the BDC OK Code for Double click.
    I need to select a row by double clicking it in my recording but not able to capture the code for it.
    Please do the needful.
    Thanks in Advance,
    Sowmmya B

    Hi sowmmya,
    1. If the row you are talking about is
       ALV Grid OO concepts,
       then i think there is a problem.
       It won't work with BDC as u are trying.
    2. Well, for getting the code,
       before double clicking go in debug mode /H
       and then double click.
    3. Now in deubbing mode,
      see the value of sy-ucomm.
    regards,
    amit m.

  • Code for double clicking rows  in alvgrido/p and moving it to internal tabl

    hi,
    code for double clicking rows  in alvgrido/p and moving it to internal table

    hi,
          see the following code which uses layout , double_click event in ALVGRID.
    TABLES: mara,marc.
    DATA:obj_custom TYPE REF TO cl_gui_custom_container,
         obj_alv TYPE REF TO cl_gui_alv_grid.
    DATA: it_mara TYPE TABLE OF mara,
          wa_mara TYPE mara,
          wa_layout TYPE lvc_s_layo,
           wa_variant TYPE disvariant,
            x_save.
    DATA:it_marc TYPE TABLE OF marc,
          wa_marc TYPE marc.
    SELECT-OPTIONS: s_matnr FOR mara-matnr DEFAULT 1 TO 500.
    START-OF-SELECTION.
      SELECT * FROM mara INTO TABLE it_mara
        WHERE matnr IN s_matnr.
      CALL SCREEN '100'.
          CLASS cl_dbclick DEFINITION
    CLASS cl_dbclick DEFINITION.
      PUBLIC SECTION.
        METHODS dbl FOR EVENT double_click OF cl_gui_alv_grid
          IMPORTING e_row e_column.
    ENDCLASS.
    DATA: obj1 TYPE REF TO cl_dbclick.
          CLASS cl_dbclick IMPLEMENTATION
    CLASS cl_dbclick IMPLEMENTATION.
      METHOD dbl.
        IF e_row-rowtype = space AND NOT e_row-index IS INITIAL.
          READ TABLE it_mara INDEX e_row-index INTO wa_mara.
        SELECT * FROM marc INTO TABLE it_marc
        WHERE matnr = wa_mara-matnr.
            CALL METHOD obj_custom->free
            EXCEPTIONS
              cntl_error        = 1
              cntl_system_error = 2
              OTHERS            = 3.
          IF sy-subrc <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          CALL SCREEN '200'.
        ENDIF.
      ENDMETHOD.                    "dbl
    ENDCLASS.                    "cl_dbclick IMPLEMENTATION
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      CALL METHOD obj_custom->free
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  filldata  OUTPUT
          text
    MODULE filldata OUTPUT.
      CREATE OBJECT obj_custom
        EXPORTING
          container_name = 'CONTROL'.
      CREATE OBJECT obj_alv
        EXPORTING
          i_parent = obj_custom.
      CREATE OBJECT obj1.
      SET HANDLER obj1->dbl FOR obj_alv.
      CALL METHOD obj_alv->set_table_for_first_display
        EXPORTING
       i_buffer_active               =
       i_bypassing_buffer            =
       i_consistency_check           =
          i_structure_name              = 'MARA'
          is_variant                    = wa_variant
          i_save                        = x_save
       i_default                     = 'X'
          is_layout                     = wa_layout
       is_print                      =
       it_special_groups             =
       it_toolbar_excluding          =
       it_hyperlink                  =
       it_alv_graphics               =
       it_except_qinfo               =
       ir_salv_adapter               =
        CHANGING
          it_outtab                     = it_mara
       it_fieldcatalog               =
       it_sort                       =
       it_filter                     =
    EXCEPTIONS
       invalid_parameter_combination = 1
       program_error                 = 2
       too_many_lines                = 3
       others                        = 4
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " filldata  OUTPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'STATUS'.
    *  SET TITLEBAR 'xxx'.
    SUPPRESS DIALOG.
         SET PARAMETER ID 'MAT' FIELD wa_mara-matnr.
    LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
    *WRITE:/ wa_mara-matnr,
           wa_mara-mbrsh,
           wa_mara-meins.
      CREATE OBJECT obj_custom
        EXPORTING
          container_name = 'CONTROL'.
      CREATE OBJECT obj_alv
        EXPORTING
          i_parent = obj_custom.
      CALL METHOD obj_alv->set_table_for_first_display
        EXPORTING
       i_buffer_active               =
       i_bypassing_buffer            =
       i_consistency_check           =
          i_structure_name              = 'MARC'
       is_variant                    = wa_variant
       i_save                        = x_save
       i_default                     = 'X'
       is_layout                     = wa_layout
       is_print                      =
       it_special_groups             =
       it_toolbar_excluding          =
       it_hyperlink                  =
       it_alv_graphics               =
       it_except_qinfo               =
       ir_salv_adapter               =
        CHANGING
          it_outtab                     = it_marc
       it_fieldcatalog               =
       it_sort                       =
       it_filter                     =
    EXCEPTIONS
       invalid_parameter_combination = 1
       program_error                 = 2
       too_many_lines                = 3
       others                        = 4
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  layout  OUTPUT
          text
    MODULE layout OUTPUT.
      wa_layout-grid_title = 'MATERIAL DATA'.
      wa_layout-zebra = 'X'.
    wa_layout-edit = 'X'.
    ENDMODULE.                 " layout  OUTPUT
    *&      Module  variant  OUTPUT
          text
    MODULE variant OUTPUT.
      wa_variant-report = 'ZALV_GRID1'.
      x_save = 'A'.
    ENDMODULE.                 " variant  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE user_command_0200 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          CALL METHOD obj_custom->free
            EXCEPTIONS
              cntl_error        = 1
              cntl_system_error = 2
              OTHERS            = 3.
          IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          LEAVE TO SCREEN '100'.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    thanks,
    raji
    reward if helpful

  • Adobe plugin For Mouse Click Event Handler

    Hi All, How to write plugin For Mouse Click Event Handler? Please reply quickly..
    Thanks in Advance

    AS has already been replied to you on the other threads.
    THE ACROBAT SDK has all the information you need to implement your solution. If you investigate the SDK and find a specific part of implementing your solution that is causing a problem. Then post that specific problem on the forum so that Leonard/PDL/ Aandi/Everyone else, can help you with specific problems.
    This question is too open ended for it to be easily answered with out doing a lot of work.
    Please download the SDK.
    Investigate the Documentation/Samples.
    Start developing your plug-in. ( I would recommend the Acrobat-plug-in wizard)
    And if you hit a specific problem we will be happy to try and help.
    Please note MULTIPLE POSTS just annoy.
    HTH
    Malky

  • How do you go to marker  when there is a wait for mouse click between the markers?

    I cant seem to get by the wait for mouse click, when using                          go to (marker)
    I have a game that I have 2 push buttons one is
    on mouseUp me
      go to frame 9
    end
    on mouseUp me
       go to frame  29
    end
    There is a wait to click in between these 2  frames and when I click on the  2nd button to go to frame 29  it stops at the wait to click?
    I have tried  all these below and cant get past the click to wait?????
    go
    go to frame
    go to marker
    _movie.go
    _movie.marker
    _nextMarker=

    Think this issue is resolved but to ensure the full answer is available, here it is.
    First, it's a bad idea to use the Tempo channel at all. You can use a script to do anything that you can do there. I have Lingo alternates to the Tempo channel at:
    http://www.deansdirectortutorials.com/Lingo/tempoLingo.htm
    (think I need to update this page though)
    So - DO NOT USE the Tempo Channel setting - Wait for Mouse Click or Key Press.
    The above setting creates a type of pause that interferes with other interactivity.
    Instead - use a 'Hold on Frame' behavior (from the Library Palette - Navigation category) or it could be written as:
    on exitFrame
    go the frame
    end
    Once you have the above behaviour in you desired frame, you can attach a sprite behaviour to your buttons / links. A good one to use is the ‘Jump to Marker Button’ behaviour in the Controls category of the Library Palette. You can attach this behavior to different sprites and just change the marker setting of the behavior, removing the need to have individual hard-coded scripts for each button.
    Next – DO NOT link to frame numbers. Always link to a marker. You may insert or remove frames. This would cause your incorrect links since the frame number would no longer the right point.
    Next – the following all do the same thing:
    go to frame “markername”
    go to “markername”
    go “markername”
    So, you can leave out ‘frame’ or even ‘to’ as they are not needed. I still use ‘go to’ as it feels more natural to me (just history).
    or you could use:
    _movie.go("dean")
    Don’t use
    go to marker “markername”
    I think that did work at some point but not anymore.
    marker can be used as follows:
    go marker (-1)
    Where -1 is the amount of markers back (could be forward as well).
    Well, that gives the detailed answer to your question.
    Dean

  • OK CODE FOR SINGLE CLICK IN DYNPRO

    HEY GUYS,
    CAN YOU PLEASE TELL ME WHATS THE OKCODE FOR SINGLE CLICK.
    IF I MAKE SINGLE CLICK IN TABLE CONTROL COLUMN HEADER ITS NOT GOING TO PAI FLOW LOGIC.
    PLEASE SUGGEST ME ..HOW TO GO WITH PAI USING SINGLE CLICK ACTION WITH TABLE CONTROL COLUMN HEADER.
    IS THERE ANY FUNCTION CODE I HAVE MAKE TO ON READY TO STATUS AT TABLE CONTROL COLUMNS.
    THANKS IN ADVANCE.
    AMBICHAN

    Hi Chan,
    Instead of Single click better u can handle trying Double click...  Then PAI will definitely be triggered..
    Regards,
    Sridhar

  • How can I code for a click and drag to progress forward/backward in timeline

    I'm working on a project, the goal is to have a .swf animation like this.
    The functionality I'm looking for is:
    1. I need my animation to make one full rotation and stop,
    and then
    2. I need to fix my AS3 so you have to CLICK/HOLD/DRAG to progress forward and backward through the timeline, but only when your holding the mouse button down.
    Currently the code progresses the frame forward and backward in relation to the mouseX position.
    Here is my current code:
    import flash.events.MouseEvent;
    var startPosition:Number=mouseX;
    var delayTime=10;
    gotoAndStop(1);
    stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouse);
    function onMouse(e:MouseEvent):void{
        stage.removeEventListener(MouseEvent.MOUSE_MOVE,onMouse);
        var currentPosition:Number=mouseX;
        if(mouseX-startPosition<=0){
            nextFrame();
        }else{
            prevFrame();
        setTimeout(setListener, delayTime);
    function setListener(){
        startPosition=mouseX;
    stage.addEventListener(MouseEvent.MOUSE_MOVE,onMouse);
    any help would be appreciated,
    Thanks.

    Found a thread much like this one that solved all my problems
    Here the link to anyone who might be pulling their hair out trying to figure this out in the future
    http://forums.adobe.com/thread/570903?tstart=0
    Thanks Adobe Forums

  • AS3 code for Mouse Event

    Hi,
    I had uploaded jpeg file onto the stage using
    File->Import.
    Now, how to access the mouse-events using AS3.0?
    i.e., when we click with mouse on the stage
    it should display the x and y co-ordinates of the point
    being clicked.
    These x and y coordinates must be displayed in text-boxes
    provided down on the same stage.
    Please reply me

    You can do show/hide movieclip on mouseover. get your box
    position and assign to the popup (tooltip movieclip).
    see this...
    not tested. but it should work.
    import flash.events.MouseEvent;
    function showClip(evt:MouseEvent) {
    tooltips.x = evt.target.x + evt.target.width;;
    tooltips.y = evt.target.y - evt.target.height;
    tooltips.visible = true
    function hideClip(evt:MouseEvent) {
    tooltips.visible = false;
    box.addEventListener(MouseEvent.MOUSE_OVER, showClip);
    box.addEventListener(MouseEvent.MOUSE_OUT, hideClip);
    I assume you'll create two movieclips named: box and tooltips

  • Executing javascript code for button click

    in my application i have report page where i am displaying table data when i click a button it selects first row and returns it using htp.prn() now i m getting that record in jvascript now i want to execute this java script code when the button is clicked i tried using onClick attribute but it didn't work can anyone tell me how to do it?

    Hi,
    I think this is related to Application express, right ?
    You could post your question in Application Express forum
    Oracle Application Express (APEX)
    Also please give more detail about your issue. Post e.g. code (pl/sql & javascript) you try to use.
    Also if you setup sample about your problem to http://apex.oracle.com will help others to help you.
    Help us to help you =)
    Br, Jari

  • A New Thread With Each Mouse Click

    Dear Java Programmers,
    The following code gives a bouncing ball inside of a panel. With each click, I need to have a different ball added and the previous ball to keep on bouncing. This part is a larger question of multitreading. When I have an action listener for mouse clicks, and I need to have a new thread with each click, how do I do this and where do I put it?
    Thank you in advance.
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import java.awt.BorderLayout;
    import java.awt.Graphics;
    import java.awt.*;
    import java.awt.Color;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class Multiball extends JPanel implements Runnable, MouseListener {
    Thread blueBall;
    boolean xUp, yUp;
    int x= -10, y= -10, xDx, yDy;
    public Multiball()
    xUp = false;
    yUp = false;
    xDx = 1;
    yDy = 1;
    addMouseListener( this );
    public void mousePressed( MouseEvent e )
    x = e.getX();
    y = e.getY();
    blueBall = new Thread( this );
    blueBall.start();
    public void paint( Graphics g )
    super.paint( g );
    g.setColor( Color.blue );
    g.fillOval( x, y, 10, 10 );
    public void run()
    while ( true ) {
    try {
    blueBall.sleep( 10 );
    catch ( Exception e ) {
    System.err.println( "Exception: " + e.toString() );
    if ( xUp == true )
    x += xDx;
    else
    x -= xDx;
    if ( yUp == true )
    y += yDy;
    else
    y -= yDy;
    if ( y <= 0 ) {
    yUp = true;
    yDy = ( int ) ( Math.random() * 1 + 2 );
    else if ( y >= 183 ) {
    yDy = ( int ) ( Math.random() * 1 + 2 );
    yUp = false;
    if ( x <= 0 ) {
    xUp = true;
    xDx = ( int ) ( Math.random() * 1 + 2 );
    else if ( x >= 220 ) {
    xUp = false;
    xDx = ( int ) ( Math.random() * 1 + 2 );
    repaint();
    public void mouseExited( MouseEvent e ) {}
    public void mouseClicked( MouseEvent e ) {}
    public void mouseReleased( MouseEvent e ) {}
    public void mouseEntered( MouseEvent e ) {}
    public static void main(String args[])
    JFrame a = new JFrame("Ball Bounce");
    a.add(new Multiball(), BorderLayout.CENTER);
    a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    a.setSize(240,230);
    a.setVisible(true);
    }

    Thank you very much for your replies. As for the multithreading, I have created 20 threads in the main method. With each click, one of these 20 threads starts in order. Now, how do I get a ball to paint with each one? How do I reference them in the paintComponent method?
       public void mousePressed( MouseEvent e )
             x = e.getX();
             y = e.getY();
             blueBall = new Thread( this );
             blueBall.start();
             count ++;
             System.out.print ("count is " + count);
          MyThread[] threads = new MyThread[20];
                for ( int ball = 0;ball < count; ball ++){
                threads[ball] = new MyThread ("" + ball);
                threads[ball].start ();
       }

  • How to Open new screen for single click on ALV icon.

    Hi All,
    Can any body help me regarding the below ALV requirement.
    I need to create a executable program ZPROGRAM with a table having field to store long text.The ALV report should display records according to the selection screen parameters with a icon in each record when clicked should open a new screen with present data in the field and must be able to save the entered long text.
    Can any body give me the idea after displaying the simple ALV in the output,
    How to open new screen(not the Pop-up’s) after single click on the icon,
    in that I should be able to modify & save the long text in my ZTABLE and
    able to retrieve the same text for single clicked icon record.
    which function modules/Classes/Methods can we use for this requirement.
    And how retrieve the same text for this record.
    Thanks in advance.
    Regards,
    Kalam A.

    *& Report  ZTEST_ALV
    REPORT  ZTEST_ALV.
    TYPE-POOLS slis.
    DATA: gt_fieldcat TYPE TABLE OF slis_fieldcat_alv .
    DATA: gs_layout  TYPE slis_layout_alv.
    DATA: gt_list_top_of_page TYPE slis_t_listheader.
    DATA: gt_sortinfo_alv   TYPE  slis_t_sortinfo_alv.
    DATA: gs_print_alv TYPE slis_print_alv.
    DATA: gs_grid TYPE lvc_s_glay.
    DATA: gt_event TYPE slis_t_event.
    DATA: gs_event TYPE slis_alv_event.
    DATA: BEGIN OF GT_DISPLAY OCCURS 100.
       INCLUDE STRUCTURE MARA.
       DATA: BOX.
    DATA: END OF GT_DISPLAY.
    START-OF-SELECTION.
    SELECT * FROM MARA UP TO 50 ROWS
      INTO CORRESPONDING FIELDS OF TABLE GT_DISPLAY.
    End-of-Selection.
      PERFORM build_alv.
      PERFORM display_screen .
    FORM build_alv .
      DATA: ls_fieldcat LIKE LINE OF gt_fieldcat.
      DATA: ls_top TYPE LINE OF slis_t_listheader.
      DATA: ls_sort TYPE slis_sortinfo_alv.
      CLEAR: ls_fieldcat, gt_fieldcat[], ls_top,gt_list_top_of_page[],
             ls_sort,gs_grid,gs_print_alv,gt_sortinfo_alv[].
    *&-----gs_layout definition.
    gs_layout-zebra = 'X'.
    gs_layout-detail_popup = 'X'.          "ÊÇ·ñµ¯³öÏêϸÐÅÏ¢´°¿Ú
    gs_layout-f2code = '&ETA'.             "ÉèÖô¥·¢µ¯³öÏêϸÐÅÏ¢´°¿ÚµÄ¹¦ÄÜÂë,ÕâÀïÊÇË«»÷
      gs_layout-no_vline = ' '.              "ÉèÖÃÁмä¸ôÏß
      gs_layout-colwidth_optimize = 'X'.     "ÓÅ»¯Áпí
      gs_layout-detail_initial_lines = 'X'.
    gs_layout-coltab_fieldname = 'LINE_COLOR'. "Line_colorΪgt_displayµÄÒ»¸ö×Ö¶Î,¾ßÌåÑÕÉ«ÉèÖüûÏÂÃæ˵Ã÷.
      gs_layout-hotspot_fieldname = 'MATNR'.
    gs_layout-detail_titlebar = 'ÏêϸÄÚÈÝ'. "ÉèÖõ¯³ö´°¿ÚµÄ±êÌâÀ¸
    gs_layout-group_change_edit = 'X'.
    *&-----gs_grid definition.
      gs_grid-top_p_only = 'X'.
    *&-----gs_print_alv definition.
      gs_print_alv-prnt_title = 'X'.
      gs_print_alv-prnt_info = 'X'.
    *&-----gt_sortinfo_alv definition. С¼Æ
      ls_sort-fieldname = 'MTART'.
      ls_sort-tabname =  'GT_DISPLAY'.
      ls_sort-subtot = 'X'.
      ls_sort-spos      = 1.
      ls_sort-up        = 'X'.
    ls_sort-group = 'UL'.
      APPEND ls_sort TO gt_sortinfo_alv.
      ls_sort-fieldname = 'AENAM'.
      ls_sort-tabname =  'GT_DISPLAY'.
      ls_sort-subtot = 'X'.
      ls_sort-spos      = 1.
      ls_sort-up        = 'X'.
    ls_sort-group = 'UL'.
      APPEND ls_sort TO gt_sortinfo_alv.
    *&-----slis_t_listheader definition. title.
      CLEAR  ls_top.
      ls_top-key  = 'µ±Ç°ÈÕÆÚ:'.
      ls_top-typ  = 'S'.  " H = Header, S = Selection, A = Action
      CONCATENATE  sy-datum0(4)   '-' sy-datum4(2) '-' sy-datum+6(2) INTO ls_top-info .
      APPEND ls_top TO gt_list_top_of_page.
      CLEAR  ls_top.
      ls_top-key  = 'title'.
      ls_top-typ  = 'S'.  " H = Header, S = Selection, A = Action
      ls_top-info = space.
      APPEND ls_top TO gt_list_top_of_page.
    *&-----gs_print_alv definition.
      gs_print_alv-prnt_title = 'X'.
      gs_print_alv-prnt_info = 'X'.
    *&-----gt_fieldcat definition.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         i_program_name     = sy-repid
         i_internal_tabname = 'GT_DISPLAY'
          i_structure_name = 'MARA'
          I_CLIENT_NEVER_DISPLAY = 'X'
         i_inclname         = sy-repid
       CHANGING
         ct_fieldcat        = gt_fieldcat[]
       EXCEPTIONS
         inconsistent_interface = 1
         program_error          = 2
         OTHERS                 = 3.
      ls_fieldcat-hotspot = 'X'.
      MODIFY gt_fieldcat FROM ls_fieldcat INDEX 2.
    **-1. definition with macro.
      DEFINE macro.
       col_pos = col_pos + 1.
       ls_fieldcat-tabname   = 'it_typ_data'.
        ls_fieldcat-fieldname = '&1'.
        ls_fieldcat-seltext_l =  &2.
       ls_fieldcat-col_pos   =  col_pos.
        ls_fieldcat-outputlen =  '&3'.
       ls_fieldcat-datatype  =  '&4'.
       ls_fieldcat-do_sum    =  &5.
       ls_fieldcat-edit    =   &6.
       ls_fieldcat-checkbox  =   &7.
       ls_fieldcat-key   =   &9.
       ls_fieldcat-fix_column =  &10.
       ls_fieldcat-no_out =  &11.
        ls_fieldcat-ref_fieldname = &4.    " System F4 Effect.
        ls_fieldcat-ref_tabname   =  &5.   " System F4 Effect.
        ls_fieldcat-hotspot   =   &6.
        append ls_fieldcat to gt_fieldcat.
        clear ls_fieldcat.
      END-OF-DEFINITION.
      macro matnr     'matnr'            18   'MATNR'   'MARA'  'X'.
      macro MTART     'MTART'            18      'MTART' 'MARA'  ''.
      macro  AENAM    'AENAM'            18       'MAENAM'  'MARA'   ''.
    **-2. definition one-by-one.
    CLEAR ls_fieldcat.
    ls_fieldcat-fieldname = 'MATNR'.
    ls_fieldcat-seltext_s = 'ÎïÁÏ'.
    ls_fieldcat-ref_fieldname = 'ROLLNAME'.
    ls_fieldcat-ref_tabname   =  'DD03L'.
    APPEND ls_fieldcat TO gt_fieldcat.
    ENDFORM.                    "build_alv
    FORM display_screen .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type     = 0
       IMPORTING
         et_events       = gt_event
       EXCEPTIONS
         list_type_wrong = 1
         OTHERS          = 2.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE gt_event INTO gs_event WITH KEY name = 'TOP_OF_PAGE'.
    IF sy-subrc EQ 0.
       gs_event-form = 'TOP_OF_PAGE'.
       MODIFY gt_event FROM gs_event INDEX sy-tabix.
    ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = sy-repid
        i_callback_pf_status_set          = 'PF_STATUS_SET '
         i_callback_user_command           = 'USER_COMMAND'
        i_callback_top_of_page            = 'TOP_OF_PAGE'
       I_CALLBACK_HTML_TOP_OF_PAGE       = 'HTML_TOP_OF_PAGE'
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
        I_BACKGROUND_ID                   = 'ALV_BACKGROUND'    "When top-of-page is initial.
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
         is_layout                         = gs_layout
         it_fieldcat                       = gt_fieldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
        it_sort                           =  gt_sortinfo_alv[]
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
       I_SAVE                            = 'A'
      IS_VARIANT                        =
      IT_EVENTS                         = gt_event
      IT_EVENT_EXIT                     =
       IS_PRINT                          = gs_print_alv
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = gt_display
    EXCEPTIONS
       program_error                     = 1
       OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "display_screen
    FORM user_command          USING ucomm LIKE sy-ucomm
                               selfield TYPE slis_selfield.
    Data ref1 type ref to cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' "Check Box need fieldcat-checkbox, input and edit.
         IMPORTING
           E_GRID = ref1.
      CASE ucomm.
        WHEN '&IC1'. " SAP standard code for double-clicking
    READ TABLE gt_display INTO gs_display INDEX  slis_selfield-tabindex.
    CHECK sy-subrc = 0.
         CASE  selfield-fieldname  .
           WHEN 'PLNUM'.
             SET PARAMETER ID 'PAF' FIELD gs_display-plnum.
             CALL TRANSACTION 'MD12' AND SKIP FIRST SCREEN.
           WHEN  'POSNR'.
           SUBMIT  rvscd100 USING SELECTION-SCREEN '1000' WITH vbeln = gs_display-vbeln
                                                          WITH posnr = gs_display-posnr
                                                          WITH zinfo = 'X'
                                                          AND RETURN.
         ENDCASE.
       IF selfield-sel_tab_field = 'OUT_ITAB-PI_SL'. " Line detail.
           READ TABLE i_output INTO pisl_itab INDEX selfield-tabindex.
           IF sy-subrc EQ 0.
       ENDIF.
        WHEN 'CHANGE'.
         CALL METHOD ref1->check_changed_data.
         CALL METHOD ref1->refresh_table_display.
    *5´Ë´¦´úÂë×èÖ¹'REUSE_ALV_GRID_DISPLAY´´½¨ÐµÄÆÁÄ»£¬Ôì³ÉÆÁÄ»¶à²ã
         selfield-refresh = 'X'.
        WHEN 'SWITCH'.
         PERFORM switch_edit_mode.
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    "user_command
    Add your code in user_command form.
    WHEN you click matnr ucomm eq '&IC1'.
    Message was edited by:
            Chunhai Hu

  • Applescript help pt 2...Mouse Clicks & Click Lock?

    Hi all,
    Second challenge for me, it would be great to be able to use voice commands for mouse clicks. Most specifically I would like to be able to do a click-lock so that I can draw with a trackball and not have to hold down the button. It would be nice as well to be able to single and double click...
    I tried to figure it out based on the help I got in the last thread but could use a nudge in the right direction.
    Thanks!!!

    I suggest you take a look at this it has an example of the Systems Events 'click'
    I actually had seen this but it ties the click event to a specific button. When I tried to program just a click event w/o a button or target specified it did not seem to work.
    I would need something like "click current mouse position"....
    You should also re-think the click and hold idea. A click/hold/drag/release, is really just a select/copy/paste if done with menus.
    What I need to do click lock for is to control drawing in Adobe Illustrator. I need to be able to use alternative tools to the Wacom Pen, because no matter how good a tool is if you use it enough hours you will get hand fatigue. I want to be able to draw part of the time with a large trackball, and in order to make that work the mouse button has to be held down continuously while drawing.
    Message was edited by: V Silly

  • How to handle mouse click event on up-arrow of JSpinner?

    Hi Everybody,
    I have a JSpinner component holding a date field in it (dd/mm/yyyy). I have handeled keyboard up and down arrow key events for the component and that's working as expected. Now I want to make it work for mouse clicks on the up (UP_ARROW_SUBCOMPONENT) and down arrow (DOWN_ARROW_SUBCOMPONENT) buttons of the component.
    Could somebody guide me how to do it? My investigatoin hints me to use JSpinnerMouseEventData but I am not exactly getting how to get it done.
    Thanks in advance!

    if you just want to add a mouseListener to the spinner's buttons, try this
    (only coded it for the up/next button)
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Testing
      public void buildGUI()
        JSpinner spinner = new JSpinner(new SpinnerNumberModel(50, 0, 100, 5));
        spinner.setUI(new javax.swing.plaf.basic.BasicSpinnerUI(){
          protected Component createNextButton()
            Component c = super.createNextButton();
            c.addMouseListener(new MouseAdapter(){
              public void mousePressed(MouseEvent me){
                System.out.println("mousie, going up");
            return c;
        JFrame f = new JFrame();
        f.getContentPane().add(spinner);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • Issues with "wait until mouse click"

    when I put wait until mouse click it doesn't register mouse down or mouse up. Because of that, my game is sloppy and skips some scenes if I accidentally hold down my mouse for more than a split-second click. Is there any way to manipulate the wait for mouse click behavior so it works only when the mouse button is released?

    Hmm, I wonder if he figured it out already, since he didn't even answer your question.  He seems to be talking about the built-in "Wait for Mouse Click or Key Press" behavior in the behavior library.  Sometimes those behaviors can become overly complicated for the simplest of things.  I recommend you just go ahead and roll your own frame script, as EtchK was implying.  It's pretty easy, you just need two short handlers:
    on exitFrame
      go to the frame
    end
    on mouseUp
    -- do whatever
    end

Maybe you are looking for

  • How do you save a Photoshop CS6 psd file as a template?

    Trying to save a psd file as a template so the original cannot be altered or saved over. How do you do this?

  • Convert an internal table from ABAP to an xml file on the Unix server

    I'm trying to convert an internal table to an xml file.  This file will be downloaded to a unix server.  Can someone help?

  • Default file type for photosmart 7525

    I am trying to find the default file type that is saved to a USB drive when scanning on the HP Photosmart 7525.  This is not my printer, I am just trying to help my sister who lives in another city and is not computer literate.  She scanned some pict

  • Online redo logs

    Hi, I need to move online redo logs to the folder where data files reside. It will be easier for cold back up in NOARCHIVE mode. At the same time I would like recovery_flash_area unattached. The Beta version was perfect for that purpose. I already mo

  • Search in calendar

    Hi everyone, I have an exchange server for my e-mails but don't believe that this is relevant for the question I have. I found out that all of my calendar entries (even very old ones) sync to my iPhone/iPad, but that the search function on my iPhone/