Find the answer to your Linux question:
Results 1 to 2 of 2

Thread: SWT Table Linux

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    SWT Table Linux


    I am new to SWT and Linux. I am have a SWT table that displays the contents of a directory. This directory contains text files. These files get displayed in a table. when i click on one of the table items i would like it to open in a separate window. the problem i have is that when i click on an item in the SWT table it opens all items in separate windows instead of JUST the one i clicked.

    i was trying to do a mouse listener but could not get it to work,

    can anyone please help me, i am really really stuck


  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    A MouseListener? That's majorly excessive...

    Let me pop up my SWT app...

    Okay. The way I have my app structured, you select an entry in the table and click a separate Button, but I assume that adding a SelectionListener to the Table will work just fine as well. The key piece of code is this here:
    TableItem[] items = table.getSelection();
    TableItem theItem = items[0];
    String chosenBoard = theItem.getText(0);
    Basically, items[] holds every selection from the table (which in my case, is a global variable), theItem is the first item selected, and chosenBoard holds the text of the selected option.

    Using this process, you should be able to only pop up the single element you want.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts