File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes SWT -> TabItem -> addListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SWT -> TabItem -> addListener" Watch "SWT -> TabItem -> addListener" New topic

SWT -> TabItem -> addListener

Daniel Eriksson

Joined: Oct 25, 2004
Posts: 5

I am trying to implement dnd from a table to different tabItems in a TabFolder, when the mouse enters a tabItem, i want the tabItem to get selected (brought to front) so that the draged item can be dropped in the tabItem. Basically I need to receive an event when the mouse enter or hovers over a tabItem ...

I tried tabitem.addListener(SWT.MouseEnter, new Listener() { ...
but it does not seem to work.

Does anybody have any suggestions ?

Daniel Eriksson

Joined: Oct 25, 2004
Posts: 5
Found the following solution :

folder.addMouseMoveListener(new MouseMoveListener() {
public void mouseMove(MouseEvent arg0) {
Point point = new Point(arg0.x, arg0.y);
TabItem[] items = folder.getItems();
for (int i = 0; i < items.length;i++) {
if (items[i].getBounds().contains(point)){

Anyone have a better solution ?
I agree. Here's the link:
subject: SWT -> TabItem -> addListener
It's not a secret anymore!