473,326 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Drag and Drop from System to Java

Hi,

I'm writing a program to accept dragging files from the OS (I'm using
Windows) to my Java application. Everything works fine, excpet that the Java
window cannot get the focus when drag enter/over. I tried to put

frame.requestFocus();

in my DropTargetListener, but it still doesn't get the focus. I'm sure that
the code is being processed (I changed it to setVisible(false) and it
works!). So is it a constraint of Windows or what? Thanks.

--

Jul 17 '05 #1
5 2576
In the api it says this:

"Because the focus behavior of this method is platform-dependent, developers
are strongly encouraged to use requestFocusInWindow when possible."

.......don't know if that'll help?
"dominic" <do*********@softhome.net> wrote in message
news:bg*********@imsp212.netvigator.com...
Hi,

I'm writing a program to accept dragging files from the OS (I'm using
Windows) to my Java application. Everything works fine, excpet that the Java window cannot get the focus when drag enter/over. I tried to put

frame.requestFocus();

in my DropTargetListener, but it still doesn't get the focus. I'm sure that the code is being processed (I changed it to setVisible(false) and it
works!). So is it a constraint of Windows or what? Thanks.

--

Jul 17 '05 #2
The result is still the same : (
In the dragOver function I used requestFocusInWindow(), and it returns true
but the window doesn't really get the focus.

But thanks anyway!

--
"Philip Barr" <ph***@blueyonder.co.uk> wrote in message
news:YR******************@news-binary.blueyonder.co.uk...
In the api it says this:

"Because the focus behavior of this method is platform-dependent, developers are strongly encouraged to use requestFocusInWindow when possible."

......don't know if that'll help?

Jul 17 '05 #3
On Fri, 1 Aug 2003 10:25:05 +0800, "dominic" <do*********@softhome.net>
two-finger typed:
The result is still the same : (
In the dragOver function I used requestFocusInWindow(), and it returns true
but the window doesn't really get the focus.

But thanks anyway!


If you're using Swing components, you may try to use the
javax.swing.SwingUtilities.invokeLater() method to do the requestFocus
asynchronously, after all events have been processed.

Cheers.

Jul 17 '05 #4
SPC
Admittedly, I was dragging between frames in my own app, but I found
that this forced the frame to the top...
Window w = SwingUtilities.getWindowAncestor(HierarchyPane.thi s);
if (w != null) {
w.show();
}

In the dragEnter method of my dropTargetListener.

HTH

Steve
Jul 17 '05 #5
Thanks all! This works fine now.

Dominic

--
"SPC" <st***@scholl.demon.co.uk> wrote in message
news:aa**************************@posting.google.c om...
Admittedly, I was dragging between frames in my own app, but I found
that this forced the frame to the top...
Window w = SwingUtilities.getWindowAncestor(HierarchyPane.thi s);
if (w != null) {
w.show();
}

In the dragEnter method of my dropTargetListener.

HTH

Steve

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
by: Steven O. | last post by:
I am seeking some kind of tool that I can use for GUI prototyping. I know how to use Visual Basic, but since a lot of software is being coded in Java or C++, I'd like to learn a Java or C++ -based...
6
by: hemant_mishal | last post by:
Hi All, I am writting a java script library which will provide inter frame drag and drop operation. The more precise will be OLE drag and drop, which means only data will be transfered from frame...
2
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
3
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== ...
0
by: Yavuz Bogazci | last post by:
Hi, i have build a form with a listbox and the function that he user can drag and drop files from the windows explorer in this listbox. this works for me when i start it on my localmachine. ...
1
by: Manuel Canas | last post by:
Hi there, This is the code that I am using to drag items from a list box and drop them into a text box. I'm not sure, but from what I know, each item on a list box is an object. Let say I get a...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
2
by: ViRi | last post by:
I am wringing a small and lite Media Player to fit my custom needs for usage while programming. I had written some drag and drop functionality like i do with other programs, but hey, the ActiveX...
1
by: Tony Burrows | last post by:
I've just spent ages trying to understand this in 1.4, but I can't always get it to work (eg from a table cell). Are there any good articles/tutorials anyone knows of about it (apart from the...
1
by: John Devlon | last post by:
Hi I would like to create a file upload system, using file drag and drop functionality. Does anyone know how ? John
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.