This site requires JavaScript, please enable it in your browser!
Greenfoot back
Kartoffelbrot
Kartoffelbrot wrote ...

2014/5/9

Dragging desktop icons into a JFrame/Component

Kartoffelbrot Kartoffelbrot

2014/5/9

#
Hello guys, on your desktop you can drag your icons around. In some programes (for example the different office document writers or Paint) you are able to drag an image from your explorer into the program. Is there a component for JFrames or something else ins java that can read out these objects dragged by the mouse? Thanks to all who help!
danpost danpost

2014/5/9

#
Please refer to the last section on this page of the Java tutorials called The Root Pane.
Kartoffelbrot Kartoffelbrot

2014/5/11

#
Sorry, but I didn't found what I searched. I don't want to paint actually. I only want to read out elements dragged by the mouse in your operating system, like if you throw old data into your bin.
danpost danpost

2014/5/11

#
The Java Tutorials>Using Swing Components>Using Top-Level Containers wrote...
However, if you ever need to intercept mouse clicks or paint over multiple components, you should get acquainted with root panes. ... The glass pane is often used to intercept input events occuring over the top-level container
You will need to intercept mouse actions, determine where they occur within the pane, determine what is at that location in the pane, get the object that the icon/text/whatever at that location refers to, if any, etc. programmatically.
davmac davmac

2014/5/11

#
Check this lesson in the Java tutorials.
Kartoffelbrot Kartoffelbrot

2014/5/17

#
Thank you
You need to login to post a reply.