Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9288475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:55:35+00:00 2026-06-18T19:55:35+00:00

I am using Eclipse Juno (with latest patches), the latest GWT and java. I

  • 0

I am using Eclipse Juno (with latest patches), the latest GWT and java.

I am loading images into a flextable with the associated surname and firstname concatenated and displayed beneath each image in a 7 x n grid. What I want to do now is give each image a unique name and assign a click handler to it. I will then pick up a click event on an image a display the next view populated with that person’s details.

Is a flextable the correct widget to use for this or should I use a different widget to contain the image and name?

How do I give each image a unique name so I know which image was selected?

How do I pass the unique image name to the onClick listener?

This is the code I am using:

public void renderYouthMemberTable(List<YouthMember> youthMemberList) {
    if (youthMemberList != null) {
        int row = 0;
        int col = 0;
        flexTable.clear();
        for (YouthMember youthMember : youthMemberList) {
            String imageDataString = youthMember.getPhotograph();

            //Display each image with the name under it.
            Image image = new Image(imageDataString);
            flexTable.setWidget(row, col, image);
            flexTable.setWidget(row + 1, col, new Label(youthMember.getSurname() + ", " + youthMember.getFirstname()));

            //Add click handler
            image.addClickHandler((ClickHandler) this);

            //Go to next column and if the end of the columns
            //drop two rows and go to the first column
            col = col + 1;
            if (col > 7) {
                row = row + 2;
                col = 0;
            }
        }
    }

}   


public void onClick(ClickEvent event) {
    // note that in general, events can have sources that are not Widgets.
    Widget sender = (Widget) event.getSource();

    if (sender == image) {
        // handle image1 being clicked
        }
    else if (sender == image2) {
        // handle image2 being clicked
    }
}

onClick does not work yet. This is just here to show what I want to achieve.

Thanks for your help,

Glyn

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T19:55:36+00:00Added an answer on June 18, 2026 at 7:55 pm

    I think the flex table is fine for your use case.

    For the click event why dont you do it inline?

    image.addClickHandler(new ClickHandler(){
    
        @Override
        public void onClick(ClickEvent event){
            // Do something
        }
    
    });
    

    This way you don’t need to deal with firing events or using an EventBus.

    If you need to store any other information with the image just extend Image and add whatever you need. Although you probably won’t need this information if you implement your click handlers like above.

    For example:

    public class MyImage extends Image{
    
        private String id;
    
        public MyImage(String url){
            super(url);
        }
    
        public MyImage(String url, String id){
            super(url);
            this.id = id;
        }
    
        public void setId(String id){
            this.id = id;
        }
    
        public String getId(){
            return id;
        }
    
    }
    

    Then just use MyImage instead of Image.

    UPDATE:
    Added contructors

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Java Spring MVC based project using Eclipse (Juno - the latest
I'm using the latest Eclipse Juno to develop Android applications. My problem is that
I'm using Eclipse juno and osx 10.8 . I have java 7 with eclipse
I am using Slackware 14 and latest Eclipse Juno. As a regular Eclipse user,
I am using Eclipse Juno with Java 1.7 and i have created a test
I am using Eclipse Juno. When I am in the 'Java Browsing' perspective, if
I'm using Eclipse Juno IDE and phpMyAdmin. I have java application, for this application
I'm using eclipse juno IDE I have Java application which have src folder. within
I am using Eclipse Juno. I was working in Java perspective and suddenly I
I'm using Eclipse Juno and want to test my Java web app in JBoss

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.