JavaFX Drag and Drop with Interacting Objects - java

I am attemping to implement drag and drop that is not just an image being dragged around the screen but has interaction between dragged and droppedon object.
in short what I'm trying to achive is:
When i drag one 'source' object and drop it on a 'target' object the 'target' object recieves information about the'source' that was dropped on it
This ( http://rakeshmenonp.wordpress.com/2009/07/20/javafx-drag-and-drop/ ) sample application describes its actions as what I'm looking for however the app doesnt work for me. I was able to build the source (it requires a few modifications, as the yahoo shopping URL no longer works) and with a few alterations get the shopping items to show up. However there is no drag/drop functionality.
Does anyone have any other samples that they could point me toward?
All of my javafx searches for drag and drop come back with apps that just deal with moving an object on the screen, or they use 'canvas' which is no longer supported
thanks, stephanie

There is no standard Drag and Drop support in JavaFX 1.3.1 in the way you want to use it. There was an alpha preview being worked on, but it did not make it into the release. As JavaFX is being totally rewritten it is hard to say what support for DnD will be in the new release.

Check this out I found this after relentless search. the below is a drag and drop example in javafx
http://0divides0.wordpress.com/2010/10/21/image-drag-and-drop/

Related

Tooltip/mouseover text in an AnyLogic simulation user interface screen?

I would like to know if it is possible implement tooltip (mouse over) text within an AnyLogic simulation, whereby the simulation user can hover the mouse over a Radio Button or Edit Box, for example, and get context dependent help message.
I note that the AnyLogic IDE provides this for (some of) the palette icons to assist the developer, so there is support in Java presumably using setToolTipText(), but is such a feature available also to the simulation model user?
If this is do-able, an AnyLogic-specific example would be highly appreciated.
this is not possible anymore since AnyLogic UI is not using Java anymore (since they switched to web-based animation).
Unfortunately, we are bound to what AnyLogic provides us for UI capability. A while ago, they said they would add a "on hover" field for UI components but haven't yet. Do push them (support#anylogic.com) to keep this on their agenda, I would love that as well.
PS: Previously (AL7), you could use a MouseListener class
PPS: (ad) We have developed a UI library that gives you similar capability. Not hovering but standardized help messages similar to mobile app notifications: http://materialdesignforanylogic.com/

Screen Arrangement Control in Java

I am planning to implement a screen arrangement view for a desktop Java application. By screen arrangement view, I mean a view that allows to arrange several rectangles around a central rectangle, so that no gaps are allowed, much like the screen arrangement interface in eg macOS or Windows works:
The user would be able to drag the rectangles (except the central one) around and place them somewhere adjacent to another rectangle (that is connected to another rectangle that is connected to another rectangle .... that is connected to the central rectangle). The rectangles would automatically move to a correct spot if dropped at an incorrect spot.
I have experience in Java (Android), but little knowledge of User Interface design on desktop Java. I am using Swing for all UI I have already in my application.
I have done some research but could not find any similar implementation or question on SO.
However, I do not want to reinvent the wheel, so before I start implementing from scratch, I have these questions:
What search terms could I use for further research?
Are there any built-in components I could use as a base?
Is there maybe an open-source component I could use?
Does anyone know an implementation of such a control in any language that I could use as a reference?
How would you implement such a control?
Any help is highly appreciated!
1.What search terms could I use for further research?
One of the search term you can use is drag and drop (and that is what you plan to do).
2.Are there any built-in components I could use as a base?
Java has built in classes for drag and drop. Take a look here: Drag and Drop Turotial
3.Is there maybe an open-source component I could use?
I am sure there are quite a few if you try Googling it. But, personally I don't think you need an open source component to perform your required task. Java Swing already has pretty good classes available which is easy to use and more than enough to handle what you want.
5.How would you implement such a control?
Other than using the DnD from Java, a similar feature can be implemented using custom painting + various listeners such as Mouse motion listener. This way, you set what ever rules you want over the components that is being dragged / clicked / mouse-over. For example.

GWT- Need Disclosure Container to open horizontally

I have been looking all day for a simple way to modify the disclosure container to open horizontally rather than vertically, to no avail. I am a beginner Java/ GWT programmer btw.
I have figured out GWT does not directly have a current solution. Additionally, the GWT HorizontalSplitPanel will not suffice. I need a button that the user clicks to close a left side panel of links. When the button is pressed again, it will expand the tab to show the links again.
IOW: i need something similar to what google uses here:
https://groups.google.com/forum/?fromgroups#!overview
(when you click the expand arrow on the left hand side of the page)
I need to make this into a container in GWT, available to put widgets inside and outside of it. Any advice for this? Do I really need to create a Java animation and everything from scratch?
I need this functionality too. Did you come up with a solution? I was thinking we could extend SplitLayoutPanel and add in the button/widget to expand/collapse.

How Do I Rotate A Widget In NetBeans Visual Library?

I am building a document layout editor in NetBeans Visual Library API, and I am looking for a way to let the user rotate a widget about it's center with the mouse. How would I go about adding this functionality?
UPDATE
I think I need to clarify, this is what I want to accomplish:
User clicks on a Widget in my NetBeans Visual Library API based document layout editor
User drags the mouse. As the user drags the mouse the Widget rotates about it's center
User release the mouse button. The Widget remains in the rotated position.
I am not using an NetBeans Platform or an IDE.
Looking at the API doc for Widget, I don't see how it is possible.
There is another approach I can suggest.
extend Widget (the relevant widget you are interested in), add support for rotation. In paintWidget method, add a line
graphicsContext.rotate(angle)
The angle will have to come from your model or user interaction. How you build the user interaction is another exercise, but this approach should work.
If you need something which is already provided, then simply copy the source in your own class and add support for rotation.
If you have already come across a better way, I would be happy to learn about it.

Design a GUI for a J2ME app

How do I create a J2ME app for cellphones with a GUI similar to the menus you see in Java games? I've tried MIDlets with Netbeans but they only show you one GUI element at a time. (textbox, choice, login, etc)
And which Java IDE would you typically design these GUIs in? Netbeans or Eclipse? and is IntelliJ IDEA usable for this aswell?
Do I have to write/get a library that draws GUI controls to screen via bitmap functions .. and keeps track of the keys pressed for focus?
Try to use LWUIT - nice UI toolkit for j2me:
https://lwuit.dev.java.net/
http://lwuit.blogspot.com/
You can also use minime: http://code.google.com/p/minime/
It's an open source GUI library for j2me. miniME works on canvas level (lowest level in j2me) to draw every control so your UI will look exactly the same whatever the handset it'll be running on. Other advantage are:
- miniME uses its own event loop to manage user controlled event (botton pressed, softbar, ..), so you Application will "behave" the same whatever the handset.
- miniME support the concept of Views and stack of view, in order to make navigation between different view/screens very easy.
Here is an example: A View is what you have on the screen at a given moment (for example the main menu screen), then to go to a sub menu, you create a new view, and by calling a simple API, you push it in the stack of Views. The previous view (the main menu) is still existing, but inactive. When the sub menu view complete his work (for example, user press back, or do a selection), you can just go back to the previous view by calling a pop api.
Your question is a bit vague to give a specific aswer, but you might want to check out LWUIT or Polish, you can develop both with either Eclipse or Netbeans.
As far as designing GUIs go, neither IDE will help from a visual perspective. J2ME UI development is all done in code, beyond creating any initial graphics in a proper graphics editor you don't get to see your output until you test.
Read up on the LCDUI package documentation which explains how the UI classes work and the differences between the 'High-level' and 'low-level' APIs.
I can't comment on which IDE to use - but I do know that to create custom UI (like the ones you see in J2ME games), you have to explicitly draw the GUI controls.
Beware that you may need to customize the GUI depending on the target phones. You have to cater for different screen sizes, key pad configurations, default theme etc. This would probably mean that you need different builds for things like different screen sizes which would drive up your Java Verified certification costs (if you need it).
You may be able to find a set of nice looking UI controls that you can buy online and use (try J2ME Polish). The easy way out of course, is to use default J2ME controls :)
Links to many j2me GUI libraries: link1, link2
I know that kuix is not bad and free - watch demo.
But i prefer to make my own gui elements - this is much more flexible (but takes some time).
As for IDE - you may want to make some kind of gui-editor tool, construct interface in it, save result to some file, and read it from your app.
It's way too cumbersome to write your own GUI, especially since there are so many available these days. If you're familiar with desktop development in VB.Net and C#, you might find "J2ME GUI" easy to use. You can download it from http://www.garcer.com/. It has a similar feel and makes it easy to learn. This is the kind of GUI that I expected to come standard with MIDP2 when I started mobile development. Would have solved a lot of issues.
If you are familiar with web stuffs then you can use KUIX (kalmeo.org/home/index) framework having xml and css supports. In place of It you can use also Polish framework (www.j2mepolish.org) it's also uses the xml in easy way rather than kalmeo kuix framework.

Categories