JLabel click event to change picture

Hi All,
I am new to GUI programming and need some help.
I am trying to get a picture of a match to change to a different picture of a match when i click on it.
Below is how I'm currently trying to do it.
import javax.swing.UIManager;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Application2 {
  boolean packFrame = false;
  //Construct the application
  public Application2() {
    Frame2 frame = new Frame2();
    //Validate frames that have preset sizes
    //Pack frames that have useful preferred size info, e.g. from their layout
    if (packFrame) {
      frame.pack();
    else {
      frame.validate();
    //Center the window
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    if (frameSize.height > screenSize.height) {
      frameSize.height = screenSize.height;
    if (frameSize.width > screenSize.width) {
      frameSize.width = screenSize.width;
    frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    frame.setVisible(true);
  //Main method
  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch(Exception e) {
      e.printStackTrace();
    new Application2();
public class Frame2 extends JFrame {
  JPanel contentPane;
  BorderLayout borderLayout1 = new BorderLayout();
  JPanel jPanel1 = new JPanel();
  ImageIcon match = new ImageIcon("match.JPG");
  ImageIcon match2 = new ImageIcon("match2.JPG");
  JLabel jLabel1 = new JLabel(match);
  JLabel jLabel2 = new JLabel(match2);
  //Construct the frame
  public Frame2() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    catch(Exception e) {
      e.printStackTrace();
  //Component initialization
  private void jbInit() throws Exception  {
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);
    this.setSize(new Dimension(400, 300));
    this.setTitle("Frame Title");
    jLabel1.addMouseListener(new Frame2_jLabel1_mouseAdapter(this));
    contentPane.add(jPanel1, BorderLayout.CENTER);
    jPanel1.add(jLabel1, null);
   // jPanel1.add(jLabel2, null);
  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
  void jLabel1_mouseClicked(MouseEvent e) {
    // DOESN'T seam to work
    jLabel1 = new JLabel(match2);
   // jPanel1.remove(jLabel1);
   // jPanel1.add(jLabel1);
    jPanel1.repaint();
    repaint();
class Frame2_jLabel1_mouseAdapter extends java.awt.event.MouseAdapter {
  Frame2 adaptee;
  Frame2_jLabel1_mouseAdapter(Frame2 adaptee) {
    this.adaptee = adaptee;
  public void mouseClicked(MouseEvent e) {
    adaptee.jLabel1_mouseClicked(e);
}

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Frame2Rx extends JFrame {
    JPanel contentPane;
    BorderLayout borderLayout1 = new BorderLayout();
    JPanel jPanel1 = new JPanel();
    ImageIcon match = new ImageIcon("images/bclynx.jpg");
    ImageIcon match2 = new ImageIcon("images/greathornedowl.jpg");
    ImageIcon[] icons;
    int iconCount;
    JLabel jLabel1 = new JLabel(match);
    JLabel jLabel2 = new JLabel(match2);
    //Construct the frame
    public Frame2Rx() {
        icons = new ImageIcon[] { match, match2 };
        iconCount = 0;
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        try {
            jbInit();
        catch(Exception e) {
            e.printStackTrace();
    //Component initialization
    private void jbInit() throws Exception {
        contentPane = (JPanel) this.getContentPane();
        contentPane.setLayout(borderLayout1);
        this.setSize(new Dimension(400, 300));
        this.setTitle("Frame Title");
        jLabel1.addMouseListener(new Frame2_jLabel1_mouseAdapter(this));
        contentPane.add(jPanel1, BorderLayout.CENTER);
        jPanel1.add(jLabel1, null);
        // jPanel1.add(jLabel2, null);
    //Overridden so we can exit when window is closed
    protected void processWindowEvent(WindowEvent e) {
        super.processWindowEvent(e);
        if (e.getID() == WindowEvent.WINDOW_CLOSING) {
            System.exit(0);
    void jLabel1_mouseClicked(MouseEvent e) {
        jLabel1.setIcon(icons[++iconCount % icons.length]);
        jLabel1.revalidate();  // esp if image sizes not equal
        jLabel1.repaint();
    public static void main(String[] args)
        Frame2Rx f = new Frame2Rx();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
class Frame2_jLabel1_mouseAdapter extends java.awt.event.MouseAdapter {
    Frame2Rx adaptee;
    Frame2_jLabel1_mouseAdapter(Frame2Rx adaptee) {
        this.adaptee = adaptee;
    public void mouseClicked(MouseEvent e) {
        adaptee.jLabel1_mouseClicked(e);
}

Similar Messages

  • To catch click event on a picture on screen

    How to catch the click event on a picture on screen? Please answer with code.
    regards
    agn

    Try this code....
    REPORT  zaby_pic.
    CLASS cl_picture_click DEFENITION.
    PUBLIC SECTION.
    METHODS: picture_yclick FOR EVENT picture_click of cl_gui_picture IMPORTING mouse_pos_x mouse_pos_y.
    ENDCLASS.
    CLASS cl_picture_click IMPLEMENTATION.
    METHOD: picture_yclick.
    Perform onclick. "write the action of click in this form.
    ENDMETHOD.
    ENDCLASS.
    DATA: obj_cl_picture_class TYPE REF TO cl_picture_click.
    DATA: it_event_picture TYPE TABLE OF cntl_simple_event,
          wa_event_picture TYPE cntl_simple_event.
    MODULE status_001_output.
    wa_event_picture-eventid = cl_gui_picture=>eventid_picture_click.
    wa_event_picture-appl_event = 'X'.
    APPEND wa_event_picture to it_event_picture.
    CALL METHOD h_picture->set_registered_events
    Exporting
        events = it_evet_picture
    Exceptions
        cntl_error                = 1
        cntl_system_error         = 2
        illegal_event_combination = 3
        OTHERS                    = 4.
    CREATE OBJECT obj_cl_picture_click.
    SET HANDLER obj_cl_picture_click->picture_yclick FOR h_picture. "h_picture is the object of class cl_gui_picture.
    ENDMODULE
    ...................Hope this code will help you. Thanks.

  • I am trying to set my background setting to change when ever I log in, I clicked on both 'change picture' and 'random order' boxes as my settings, but when ever I log in it has the same background as before. Does any body know how to fix this?

    am trying to set my background setting to change when ever I log in, I clicked on both 'change picture' and 'random order' boxes as my settings, but when ever I log in it has the same background as before. Does any body know how to fix this?

    You have to enter the Apple ID and password. You are running into the Activation Lock
    iCloud: Find My iPhone Activation Lock in iOS 7
    Is there a way to find my Apple ID Name if I can't remember it?
    Yes. Visit My Apple ID and click Find your Apple ID. See Finding your Apple ID if you'd like more information.
    How do I change or recover a forgotten Apple ID Password?
    If you've forgotten your Apple ID Password or want to change it, go to My Apple ID and follow the instructions. SeeChanging your Apple ID password if you'd like more information.

  • Possible bug - Missing click event when handling change event

    Using Flex 4.5 SDK, I have a spark ComboBox and a Button next to it for applying a filter according to ComboBox selection.
    I listen to both the ComboBox's change event & the Button's click event (for different functions).
    When I manually delete the ComboBox text value from its TextInput (i.e. changing selected index to -1) and immediately click on the Button,
    the click event-handler function is not being called and only the ComboBox's change event-handler function is executed.
    (Selecting a value from the ComboBox's list and clicking on the button triggers both methods on the right order.)
    There's also a state definition for the module, but it isn't being changed during these operations...
    Is this a bug or a correct behavior? Am I missing something here?
    Any workaround suggestions?
    (I thought of listening also to mouse-down or mouse-up on the button instead, but haven't tried it yet...)
    *** UPDATE ***
    When using the Button's mouseDown event the behavior is as expected, so there's a simple workaround.
    However, it seems to me like there's a bug with the Button's click event listener or something...
    *** UPDATE #2 ***
    I created a test application for that and couldn't reproduce the problem.
    Then I figured out the problem and solved it.
    It's a bit emmbarrasing, but I actually disabled the button (enabled=false) as in a child method of the change handling code...
    (If there is no value, don't allow applying the filter - It makes sense! )
    Anyway... No issue after all.
    However, I choose to leave this post (and not delete it) as an example of identifying and resolving a strange behavior in a complex application.

    There's no need.
    Please read the section UPDATE #2.

  • Find out which component on the UI is listening and changing to the click event?

    Hello Forum,
    Is there a way in flex to know which component is taking the click event which is being bubbled to the topLevelApplication. I'm clicking it and some container in the parent hierarchy is invalidating/refreshing the screen on click, so the child ficker's on click.

    You need to put traces or alerts for each container till topLevelApplication, in order to know which is flickering the click...
    Hope you got my point!!!
    If this post answers your question or helps, please kindly mark it as such.

  • Change picture

    how would i make this change picture button change the picture to the traffic light and have it behave the same as the smiley when the move picture button is clicked? also, how can i make this whole program swing instead of awt?
    import java.math.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.applet.*;
    public class Lab7 extends Applet implements ActionListener
       Picture myPicture1 = new Picture (Color.blue, Color.black, Color.red);
       Picture myPicture2 = new Picture (Color.red, Color.yellow, Color.green);
       Button moveButton = new Button ("Move Picture");
       Button sadButton = new Button ("Sadness");
       Button switchButton = new Button ("Switch Picture");
       int x = 50;
       boolean flag = true;
       public void init()
           setBackground(Color.black);
           moveButton.addActionListener(this);
           //switchButton.addActionListener(this);
           //sadButton.addActionListener(this);
           add(switchButton);
           add(moveButton);
           add(sadButton);
       public void paint(Graphics g)
       myPicture1.draw(g);
       myPicture1.setXY(300, 20);
       myPicture1.setXY(x, 20);
       myPicture1.draw(g);
       public void actionPerformed (ActionEvent ae)
           if (x > getSize().width - 175)
               /* 175 = diameter(150) + xOffset(10) + xIncrement(5)
            * + xOffsetToNotRunToEdge(10) n
            x = 0;
            else
            x += 5;
            repaint();
       class Picture {
           private Color faceColor;
           private Color eyeColor;
            private Color smileColor;
            private int x = 50;
            private int y = 30;
            public Picture (Color f, Color e, Color s)
                faceColor = f;
                eyeColor = e;
                smileColor = s;
            public void setXY(int newX, int newY)
                x = newX;  y = newY;
    public void setColors(Color faceColor,
    Color eyeColor, Color smileColor)
         this.faceColor = faceColor;
         this.eyeColor = eyeColor;
         this.smileColor = smileColor;
           public Color getFaceColor()
               return faceColor;
           public Color getEyeColor()
               return eyeColor;
               public Color getSmileColor()
                   return smileColor;
               public void draw(Graphics g)
                   g.setColor(faceColor);
                   g.fillOval(x + 10, y + 40, 150, 150);
                   g.setColor(eyeColor);
                   g.fillOval(x + 60, y + 85, 10, 10);
                   g.fillOval(x + 100, y + 85, 10, 10);
                   g.setColor(smileColor);
                   g.drawArc(x + 35, y + 75, 100, 100, 200, 140);
             class Picture2 {
             private Color topLight;
             private Color midLight;
             private Color lowLight;
             private int x = 50;
             private int y = 30;
             public Picture2 (Color f, Color e, Color s)
                topLight = f;
                midLight = e;
                lowLight = s;
            public void setXY(int newX, int newY)
                x = newX;  y = newY;
    public void setColors(Color topLight,
    Color midLight, Color lowLight)
         this.topLight = topLight;
         this.midLight = midLight;
         this.lowLight = lowLight;
           public Color gettopLight()
               return topLight;
           public Color getmidLight()
               return midLight;
               public Color getlowLight()
                   return lowLight;
               public void draw(Graphics g)
                   g.drawRect (100, 100, 50, 150);
                   g.setColor(topLight);
                   g.fillOval (100, 100, 50, 50);
                   g.setColor(midLight);
                   g.fillOval(100, 130, 50, 50);
                   g.setColor(lowLight);
                   g.fillOval(100, 160, 50, 50);
       }

    Use Swing Components. =)

  • ALV: Issue with double  click event after sorting the ALV

    Hello Experts,
    I have an internal table that populates an ALV grid. When the user doubleclicks a row, my method HANDLE_DOUBLE_CLICK returns the e_row-index value from the ALV Grid. I use this index value to read the internal table, then retrieve additional data.
    My problem is the user may sort the ALV grid before double clicking on a line. If this happens my internal table is not sorted to match the ALV grid, so reading the internal table with the e_row-index value returns the wrong information.
    When the double click event occurs, is it possible to capture the value in column 1 instead of a value for e_row-index?
    There is one more paramter in HANDLE_DOUBLE_CLICK for row id.   It is coming blank in debugging .  what is the purpose of this parameter and how i can make use of it ?
    Regards
    Vivek

    Hi,
    I am Posting The Code Which Uses Double Click Event.
    And This Code will provide the total information to you.
    REPORT  ZALVGRID_PG.
    TABLES: SSCRFIELDS.
    DATA: V_BELNR TYPE RBKP-BELNR.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: IRNO FOR V_BELNR.
    PARAMETERS: P_GJAHR TYPE RBKP-GJAHR.
    SELECTION-SCREEN END OF BLOCK B1.
    DATA: WA TYPE ZALVGRID_DISPLAY,
          ITAB TYPE STANDARD TABLE OF ZALVGRID_DISPLAY.
    DATA: IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: L_IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: L_TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.
    TYPE-POOLS: SLIS,SDYDO.
    DATA: L_LOGO TYPE SDYDO_VALUE,
          L_LIST TYPE SLIS_T_LISTHEADER.
    END-OF-SELECTION.
    CLASS CL_LC DEFINITION.
      PUBLIC SECTION.
        METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN.
    ENDCLASS.
    CLASS CL_LC IMPLEMENTATION.
      METHOD DC.
        DATA: WA1 TYPE ZALVGRID_DISPLAY.
        READ TABLE ITAB INTO WA1 INDEX E_ROW-INDEX.
        BREAK-POINT.
        SET PARAMETER ID 'BLN' FIELD WA1-BELNR.
        CALL TRANSACTION 'FB02'.
      ENDMETHOD.                    "DC
    ENDCLASS.
    DATA: OBJ_CL TYPE REF TO CL_LC.
    START-OF-SELECTION.
      PERFORM SELECT_DATA.
      IF SY-SUBRC = 0.
        CALL SCREEN 100.
      ELSE.
        MESSAGE E000(0) WITH 'DATA NOT FOUND'.
      ENDIF.
      INCLUDE ZALVGRID_PG_STATUS_0100O01.
      INCLUDE ZALVGRID_PG_LOGOSUBF01.
      INCLUDE ZALVGRID_PG_SELECT_DATAF01.
    INCLUDE ZALVGRID_PG_USER_COMMAND_01I01.
    ***INCLUDE ZALVGRID_PG_STATUS_0100O01 .
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'AB'.
    *  SET TITLEBAR 'xxx'.
      IF IDENTITY IS INITIAL.
        CREATE OBJECT IDENTITY
        EXPORTING
          CONTAINER_NAME = 'ALVCONTROL'.
        CREATE OBJECT GRID
        EXPORTING
          I_PARENT = IDENTITY.
        CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
             I_STRUCTURE_NAME              = 'ZALVGRID_DISPLAY'
          CHANGING
            IT_OUTTAB                     = ITAB.
        CREATE OBJECT OBJ_CL.
        SET HANDLER OBJ_CL->DC FOR GRID.
        ENDIF.
        IF L_IDENTITY IS INITIAL.
          CREATE OBJECT L_IDENTITY
          EXPORTING
            CONTAINER_NAME = 'LOGO'.
          CREATE OBJECT L_TREE
          EXPORTING
            I_PARENT = L_IDENTITY.
          PERFORM LOGOSUB USING L_LOGO.
          CALL METHOD L_TREE->CREATE_REPORT_HEADER
            EXPORTING
              IT_LIST_COMMENTARY    = L_LIST
              I_LOGO                = L_LOGO.
          ENDIF    .
    ENDMODULE.                 " STATUS_0100  OUTPUT
    ***INCLUDE ZALVGRID_PG_LOGOSUBF01 .
    FORM LOGOSUB  USING    P_L_LOGO.
      P_L_LOGO = 'ERPLOGO'.
    ENDFORM.                    " LOGOSUB
    ***INCLUDE ZALVGRID_PG_SELECT_DATAF01 .
    FORM SELECT_DATA .
      SELECT RBKP~BELNR
             RBKP~BLDAT
             RSEG~BUZEI
             RSEG~MATNR
             INTO TABLE ITAB
             FROM RBKP INNER JOIN RSEG
        ON RBKP~BELNR = RSEG~BELNR
        WHERE RBKP~BELNR IN IRNO
        AND RBKP~GJAHR = P_GJAHR.
    ENDFORM.                    " SELECT_DATA
    ***INCLUDE ZALVGRID_PG_USER_COMMAND_01I01 .
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
           EXIT.
           ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Warm Regards,
    PavanKumar.G
    Edited by: pavankumar.g on Jan 19, 2012 5:30 AM

  • About double click event in ALV report

    Hi all,
    I want to program a double-click event in ALV reprot.
    I am not suppose to use module pool approach for the same.
    If a user double clicks on the any of the row of ALV report, the transaction should get called.
    Again, I am using function 'REUSE_ALV_GRID_DISPLAY' for displaying ALV.
    Can you please help me to solve this?
    Thanks,
    -Siddhi

    Hi Sidhi,
    You can do it easily by using Reuse_ALV_GRID_DISPALY.
    The User Command subroutine which you pass to this function module in that you can check which field is selected and what is the value of that and also you can get the table index.
    I am giving you a code example where interactivity of ALV report is done .
    *& Report  ZRAIL_LOT_REPORT
    REPORT  zrail_lot_report.
    TABLES :qals,aufk.
    TYPE-POOLS:slis.
    TYPES:BEGIN OF x_lot,
          sel(1)   TYPE c,                    "SELECTION
          prueflos TYPE qals-prueflos,        "INSPECTION LOT NUMBER
          werk     TYPE qals-werk,            "PLANT
          losmenge TYPE qals-losmenge,        "LOT QUANTITY
          mengeneinh TYPE qals-mengeneinh,   "BASE UNIT OF MEASURE FOR THE INSPECTION LOT QUANTITY
          matnr   TYPE  qals-matnr,          " MATERIAL NO. ATTACHED TO ORDER
          zzequnr  TYPE qals-zzequnr,         "EQUIPMENT NO.
          zzassembly TYPE qals-zzassembly,    "ASSEMBLY
          herkunft  TYPE qals-herkunft,       "INSPECTION LOT ORIGIN
          aufnr     TYPE qals-aufnr,          "ORDER NO.
          sttxt     TYPE qals_d02-sttxt,      "LOT STATUS
          objnr     TYPE qals-objnr,          "OBJECT NUMBER
          enstehdat TYPE qals-enstehdat,      "lot creation date
          pruefer   TYPE qamr-pruefer,        "Name of the Inspector
          END OF x_lot.
    TYPES:BEGIN OF x_ordmat,
          aufnr TYPE aufk-aufnr,             "Order No.
          equnr TYPE afih-equnr,             "Equipment No. attached to Order
          zmatnr TYPE aufk-zmatnr,           "Material No. attached to Order
          bautl  TYPE afih-bautl,            "Assembly attached to Order
          END OF x_ordmat.
    TYPES:BEGIN OF x_status,
          objnr TYPE jest-objnr,
          stat  TYPE jest-stat,
          txt04 TYPE tj02t-txt04,
          END OF x_status.
    DATA:it_qals TYPE STANDARD TABLE OF x_lot,
         wa_qals TYPE x_lot.
    DATA:it_ordmat TYPE TABLE OF x_ordmat,
         wa_ordmat TYPE x_ordmat.
    DATA:it_status TYPE STANDARD TABLE OF x_status,
         wa_status TYPE x_status.
    DATA:mytabix TYPE sy-tabix.
    DATA: wa_layout   TYPE slis_layout_alv,
          wa_fieldcat TYPE slis_fieldcat_alv,
          it_fieldcat TYPE TABLE OF slis_fieldcat_alv,
          it_fcat TYPE TABLE OF slis_fieldcat_alv.
    DATA:mytabix1 TYPE sy-tabix.
    SELECTION-SCREEN BEGIN OF BLOCK  b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_werks FOR qals-werk,
                    s_zmatnr FOR aufk-zmatnr,
                    s_assbly FOR qals-zzassembly,
                    s_equnr FOR qals-zzequnr,
                    s_lotor FOR qals-herkunft,
                    s_lotdat FOR qals-enstehdat.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION.
      s_lotdat-low = sy-datum - 7.
      s_lotdat-high = sy-datum.
      APPEND s_lotdat.
    START-OF-SELECTION.
      PERFORM get_data_qals.
      PERFORM build_fieldcat.
      PERFORM display_data.
      EXIT.
    END-OF-SELECTION.
    *&      Form  get_data_qals
          text
    -->  p1        text
    <--  p2        text
    FORM get_data_qals .
      IF it_qals[] IS INITIAL.
        SELECT a~prueflos
               a~werk
               a~losmenge
               a~mengeneinh
               a~zzequnr
               a~zzassembly
               a~herkunft
               a~aufnr
               a~objnr
               a~matnr
               a~enstehdat
               b~pruefer
               FROM qals AS a INNER JOIN qamr AS b
               ON aprueflos = bprueflos
               INTO CORRESPONDING FIELDS OF TABLE it_qals
               WHERE werk IN s_werks
               AND   zzassembly IN s_assbly
               AND   zzequnr    IN s_equnr
               AND   herkunft   IN s_lotor
               AND   enstehdat  IN s_lotdat.
      ENDIF.
      IF it_ordmat[] IS INITIAL.
        SELECT a~aufnr
               a~zmatnr
               b~bautl
               b~equnr
               FROM aufk AS a INNER JOIN afih AS b
               ON aaufnr = baufnr
               INTO CORRESPONDING FIELDS OF TABLE it_ordmat FOR ALL ENTRIES IN it_qals
               WHERE a~aufnr = it_qals-aufnr
                AND zmatnr IN s_zmatnr.
      ENDIF.
      IF it_status[] IS INITIAL.
        SELECT a~objnr
               a~stat
               b~txt04
               FROM  tj02t AS b
               INNER JOIN jest AS a ON bistat = astat
               INTO CORRESPONDING FIELDS OF TABLE it_status FOR ALL ENTRIES IN it_qals
               WHERE a~objnr = it_qals-objnr
               AND   b~spras = sy-langu
               AND   a~inact = space.
      ENDIF.
      LOOP AT it_qals INTO wa_qals.
        mytabix = sy-tabix.
        READ TABLE it_ordmat INTO wa_ordmat WITH KEY aufnr = wa_qals-aufnr.
        IF sy-subrc = 0.
          IF wa_qals-herkunft = '14'.
            wa_qals-matnr = wa_ordmat-zmatnr.
            wa_qals-zzequnr =  wa_ordmat-equnr.
            wa_qals-zzassembly = wa_ordmat-bautl.
            MODIFY it_qals FROM wa_qals INDEX  mytabix TRANSPORTING matnr zzassembly zzequnr.
          ENDIF.
        ENDIF.
        LOOP AT it_status INTO wa_status WHERE objnr = wa_qals-objnr.
          CONCATENATE wa_qals-sttxt wa_status-txt04 INTO wa_qals-sttxt SEPARATED BY space.
          CLEAR :wa_status.
        ENDLOOP.
        MODIFY it_qals FROM wa_qals INDEX  mytabix TRANSPORTING sttxt.
        CLEAR :wa_qals,wa_ordmat,mytabix.
      ENDLOOP.
      IF s_zmatnr[] IS NOT INITIAL.
        DELETE it_qals WHERE matnr IS INITIAL.
      ENDIF.
    ENDFORM.                    " get_data_qals
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat .
      wa_layout-zebra = 'X'.
      wa_layout-colwidth_optimize = 'X'.
      wa_layout-box_fieldname = 'SEL'.
      wa_layout-box_tabname = 'IT_QALS'.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
        I_PROGRAM_NAME               =
          i_internal_tabname           = 'IT_QALS'
          i_structure_name             = 'QALS_D02'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_INCLNAME                   =
        I_BYPASSING_BUFFER           =
        I_BUFFER_ACTIVE              =
        CHANGING
          ct_fieldcat                  = it_fieldcat
      IF sy-subrc = 0.
        LOOP AT  it_fieldcat INTO wa_fieldcat.
          CASE  wa_fieldcat-fieldname .
            WHEN  'PRUEFLOS'.
              wa_fieldcat-col_pos = 1.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN   'WERK'.
              wa_fieldcat-col_pos = 3.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'LOSMENGE'.
              wa_fieldcat-col_pos = 4.
              wa_fieldcat-no_out = ''.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'MENGENEINH'.
              wa_fieldcat-col_pos = 5.
              wa_fieldcat-no_out = ''.
              APPEND wa_fieldcat TO it_fcat.
            WHEN 'ZZEQUNR'.
              wa_fieldcat-col_pos = 6.
              wa_fieldcat-no_out = ''.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'ZZASSEMBLY'.
              wa_fieldcat-col_pos = 7.
              wa_fieldcat-no_out = ''.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'HERKUNFT'.
              wa_fieldcat-col_pos = 8.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'AUFNR'.
              wa_fieldcat-col_pos = 9.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'ENSTEHDAT'."enstehdat
              wa_fieldcat-col_pos = 10.
              APPEND wa_fieldcat TO it_fcat.
            WHEN  'STTXT'.
              wa_fieldcat-col_pos = 12.
              wa_fieldcat-hotspot = 'X'.
              APPEND wa_fieldcat TO it_fcat.
            WHEN OTHERS.
          ENDCASE.
          CLEAR wa_fieldcat.
        ENDLOOP.
        wa_fieldcat-fieldname = 'MATNR'.
        wa_fieldcat-tabname  =  'IT_QALS'.
        wa_fieldcat-col_pos = 2.
        wa_fieldcat-ref_tabname = 'AUFK'.
        wa_fieldcat-hotspot = 'X'.
        wa_fieldcat-seltext_l = 'Material No.'.
        APPEND wa_fieldcat TO it_fcat.
        wa_fieldcat-fieldname = 'PRUEFER'.
        wa_fieldcat-tabname  =  'IT_QALS'.
        wa_fieldcat-col_pos = 11.
        wa_fieldcat-ref_tabname = 'QAMR'.
        wa_fieldcat-seltext_l = 'Name of the Inspector'.
        APPEND wa_fieldcat TO it_fcat.
      ENDIF.
    ENDFORM.                    " build_fieldcat
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    FORM display_data .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
       i_callback_program                = 'ZRAIL_LOT_REPORT'
      I_CALLBACK_PF_STATUS_SET          = ' '
         i_callback_user_command           = 'USER_COMMAND'
         is_layout                         = wa_layout
          it_fieldcat                       = it_fcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      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        =
        TABLES
          t_outtab                          = it_qals
    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_data
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM      text
         -->RS_SELFIELD  text
    FORM user_command USING r_ucomm TYPE sy-ucomm  rs_selfield TYPE slis_selfield.
      CASE rs_selfield-fieldname  .
        WHEN 'PRUEFLOS'.
          SET PARAMETER ID 'QLS' FIELD rs_selfield-value.
          CALL TRANSACTION 'QA03' AND SKIP FIRST SCREEN.
        WHEN 'ZZEQUNR'.
          SET PARAMETER ID 'EQN' FIELD  rs_selfield-value.
          CALL TRANSACTION 'IE03' AND SKIP FIRST SCREEN.
        WHEN 'ZMATNR'.
          SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
          CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
        WHEN 'ZZASSEMBLY'.
          SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
          CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
        WHEN 'AUFNR'.
          SET PARAMETER ID 'ANR' FIELD rs_selfield-value.
          CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
        WHEN 'STTXT'.
          MOVE rs_selfield-tabindex TO mytabix1.
          PERFORM show_status.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    *&      Form  show_status
          text
    -->  p1        text
    <--  p2        text
    FORM show_status .
      DATA:it_systat TYPE TABLE OF bapi2045ss,
           wa_sysstat TYPE bapi2045ss,
           it_bapi2045us TYPE TABLE OF bapi2045us.
      DATA:it_fsys TYPE TABLE OF slis_fieldcat_alv.
      DATA:insplot TYPE bapi2045d_il0-insplot.
      DATA:language TYPE bapi2045la.
      CLEAR wa_qals.
      READ TABLE it_qals INTO wa_qals INDEX mytabix1.
      insplot = wa_qals-prueflos.
      language-langu = sy-langu.
      CALL FUNCTION 'BAPI_INSPLOT_GETSTATUS'
        EXPORTING
          number        = insplot
          language      = language
        TABLES
          system_status = it_systat
          user_status   = it_bapi2045us.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name     = 'ZRAIL_LOT_REPORT'
          i_internal_tabname = 'IT_SYSTAT'
          i_structure_name   = 'BAPI2045SS'
        CHANGING
          ct_fieldcat        = it_fsys.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = 'ZRAIL_LOT_REPORT'
          it_fieldcat        = it_fsys
        TABLES
          t_outtab           = it_systat.
    ENDFORM.                    " show_status
    IIn the subrouitne the User command the Parameter rs_selfield will give you the selected or clicked field and its value its record no .
    I hope this will help you.

  • Getting web service results from double click event

    I have an Elixir ILOG Org Chart and I want to add nodes dynamically when a user clicks on the node.  When the click event fires, Can I assign the results of the webservice result to the node as children of that node; similar to what someone would do when calling a function in another language like Java or C#.  For instance I have a method that handles the double click or single click of a user on a node in my Org Chart:
    private function doubleClickHandler(event:OrgChartEvent):void{
         event.item.appendChild(getResults(_id, _idSecond, "") );
    private function webServicehandler_Result(event:ResultEvent):XML{
         return event.result;
    getResults(x,y,z) is the function that calls the web service and returns XML results of all the employees/people that are underneith the object that was double clicked on.  Will this work?

    Use the change event.

  • Trying to add a click event to a button...

    Standalone Flex Builder2 fronting ColdFusion. Current line
    count is a whopping 781 lines. If I try to add ANY more click
    events, even to a button, I get:
    <b>ReferenceError: Error #1065: Variable is not
    defined.
    at global/flash. utils::getDefini tionByName( ) </b>
    Notice there is not a name of the Variable in the
    ReferenceError. All I'm trying to do is add:
    click="currentState ='displayFilterP anel'"
    All functions have been set to public. And there are no Class
    definitions on the application. Any thought would be greatly
    appreciated.

    Anyone have an idea on this? I have rebuilt my application
    romoving all subversion hidden files but still get the same error.
    could it be that i changed my remoting destination and use a
    variable now instead of having it in a specific link?
    see:
    http://yakovfain.javadevelopersjournal.com/passing_parameters_to_flex_that_works.htm

  • Event Data Change step- Failure

    Hi All,
    I have a failure in event data change process in a process chain.
    It has identified 2 packages for change.
    One package has successfully been done.
    While processing of second package, the job BCAST**** failed as logon to BW system with user ID specified failed.
    I know that the user-id does not exist., but am not able to find out of where the to change the user id for the job BCAST*** to run successfull.
    when i click displaying messages, it shows
    Step 001 started (program RSPROCESS, variant &0000001212711, user ID BWEXTRACT)
    Program RSBATCH_EXECUTE_PROZESS successfully scheduled as job
    BIBCAST4AN61630VW21F4LTLVP2QED68 with ID 08254800
    The job BIBCAST4AN61630VW21F4LTLVP2QED68 failed as logon was not possible.
    Please suggest

    Hai ,
    Its right you get the owner name in the table after changing the right user id there .
    In broadcast setting screen itself say for EX broadcast email
    below you give the recepient address
    after that you have the Authorization user  box where you can directly change to right id if you have the proper authorization attached to your user id .Remmember to save then schedule & execute when you trigger for first time.
    This step is related to the role attached to your user access ask basis guy or instead of transporting from development do the broadcast setting directly in production with right EP access.
    hope it would sove your issue.

  • Event data change is process chain

    Hi guys,
    i got a problem with my Event data change in my process chain which gives me the error
    "Background management: timeout or termination of job BCAST486IO7Q8PXOXKE9OV9HOSCGTO"
    when you check in the background it says the job is finsihed
    can any one help me out on this how is fix this
    points will be assigned
    cheers
    dp

    Dear DP,
    i think u have to repair or repeat the chain.... by clicking the context menu
    Regards
    venu

  • Why can't I right-click and set desktop picture?

    Greetings.
    I am having a lot of trouble changing my desktop picture. From what I understand, you right-click the image and click on 'set as desktop picture'. I click it and nothing changes. I have tried to download the image and set it manually through System Preferences but when I go into Desktop & Screen Saver but there are no other folders other than the 'Apple' one that have the wallpapers that come with the computer.
    If it's relevant at all, my macbook pro is a 10.6.8 version.

    You should be able to do it three ways, some of which you already know:
    Right-click image, choose "Set Desktop Picture"
    Right-click desktop, choose "Change Desktop Background"
    Go into System Preferences, click "Desktop and Screen Saver"
    Note when you are in System Preferences, the current desktop is shown in an indented "well." That always indicates that it is a drop target. You don't need to be able to see in the list the pictures or folder you want. Just drag it from the desktop, or iPhoto, or whatever app you're looking at your photo in, and drop it in that well, and it will be set.
    muffinpirate wrote:
    I have tried to download the image and set it manually through System Preferences but when I go into Desktop & Screen Saver but there are no other folders other than the 'Apple' one that have the wallpapers that come with the computer.
    If you did want to do it the old-fashioned way and drill through folders and files, you can click the plus symbol [ + ] below the list there and then you can add any folder to the list. In case you have a folder full of desktop backgrounds, for instance.
    (I might be wrong about some of this since I am using 10.8)

  • Horizontal scroll on MX1000 sends click event as well. [SOLVED]

    As in the topic, I'm having problems with the horizontal scroll sending regular click events to apps as well as the scrolling, making the function pretty unusable. All my other keys work exactly as they should.
    As for my configuration, I'm running evdev, and I have "pointer = 1 2 3 4 5 7 6 8 9 10 11 12" in xmodmap.
    Ive tried changing the input with both imwheel and xbindkeys, but none of them would intercept the horizontal scroll. (Strange though, since it works fine with the other buttons)
    I don't know what else I can do. Is it just a lost cause?
    P.S: I know it's not app dependent, because I have tried it with every application I have.
    Last edited by Aziere (2007-03-25 16:05:48)

    I prefer evdev because I can't seem to get the thumb buttons to work without it.
    As for xev:
    ButtonPress event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x1e00002, time 1058103, (48,34), root:(471,325),
    state 0x10, button 13, same_screen YES
    EnterNotify event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x0, time 1058103, (48,34), root:(471,325),
    mode NotifyGrab, detail NotifyInferior, same_screen YES,
    focus YES, state 16
    KeymapNotify event, serial 31, synthetic NO, window 0x0,
    keys: 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    ButtonPress event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x1e00002, time 1058127, (48,34), root:(471,325),
    state 0x10, button 6, same_screen YES
    ButtonRelease event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x1e00002, time 1058127, (48,34), root:(471,325),
    state 0x10, button 6, same_screen YES
    LeaveNotify event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x0, time 1058127, (48,34), root:(471,325),
    mode NotifyUngrab, detail NotifyInferior, same_screen YES,
    focus YES, state 16
    ButtonRelease event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x1e00002, time 1058263, (48,34), root:(471,325),
    state 0x10, button 13, same_screen YES
    ButtonPress event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x1e00002, time 1127089, (43,37), root:(466,328),
    state 0x10, button 14, same_screen YES
    EnterNotify event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x0, time 1127089, (43,37), root:(466,328),
    mode NotifyGrab, detail NotifyInferior, same_screen YES,
    focus YES, state 16
    KeymapNotify event, serial 31, synthetic NO, window 0x0,
    keys: 38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    ButtonPress event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x1e00002, time 1127105, (43,37), root:(466,328),
    state 0x10, button 7, same_screen YES
    ButtonRelease event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x1e00002, time 1127105, (43,37), root:(466,328),
    state 0x10, button 7, same_screen YES
    LeaveNotify event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x0, time 1127105, (43,37), root:(466,328),
    mode NotifyUngrab, detail NotifyInferior, same_screen YES,
    focus YES, state 16
    ButtonRelease event, serial 31, synthetic NO, window 0x1e00001,
    root 0x155, subw 0x1e00002, time 1127489, (43,37), root:(466,328),
    state 0x10, button 14, same_screen YES
    Seems pretty obvious what the problem is. It sends button 13/14 as input first, the continues with 6/7 which is the scroll. So what do I do to fix that?

  • In ALV reports how double click event works?

    in ALV reports how double click event works? Explain in detail.....

    hi,
    last lines is used for clicking
    *& Report  Z_SWAS_FUNCTIONAL
    report  z_swas_functional.
    tables: qmel,viqmel,iloa,afko.
    -- global data declerations--
    data: ok_code like sy-ucomm,
          gt_itab type table of zfunctional,
          t_output type table of zfunctional,
          g_container type scrfname value 'CUSTOM_CONTROL',
          grid1  type ref to cl_gui_alv_grid,
          g_custom_container type ref to cl_gui_custom_container,
          e_row type lvc_s_row,
          e_column type lvc_s_col,
          es_row_no type lvc_s_roid.
    *CLASS DECLARATION
    class z_functional definition.
    public section.
    class-methods : handle_double_click
                    for event double_click of cl_gui_alv_grid
                         importing e_row  e_column.
    endclass.
    *CLASS IMPLEMENTATION
    class z_functional implementation.
    method handle_double_click.
           perform handle_double_click using e_row e_column es_row_no.
    endmethod.
    endclass.
    *CODE FOR SELECTION SCREEN
    selection-screen begin of block 84433  with frame title text-t01.
    parameters : n_number like viqmel-qmnum,
                    n_type like qmel-qmart,
                    f_loca like iloa-tplnr,
                    name like qmel-qmnam.
    selection-screen end of block 84433.
                        screen validation event                          *
    at selection-screen on n_number.
      select single *
        from viqmel
          where qmnum eq n_number.
    if sy-subrc ne 0.
      MESSAGE 'NOTIFICATION NUMBER DOESNOT EXIST' TYPE 'E'.
    endif.
    select qmart from qmel into qmel where qmart eq N_TYPE.
    endselect.
    if sy-subrc ne 0.
      MESSAGE 'NOTIFICATION TYPE DOES NOT EXIST' TYPE 'E'.
    endif.
    *START OF SELECTION EVENT
    start-of-selection.
        perform fetchdata.
    end-of-selection.
    *Call screen event
    call screen 100.
    *PERFORM DISPLAY.
    *&      Form  FETCHDATA
          text
    -->  p1        text
    <--  p2        text
    form fetchdata .
    *SELECT VIQMEL~QMNUM VIQMEL~QMTXT VIQMEL~QMDAT VIQMEL~LTRMN VIQMEL~PRIOK
          VIQMELBEZDT VIQMELAUFNR VIQMELTPLNR AFKOGLTRP into corresponding fields of table GT_ITAB
             FROM VIQMEL INNER JOIN AFKO ON VIQMELAUFNR = AFKOAUFNR
                   WHERE VIQMELQMNUM IN N_NUMBER and VIQMELQMART IN N_TYPE AND VIQMEL~QMNAM IN NAME.
    call function 'ZSWAS_TEST'
      exporting
        qmnum         = n_number
       qmart         = n_type
       tplnr         = f_loca
       qmnam         = name
      tables
        output        = gt_itab
    if sy-subrc ne 0.
       message e000(z84433_msg_class).
    endif.
    endform.                    " FETCHDATA
    *&      Module  STATUS_0100  OUTPUT
          text
    module status_0100 output.
      set pf-status 'MAIN'.
    SET TITLEBAR 'xxx'.
    *creating custom container and grid instance
    if g_custom_container is initial.
        create object g_custom_container
               exporting container_name = g_container.
        create object grid1
               exporting i_parent = g_custom_container.
        call method grid1->set_table_for_first_display
          exporting
            i_structure_name = 'ZFUNCTIONAL'
          changing
            it_outtab        = gt_itab.
    *set handler events
        set handler z_functional=>handle_double_click for grid1.
      endif.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    module user_command_0100 input.
    case ok_code.
       when 'EXIT'.
        perform exit_program.
    endcase.
      clear ok_code.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  EXIT_PROGRAM
          text
    -->  p1        text
    <--  p2        text
    form exit_program .
    leave program.
    endform.                    " EXIT_PROGRAM
    *&      Form  handle_double_click
          text
         -->P_E_ROW  text
         -->P_E_COLUMN  text
         -->P_ES_ROW_NO  text
    form handle_double_click  using   e_row type lvc_s_row
                                      e_column type lvc_s_col
                                      es_row_no type lvc_s_roid.
    data: t_output type  zfunctional.
        read table gt_itab into t_output index e_row-index .
      if sy-subrc = 0 and e_column-fieldname eq 'QMNUM'.
        set parameter id 'K01' field t_output-qmnum.
        call transaction 'ZSMART' and skip first screen .
      endif.
    endform.                    " handle_double_click
    regards,
    swaroop.

Maybe you are looking for