I'm writing a time management application and I have an idea for presenting timelines and todo items in 3D. Visually, I imagine this as looking down a corridor or highway in 3D, with upcoming deadlines and tasks represented as signposts - more important items are larger and upcoming deadlines are nearer.
I want to do this in Java, however I have no idea how to begin. For example, I would like to be able to render text and 2D graphics (dates, calendars etc) on the floor/walls of the corridoor, as well as on task items. The tasks themselves could be simple blocks. However examples of 3D code I have seen all look to operate on a very low level, and what I can't figure out are the appropriate co-ordinates to be using, or how the user would be able to interact with the view by selecting items with the mouse (for example clicking an expand or info button to get/edit task properties with the usual swing components).
Is there any higher level API I could be using, or example code that does this sort of thing? Any other ideas for how best to approach this problem?
edit: removed Java3D requirement - I just need to do this in Java.
To be perfectly honest, most "clever" user interfaces are ineffective for a number of reasons:
They favor complexity (for the sake of coolness) over simplicity and usability.
They are likely to be totally unfamiliar to the user.
You have to implement them yourself without some library having done the hard work for you.
I think the interface you describe runs the risk of falling into this trap. What's wrong with the current interface? Won't it be really hard to get an overview due to foreground stuff getting in the way? Now of course you could take it a step further and zoom out/rotate to get an overview but that complicates things.
Having said all that, if you can make it easy to use and really slick, then it can make an application. Users will have a lower tolerance for failure in "fancy" UIs, so perhaps this isn't the best first 3D project.
I do think there is a need for more examples geared towards visualisation rather than games.
To be honest, having tried both, if you use JOGL instead you'll find there's tonnes of OpenGL examples to copy that sort of thing from, and you won't have to code around the limits of the scene graph Java3D gives you. I tried Java3D a couple of years ago in a simple wireframe viewer, and it was such a pain to get the camera control right and the rendering anywhere near OK that I gave up on it.
I've found Pro Java 6 3D Game Development to contain very good code examples.
Here's a code example of 3D text, from NeHe Productions!, check the "DOWNLOAD Java Code" and "DOWNLOAD JoGL Code" at the end of the example.
On a side-note, I was very impressed with LWJGL which makes you write in a very similar way to straight-forward OpenGL.
Related
I am in the process of porting some graphics rendering from java/Android to standard java.
The first thing that I am faced with is - which graphics api to use, Graphics2D or JavaFX.
It was proposed by assylias in my previous question "Porting graphics drawing from android to standard java", that I use JavaFX.
I have seen that this has the advantage of taking doubles and floats as parameters for drawing, as with Android.
However, I have not been able to find anything which confirms that the drawing is antialiased, or that antialiasing can be turned on.
My objective is to generate a high quality image which will be directly saved to disk and not displayed in the application. It will be displayed in another context and not printed.
I need to be drawing text, paths, beziers, lines, ellipses and rectangles.
Is it worth my while digging into JavaFX or do I have no choice but to go with Graphics2D ?
Many (if not all) of the objects that are drawn in JavaFX applications already have antialiasing effect. This is visible to the naked eye. Try to write two identical applications, one in JavaFX, and another in Swing (without antialiasing effect of Graphics and RenderingHints object). The difference is clear, especially when drawing geometric shapes and text. Here you can find some comparisons between Swing and JavaFX, and here you can get to know better the JavaFX 2.X (read the subject "Graphics System" and "Media and Images").
Personally, I would prefer to use JavaFX technology. I previously used a lot Swing. Each of my applications had to be made in Swing. However, after seeing the practicality of JavaFX, its maintainability, its elegance and productivity, I did not think twice. Even if you just want to draw simple things, JavaFX seems to have a much better performance. If I'm not mistaken, JavaFX was developed taking into account the use of video hardware on your platform, and was also inspired by the famous game engines available for Java users, which are made to work with high processing visual effect, screen updates, and among many other things.
For you marvel a bit with the technology and effort that was put, I beg you, visit this address. Look for the download of a JavaFX program named Ensemble. You will find where is written "JDK 7 and JavaFX Demos and Samples". click download and use the demo program Ensemble.
For information on drawing text, geometric shapes and stuff, see the following links:
http://java.dzone.com/articles/javafx-21-beta-improved-font
http://fxexperience.com/2012/01/lcd-text-support-in-javafx-2-1-developer-preview/ (An alternative from the previous link)
http://docs.oracle.com/javafx/2/text/jfxpub-text.htm (Look for "Setting LCD Text Support" and also, with the feature of applying effects to text and various things of JavaFX, you can still improve the visualization of what is shown to the user.)
http://docs.oracle.com/javafx/2/api/javafx/scene/shape/Shape.html#smoothProperty (The "shapes part")
Would you like an opinion of a colleague? Adopt JavaFX in its version 2.X or higher (do not use the JavaFX 1.X). Over time this type of technology will mature. Much still come ahead. The next update of JavaFX, we will have many nice features. And notice that JavaFX is still in its version 2.X. Probably in the near future Swing library will be left out, as happened with the AWT. You better start now studying JavaFX, rather than only in the future you go familiarizing yourself. The market is there.
If you still have some questions, please come back and ask. We'll be here. :)
Good luck.
I have a task that probably tons of systems can fulfill. I am looking for a system that combines performance (i.e., responsiveness on standard pc hardware) and ease of programming.
Idea:
A virtual table with notes and photos on it that the user can manipulate (others will do the same, all sync'd over the Internet, but that part is covered). The result should look beautiful: no borders, no windows, as little control elements (e.g., for rotating) as possible.
Requirements:
The programming language is Java
The table is 2D (a rectangle with wooden texture)
Objects are 2D
The whole table with all objects is zoomable
Objects can be grouped and ungrouped
Objects can be resized, rotated, and moved around
System fonts are supported (i.e., text can be rotated, streched, etc.)
Images can be partially transparent (full alpha channel support not required)
I would have used Android (which seems perfect for the task), unfortunately, the target systems are PCs and there doesn't seem to be any PC ports for the Android UI (emulation is not what I am looking for).
I am greatful for any input, especially from people who have done something similar or know such projects.
This is a project that would take a Java professional hundreds of hours to complete.
Still reading?
Your GUI choices are:
Java Swing
Java SwingFX
Apache Pivot
These GUI choices are listed in order of the amount of help you could expect to get on Stack Overflow.
Pick one, do a Google search, and start reading. Expect to spend about two months becoming proficient in one of the GUI's.
Next, get familiar with the model–view–controller architecture.
Next, start working on your model.
This should keep you busy for 3 or 4 months. If you have any specific questions, that you can't find the answer with a Google search, feel free to post them on Stack Overflow,
I am writing my dissertation this year in software engineering. I have a cool project in mind but wanted to ask if this was even possible first before I mention it to my tutor. If it is possible then it would be good if someone could point me in the right direction in achieving my goals.
My ideas is this. I want to make a Zombie survival game, generic and boring I know, but I want players to be able to run around in their own hometowns as if a zombie outbreak actually happened, the easiest way to do this would be to use the Google Maps API (I think) so maps are automatically created depending on a users home location.
And added feature would be to implement transport systems using local train stations so users can actually move to their friends areas in realtime on a multi-player platform.
So from what information I know already I would need these tutorials/resources.
The ability to import real time google maps into a Java environment
The ability to see where roads occur and where areas that can be walked on occur, maybe using the colour green as a basis for fields etc.. This is to ensure users can only walk within defined areas
The ability to generate surroundings (such as houses and fences) next to roads and walkable areas rather than have the user running around on a flat 3D environment
I already have some knowledge on creating 3D environments as it is using the JWJGL library. Each of the points stated above are dependent on the previous bulleted point. Any feedback or constructive criticism is greatly appreciated. Even just a "What the hell are you even talking about" would be helpful also.
Glad to see your replies.
It might be possible using the Google Earth API: https://developers.google.com/earth/
You would have to get a web view of some kind, basically integrating a JavaScript application into your Java application. I would be cognizant of the terms of service though.
After downloading and using Xuggler, my initial impressions are very good; it supports a whole host of codecs, it was relatively hassle free to get going and the getting started tutorial videos explained all the necessary concepts very clearly.
However, after playing around with it for a couple of days I'm really tearing my hair out over getting all the audio and video to sync up nicely. It's fine when playing normally but when adding pausing, seeking and accounting for occasional 6 second pauses while my external hard drive spins up it becomes an absolute nightmare.
I've partly implemented something already but it's nowhere near perfect - you can seek around a few times but after a while it still drifts off.
I can't help thinking this is a common use case of Xuggler and someone must have done this sort of thing already much better than I have. But alas, I can't find any examples beyond the ones on the website. Is there a higher level API around that manages all the audio / video sync issues and just provides some higher level controls (play, pause, stop etc.)? I've no problem going down the route of doing it myself if there's nothing out there already, but I've never been a fan of reinventing the wheel (especially if my new wheel is in all likelihood worse than the old one!)
This is really a two part answer - the first being yes, there is a higher level "player" framework here. It's in early stages but much better than anything I would have cobbled together quickly, and I'm sure the guy running it would be open to any improvements in the code.
Secondly, I didn't really go with the above at all because I looked to VLCJ instead which uses libVLC which in turn has all the synchronisation stuff built in nicely. To get multiple players embedded in the application reliably you need to use out of process players (see here for how I went about doing it) but once that framework is in place it works reliably, fast and overall very well.
I wanted to have a discussion on Java GUIs, right now, I'm still in school and I've done light gui development for class.(We briefly covered it.)
Plain and simple, I couldn't do anything I want, I wanted to build a nice clean layout but everything looked off and worse when you maximize it. JButton were huge when put inside a GridLayout, or they spanned the whole row, when I clearly specified the size of the button and etc. It's been one headache after another with Java gui development.
With Microsoft WPF/XAML UI development is more straightforward, it felt like HTML/CSS. Setting the width, height, margin, and padding is great, knowing where my components are going to be puts the mind at ease. And you can even design a custom Look and Feel.
I wanted to know if do you guys have any tips and resources for someone starting Java GUI development. And the one thing I don't get is launch new items with a JFrame, i.e a game.
At Launch your directed to a panel with 4 buttons.
Play Game - Takes you to a new panel to play the game.
Lobby - Takes you to a chat like interface
and etc
Should these be panels? Or more JFrames, like when a user click a button I launch the Play Game JFrame then close the menu JFrame. I really have no ideas with Java guis.
Make sure you understand and are using the appropriate layout managers. This Swing tutorial is very useful for learning how each works: http://download.oracle.com/javase/tutorial/uiswing/layout/visual.html
Also realize that you can layer layouts by putting on panel inside another. This is sometimes necessary to achieve a desired effect while keeping things simple.
For your last question, buttons can just be added to a panel that can bee adding to additional panels before a frame.
First off take a look at Mig Layout. This is a real full featured layout manager and currently is the best one available. If for some reason you can't use external dependencies then you will want to look at GridBagLayout. GridBagLayout will be powerful enough to do everything you need, but it is not as easy to use as something like Mig Layout.
In 99% of the applications you will build you will have a single JFrame and just transition the JPanels to show the different screens.
First off, one of my rules of thumb when building UI panels is to never set directly any location or size.
Then, a second rule is to never set any preferred, minimum or maximum size directly in pixels (thus will bite you when you change from one monitor to another one, with higher or lower DPI resolution). Take a look at this post on my blog, quite old but still useful today.
Thirdly, I try to avoid embedding panels into panels because it leads to components alignment problems and inconsistent component sizes.
Finally, I try to use DesignGridLayout for most of my forms, and sometimes revert to GridBagLayout if the UI layout is too complex (but a complex UI layout may also be a sign of poor UI design).
As a general comment about how to build UI applications (with any UI toolkit in general, but with Swing in particular), there are several recommendations that exist out there, but it is hard to find concrete implementations, you have to read a lot about these, and then try to find the way that works best for you.
Yes, welcome. Compared to HTML /Javascript/CSS you can get nothing like the sophistication and polish for the equivalent level of time spent learning.
(I haven't sourced all the files for you for anything here - google and start looking up).
Swing, in my experience definitely feels like I read 10 million documents, played with some demos, and spend three or four months nightly for 2-3 hours, and you have some idea of how some of the api's work, and then have no idea why some don't. Its great. You want something to work and then implement that, and proceed to f*ck up the rest of your gui.
Java swing, in my opinion, is desperately crying for an open source JQuery type plugin library that will animate your JComponents and render them in a way that you like. Its a definite second class citizen on the desktop, and especially now that CSS / HTML browser rendering sophistication has improved over the last few years.
The nimbus look and feel style is an improvement definitely in the right direction.
You could also move over to JavaFx. Good luck. Apparently its quite nice. I haven't yet had the time or patience.
If you are allowed to use thirdparty library : try JAXX as an option. The idea was to create a css type implementation, where styling elements are separated into a file that can be quickly configured and tested.
Read here for good introduction: today.java.net/pub/a/today/2006/03/30/introducing-jaxx.html
JavaCSS is found in the JAXX project. JAXX is a xml format style implementation of the swing gui interface. You write an xml document, and a css style document, and are able to bind the inputs and outputs of the GUI to your java implementation engine. The css style document allows for rapid sophisticated gui development. Using the jaxx jar engine, the xml code is converted into java code that runs as rapidly as if deployed in a .java class file.
The project has been continued by a French group of programmers and is now to be found here: http://www.nuiton.org/projects/jaxx/files
The demo is at least pretty and most things seem to work.
The latest release is JAXX 2.4.2. The latest update was May or June 2011. Whilst in French, the documentation is still comprehensible in English. Just translate.
The original ethan nicholas files of jaxx were last updated on 17-07-2009
http://sourceforge.net/projects/jaxx/
Please note: www.jaxxframework.org/wiki/Main_Page is a dead link, the site is discontinued. instead a mirror has been made and can be found at: buix.labs.libre-entreprise.org/original-jaxx/www.jaxxframework.org/wiki/Main_Page.html
This documentation is essential to understand the meaning and purpose of jaxx and its use.
If you are patient, have lots of time, and are interested, also look at the timing framework by Chet Haase, to animate your components, it is possible to create sophisticated effects. It requires learning curve and time.
Or pay to get your gui components handled by a professional third party library? (Um, the obvious answer, no-one who has spent the time and effort to learn to create a pretty gui is just gonna hand that over).
So spend three years learning and then ask for moola from others?
Another idea - I am very into exploring but it looks like it might be a nightmare to implement, despite everyone saying its so easy, get an open source webbrowser html / csss renderer embedded, and design your gui on that, using CSS / JQuery / HTML.
But it looks like you have to first compile the web browser (mozilla) from source, and then wrap that in another program (e.g. JRex) and then put the whole thing in a mini- client server like Jetty, just to have a front end implementation that you halfway like.
And that is only if the browser is actually is as compliant with the CSS2 standard and HTML4. Forget about HTML5. That is for the future.
Okay, I am grumpy today, but I don't think the gripes are completely unjustified.