I am seeking an API or program which I can use to create Shapes graphically in Java (specifically closed shapes). A tool simalar to paint in windows, but without the colors and such. After the shapes are created, I will be using them as part of a simulation program, so I need to get access to the actual java Shape objects.
I could create my own tool using Java2D, but I am sure I would be wasting my time as there must be some useful tools out there. However, after a long time scowering google, I had no luck. Any tips would be much appreciated.
Here's an article describing how to do it accompanied with source code that you might be able to use.
Related
I have a data flow diagram (a diagram that looks like a flow chart). It has a set of specific geometrical components like rectangles, circles, ellipses and arrows.
What I'm trying to achieve is to detect these shapes and be able to know which component is connected to which component (through the lines) and finally read the text inside each one to extract data from the diagram and do further processing. It is also notable to mention that the diagram will not be drawn by hand but computer generated so we don't have to worry about angles and ratios being inaccurate.
I'm currently working in Java and I was wondering if this is going to be possible since Java is not the best language when it comes to image processing (correct me if I'm wrong). And if it's possible I'd you guys to point out where I should start looking.
I think Java is fine, and it has many libraries to process images. ImageJ is just one example. Personally, I like to use Python, so I write scripts in this language using Java API of the DMelt platform. Look at the documentation of this projecst, wiki. Here is a link to a few examples.
Doing this in Java wasn't a great idea because mainly the lack of online resources. After a good amount of research, I found that the best and the easiest approach was the use of C# and Emgu CV which is a cross platform .Net wrapper to the OpenCV image processing library.
This example helped me to get started with detecting basic geometrical shapes like Lines, Rectangles and Triangles.
So as you can probably tell from my question I am very new at all of this. I am creating a small "particle simulator" (really just gravity thing). I am modeling both X and Y positions. My question is how do I incorporate graphics. I don't really care about re-working my existing code (in java application format). In my prevois research I came along Jquery and Css but I am not sure on how to implement either or them. Also in researcher I found java graphics but I am not sure on what or if library's are involved in making that would I only found commands. I have used them before but that was in a fake environment(codeacdemy). I have created a small GUI in netbeans using a Jframe. That leads into a somewhat second question of what would I use in a GUI to have something graphically involved.
here's a tutorial on how to use graphics in java:
http://docs.oracle.com/javase/tutorial/uiswing/painting/index.html
I'd like to render a very simple 3D scene in a java applet. I could do all the math myself and render that to a bitmap, but as I'm sure I'm not the first person in history to have to draw a few cubes to the screen, I was wondering how this is usually done.
Every place I've read has said either Java3D or LWJGL, but as I understand it these rely on platform-dependent code and need to be installed separately from Java, making them both unsuitable for graphics.
So how is this usually done?
This old page lists the demos/apps/libraries of 3D Java applets with no hardware dependencies. Unfortunately very few are open-source, others are not even downloadable.
Personally I recommend you to experiment with Java 1.1 3D renderer by Ken Perlin, which has source code available and free to use for academic purposes.
EDIT: jGL is another Java 3D library with no hardware dependencies. It mimics OpenGL 1.* API. It is licensed under GNU Lesser General Public License (LGPL).
In a plug-in 2 JRE (1.6.0_10+), you can use JWS extensions for embedded applets. This is important because JWS makes it much easier to ensure the correct binaries are on the run-time class path. AFAIU JOGL and Java 3D both offer JWS extensions for their APIs.
Should you choose to go that way, please make the applet has the draggable parameter added, so the end user might choose if they want a (mostly useless) browser window wrapped around a 3D animation.
I ran into similar problems when I needed to do some 3d rendering in an applet. My solution was to simply implement from scratch a 3d rendering library in Java. The fear was that it would be a poor performer but on an I5 processor, this proved to not be the case. The added advantage is that I was able to write the library in the way I always wanted graphics to be done. The real advantage,, though, is that it will run regardless of any need to have some graphics library installed on the client and without regard to any graphics card dependencies.
I will gladly share a subset of this code to anyone who wants to look at it.
Could you use JOGL?
http://download.java.net/media/jogl/demos/www/applettest-jnlp.html
I'm not a Java guy, but 2/3 years ago when I was at univeristy I had the same problem :)
I've tried jogl... and for noob in Java like myself I found it too complicated to configure and write something using it.
I used Java3d and it worked like a charm, the only problem I had back then, was that Java3d did not worked with all graphic cards. But fortunatelly it worked with computers at my univeristy :)
We need to implement a Java desktop application that allows us (initially) to create / edit / resize / polygons on (initially) images. Then these polygons would be mapped to objects in our domain model.
So we basically need a toolbar with the options describe above and the possibility for the example to create a polygon on the an image and then scale it, or resize it, just that.
Do you know some library that could facilitate our work?
We've analyzed GEF, Picollo, NetBeans Visual API, Plain Swing or SWT/JFace, but none of them seems to help us to achieve our goal, which is, implement a really basic image editing tool.
I would like to mention that I'm not saying that what I want to do is not possible with the analyzed libraries, of course it can be done, but I'd like to learn from your experiences which is the correct path to take for this problem.
Any suggestion will be welcomed.
You could try to use GEF and the eclipse plataform.
this article could help you.
saluti
You might look at GraphPanel, a simple object drawing program. The control components are arranged in a JPanel, but JToolBar is a more flexible alternative.
Have you looked at imagine.dev.java.net? It is a NetBeans Platform application, which, though unfinished, might provide you with an interesting starting point.
My current problem is not so much a blackberry issue as it is a java
package issue.
In the application I have a rectangular region. This region is rotated by
about 30%.
I need to accomplish two things:
when a user clicks, is he inside the region?
when a user draws a straight line on the screen,
does any part of that line intersect the region? if so, what is the
length of the line inside the region?
I know that I can write my own functions to accomplish this (after dusting
off some algebra and geometry skills that aren't needed for web forms) but
I was thinking that this is a common issue in game programming. I found
some libraries for c++ and some for c# but nothing for java.
Does anyone have suggestions for good java packages? The packages don't need to have graphical components. In fact it would be best if they just handled the geometry and calculations based on x,y co-ordinates alone.
The usefulness of this answer will depend on exactly what type (SE or ME) and what version (and, for ME, what config and profile) of JVM you are targeting. Since it's a blackberry, you are likely J2ME of some flavor - YMMV.
That said, the functions you want appear to be present in java.awt.Rectangle, java.awt.geom.Rectangle2D and java.awt.geom.Line2D.