473,699 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.requestFo cus();

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

--

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

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

.......don't know if that'll help?
"dominic" <do*********@so fthome.net> wrote in message
news:bg******** *@imsp212.netvi gator.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.requestFo cus();

in my DropTargetListe ner, but it still doesn't get the focus. I'm sure that the code is being processed (I changed it to setVisible(fals e) 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 requestFocusInW indow(), and it returns true
but the window doesn't really get the focus.

But thanks anyway!

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

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

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

Jul 17 '05 #3
On Fri, 1 Aug 2003 10:25:05 +0800, "dominic" <do*********@so fthome.net>
two-finger typed:
The result is still the same : (
In the dragOver function I used requestFocusInW indow(), 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.Swi ngUtilities.inv okeLater() 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. getWindowAncest or(HierarchyPan e.this);
if (w != null) {
w.show();
}

In the dragEnter method of my dropTargetListe ner.

HTH

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

Dominic

--
"SPC" <st***@scholl.d emon.co.uk> wrote in message
news:aa******** *************** ***@posting.goo gle.com...
Admittedly, I was dragging between frames in my own app, but I found
that this forced the frame to the top...
Window w = SwingUtilities. getWindowAncest or(HierarchyPan e.this);
if (w != null) {
w.show();
}

In the dragEnter method of my dropTargetListe ner.

HTH

Steve

Jul 17 '05 #6

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

Similar topics

42
9722
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 tool. Back when I took my Java and C++ classes (two or three years ago), the available tools -- at least the ones I could find -- were still not as easy, not as "drag-and-drop", as Visual Basic. Has that changed? Is there some software out...
6
6280
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 to frame not any object. But it should happen in a drag and drop fashion. The requirement is, user will click on one object and will drag the mouse to another frame and will drop on some object the data will be passed by this and some action will...
2
4328
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 there? What about Drag/Drop; is there more than one way for the source to make data available Is it always OLE?
3
10405
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== using System; using System.Drawing; using System.Collections; using System.ComponentModel;
0
2862
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. But when i put my Apps .exe file on my WebServers WWWROOT directory and call it from the internet explorer. the application starts with the following error message.
1
1598
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 bunch of names display on a list box now, how do I get the text of each item to drop that text into a text box? Private Sub lstResult_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles...
3
10592
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
2
5338
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 doesn't support Drag and Drop. I've been checking loads of search results, but no dice, no info on how to add drag and drop to an activex that doesn't has it by default, or a hack to get it to use the drag and drop of the form itself, or...
1
4349
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 Javaworld ones I've used). Tony
1
8527
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
8705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9196
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8941
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8896
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7784
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3071
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.