"bubble clusters" project (draggability, grouping, drawing, merging groups) - java

I am interested in creating a bubble-clusters-like project in Java (see http://www-ui.is.s.u-tokyo.ac.jp/~takeo/research/bubble/index.html for a working example).
My goal is to allow the user create a bunch of post-it notes that can be grouped and moved around like the example. (There will be other features, but I am having the most difficulty starting this feature). I will be using Java and Swing.
Here are some things I am reading up on:
-draggability (first priority, using JTextAreas?)
-grouping
-merging
-drawing (wont worry too much about that now)
I am not too experienced with creating Java GUI and swing, so I don't know how difficult it would be. Any thoughts or readings/tutorials?
Thanks in advance.

Check out the implementation of Bubble Sets by Christopher Collins (http://faculty.uoit.ca/collins/research/bubblesets/index.html). His source code is free and easy to use.
Also, the Prefuse visual toolkit (prefuse.org) would be a great way to (i) get a project running quickly and (ii) see how a good visual toolkit is written. Draggability, rendering, layouts, interaction, and many other features are given in this toolkit.

This might be relevant to your interests: http://www.oldamascus.com/~lio/vis/graphlix/. Note the clustering :) It's Processing, but the code can be easily ported over to Swing (Processing is basically just a programming 'environment' where loads of useful functions are dumped into one file).

Related

JavaFX and Swing --- finding a middle ground?

I am so-so with Swing and just starting to learn JavaFX. I went over a few answers on SO with regards to which one to use and I still can not make up my mind.
Is it possible to get the best of both the worlds ??
Like, use JavaFX with I want to give some visually appealing graphics and add some Swing to JavaFX when I want to ?
You can use JavaFX in Swing applications via the JFXPanel control. See the SwingInterOp sample. You can also utilize JavaFX from inside sophisticated Swing based platforms such as NetBeans RCP.
A current limitation of JavaFX/Swing integration is that you can embed JavaFX components in a Swing application, but not Swing components in a JavaFX application. RT-12100 Swing in JavaFX embedding support is currently scheduled for Java 8.
If you have a green field new application to develop, I'd advise choosing one technology or the other and sticking with that or at least keeping the integration points localized and few and far between. Both frameworks are large and take time to learn, plus you will avoid any integration headaches such as needing to take care that Swing processing is done on the Swing Event Dispatch thread and JavaFX processing is done on the JavaFX Application Thread.
JavaFX also integrates with SWT and that integration is currently simpler than the JavaFX/Swing integration (because there is only a single GUI thread to worry about).
Here is a screenshot of JavaFX/Swing interop sample from Oracle:
I went over a few answers on SO with regards to which one to use and I still can not make up my mind.
Rather than doing that, I'd advise picking a small application and implementing it from scratch in Swing and JavaFX and seeing which you prefer. It's time better spent as there is no substitute for hands on experience - then, if you still have questions (hopefully more specific and targeted), come back to StackOverflow to research or ask them.
It depends on your motivation for learning them. If you're looking primarily to boost your CV in the near future and become attractive to businesses, then (for the moment at least) there's many more applications out there written in Swing than JavaFX, purely because the latter is a much newer toolkit.
However, if you're thinking more long term or just want the best tool for the job, personally I find JavaFX to offer more flexibility, be much easier to code in an aesthetically pleasing way, and easier to learn as well (the API behind it is just much nicer.) The only thing against it at the moment is that there's some features that I'd really like to be included, but aren't yet (again, naturally this is what you get by going for the newer toolkit.)
I'd also advise against mixing the two. I'm currently involved in two projects using JavaFX, one entirely JavaFX based and the other a mixture of FX and swing. The latter is much more fiddly to maintain, primarily because of the difference in dispatch threading.
As a previous poster stated, you can use JavaFX in Swing applications now. But since Oracle has declared that JavaFX is the future of the desktop for Java, why not just learn it. I've tried to keep current on both and it's a chore. I'm planning on focusing on JavaFX exclusively in the future -- less chance of confusing myself.
That said, JavaFX still doesn't seem to be a full-fledged member of the JDK, especially if used in conjunction with other languages, like Clojure for example. Depending on the JavaFX version, there are different machinations to go through to pull it into build tools. But that situation is getting better with each release.

Designing a UI for Programmers to Use

I am doing UI design for a group of programmers who are working on building music-related software. I have created .psd files for all of the mockups, graphics, etc.
I was assuming they just needed the (many) images to put into the code, but they want me to use a GUI to spit out the necessary code. (I looked at Antetype, but it just seems so basic compared to my Photoshop mockups.)
My question: Is there a GUI tool that can build VERY UNIQUE designs, and can export the mockups in code using MatLab or Java? -- Or should I just say no and give them the images to use in the code. (we are talking guitar-pedal knobs, EQ sliders, etc.)
Netbeans has a decent swing WYSIWYG editor for Java GUIs that's certainly worth looking into. There's going to be some significant back-end work getting your graphics to look just right if you have particular/complex designs in mind, but that said customizing Java GUI's is much easier than MATLAB. . . I believe eclipse also has plug ins available for this same sort of thing.
Anyways, that is probably the closest you'll get to a nice drag-n-drop interface in Java for GUI design.
JFace is also a pretty spectacular framework that sits atop SWT for building Java GUI's. I would say that it's power lies in how it handles different windows/components, but of course the trade off is that it's more complicated to put together (no WYSIWYG that I know of)
Also consider the Microsoft route, Visual Studio is designed to take the pain out of layout designs in writing Visual Basic/C#/.net applications. If you're a student your university probably has a deal to get you a free copy (mine did) otherwise visual studio express should be free (I think? ...citation needed?)
To create a UI you can use some tools, Netbeans in first .. but i think that is better to create a consistent code using simple layout and component, so doing it by hand (Oracle interesting tutorials). If you aren't a java programmer i suggest you can simply give them your image.

Using MVC in a Java app

I need to write a cross-platform GUI application to process (in multiple threads) and visualize fairly large quantities of data. Ideally the application should be relatively fast and look good.
The app's interface will consist of a table widget, a tree widget, and a custom figure-drawing widget. The user will be able to modify the data from any one of these widgets and the changes should be immediately reflected in the other widgets.
Naturally, I am planning to use MVC. However, I normally do all my GUI programming in C++/Qt, and have very limited exposure to Java. So I would really appreciate any advice on how to organize such an app in Java. In particular, should I use Swing or JavaFX? Which widgets would you pick for the job? Could you recommend any books/online tutorials that cover these aspects of the Java platform?
I will greatly appreciate any feedback. Thanks!
That's a very subjective question.
Swing is a mature, well established and documented API. It's been operating for over 12 years and has many 3rd party supporting APIs.
JavaFX is a relatively new technology and while it's use is growing, it's still relatively immature in regards to things like it's documentation (particularly 3rd party trouble shooting and tutorials).
With JavaFX 2, you now get a tree and table implementation and are no longer restricted to it's scripting language.
As I understand it, JavaFX's rendering engine is far more up to date then Swing's (Swing relies on AWT and its rendering engine, which "can" cause issues in some edge cases - this has been a criticism of Swing for a while now (the reliance on AWT)).
Swing has been used in a large number of large, high quality, high demanding applications for a number of years and while I'm sure JavaFX can probably meet the challenge, the number of projects of the scale aren't very numerous.
It's a question of bleed-edge as opposed to proven - IMHO.
Personally, I'd fall back to Swing, but a lot of that comes from experience and knowledge of available support. However, if I was given the chance, I'd probably be interested in prototyping a solution in JavaFX and Swing to compare not only the technologies, but also the development process.
When first released, JavaFX was targeted at competing within the same space as Flash. One could argue, it was Sun's attempt to replace/update the Applet API. I don't think this is JavaFX's only direction now and JavaFX 2 has seen some significant enhancements (including the inclusion of a Tree and Table view and less of a reliance on it's scripting language).
Some may suggest that JavFX is Swing's replacement and that Swing is deprecated. This is not true. While it is true, Swing has not seen any major updates in the past few years, it is viable and core library.
...IMHO

Java Monkey Engine Tutorial

I've worked my way through the tutorial series of jme and feel like I've understood the basics. Now I would like to create a first very simple game. Nothing fancy just a simple test scenario: The player should be able to move an object. Then I would like to expand it. However I don't know how to start. It's hard to explain but I just don't know where to put my code. The manual says that there are "controls" (implemented as interfaces) that let you hook your code up to frequent update calls or other events (that's what I understood) but I can't grasp how to use them.
More detailed description. You could skip this:
To get the point clear - I'm coming from the engine Unity3d. The usage was quite pleasant, the community helpful and the documentation great. But you have to spend about 1000$ to get the full version and be allowed to use pro features (shadows, custom shaders, some advanced tools,...). After a while the temptation of open-source was simply to big. In unity3d you basically have an advanced 3d editor and a scene graph. You can place objects in the scene and access and modify them over the scene graph. You can use predefined objects such as lights or particle systems and change them to suit your needs but most things you use are custom made and puzzled together by different components: a mesh, a collider, a few scripts. And this is where your code comes to work. In unity3d your program is split into small scripts and these are added to the objects of each scene. The scripts have access to the underlying engine, the properties of their object and can use a special framework for math, networking,... Each script can also define functions to be called in certain events: update(), onCollisionEnter(Collider other), onTriggerEnter(Collision other), ...
This was extremely easy to use. Admittedly huge architectures can be difficult to implement but this setback was complemented by very high productivity.
Frankly: I need advice how to structure a simple game with JME.
What architecture do you recommend ?
How are controls used ?
I would appreciate a link to a tutorial (I already read the flagrush series) or any other resource.
Thank you for your help
I'm not sure how well you read the tutorials but they quite literally explain the things you asked for.
Anyway, you code everything so you don't add an object and put code in it you instance an object trough code.
Input is handled by the InputManager, as long as you still use SimpleApplication as foundation you don't have to think about it and use it the way you learned in this tutorial

What to use for writing a user interface?

I've written a series of classes to interperet data from a serial port. This data needs to be displayed on the screen. I am trying to go for straight up eye candy with a refined look.
Swing UI- Easy to program, yields mediocre results
Open GL- Hard to program, yields good results.
Are there any other options?
Give SWT a go, the API is a lot simpler than Swing. Here is a recent question outlining the differences between SWT and Swing.
I'm not aware of any alternatives, but in my opinion it is possible to write beautiful GUI with Swing. Just changing the ugly default look and feel goes a long way. Visual appeal just doesn't seem to be a top priority for most Java coders and therefore you have to make an effort to make anything pretty.
JavaFX maybe? Didn't tried it yet, it obviously offers some eye candy.
You can use NetBeans combined with JOGL (Java bindings for OpenGL) or simply with Java2D.
NetBeans has an easy GUI Builder for Swing applications -- you can make beautiful interfaces (if you get into it), easily change the Look&Feel, etc etc.., and you can use Java2D or JOGL for visualizing your data and embed it in the GUI to display it.
There's a plugin for JOGL for NetBeans so getting started is hassle free.
use html, css, javascript. Much easier to get wizz-bang UI than using Swing or related technologies.
For my projects at work, we have purchased a licence of JFormDesigner.
This is really a great tool that saved us a lot of time.
Writing Swing application by hand can be a real pain and is awful to maintain.
This tool choose the right approach : The model-view-controller.
The GUI builder creates XML files for you that represent the interface. These XML files are loaded at runtime and transformed into Swing objects. The builder also generates Java stubs that you can fill with event handlers.
It also handles Localization and nice layout goodies.
Give it a try.

Categories