can you create a 3D component using JOGL? - java

(system flagged this is being subjective but i don't see how, anyone explain ?)
Anyway, as my title asks,can you create a 3D component using JOGL?
What I'm trying to do is, imagine an empty cylinder. You cut the cylinder in two halves and you're looking into one half.
On the inside I want to stick images...not entirely sure to what purpose this will serve yet but i'm playing around with JOGL, been through the NEHE tutorials and others and the idea came to me from an app I saw on my phone.
I'm not sure how this would work but my first thought was that its probably needs to be a subclass of JPanel or JFrame for the sake of being able to easily add normal components, but then I'm not sure...
I know I need to become more familiar with JOGL but this is my little Christmas mission but I'd appreciate any suggestions on how i could do this (eventually) or if i should just leave it as an idea and continue to play with the API.

The essence of JOGL is that you create a Java component and render GL calls to it. This needs to be an implementer of GLDrawable (typically either GLJPanel if you are working with Swing and GLCanvas if you are not). You can then draw whatever 3D scene you want into it using the JOGL calls, and it behaves like the appropriate kind of Java Component (with a few restrictions).
The other thing you can do is draw your 3D scene offscreen to a GLPbuffer and then draw the resulting bitmap to the screen as part of the component.

Well ., first of all you need to setup Eclipse and create the JOGL library:
Go to the top menu bar, click Window -> Preferences and click new and type a name for your library, such as jogl-2.0. Leave the System library (added to the boot class path) checkbox unchecked and click ok.
Back in the user libraries panel, you should see your library appear and click add JARs.. and navigate to the location where you extracted your JOGL library and then open the 'lib' directory, which contains all the various JAR files and native libraries for JOGL. Select the following JARs: gluegen-rt.jar, jogl.all.jar, nativewindow.all.jar, newt.all.jar and click ok to add these four JARs to your user library. You should see them listed under jogl-2.0 now.
Click native library location and then edit on the right and select External Folder.. and navigate to the same directory all the JAR files for JOGL are in. This should be the 'lib' directory inside the location you extracted the JOGL files, and click ok.
Now you simply have to tell your project to use your JOGL user library, right click the project folder and select Properties, select Java Build Path and click -> Libraries tab at the top -> add library -> select user library and click next, then put a check mark next to JOGL-2.0 and click finish.
I hope that you want to make something created by you and not copied :)
Now ., put the code here to see what you have and if something is wrong.

Related

Automatic creation of complete class diagram from Java project

Is there a solution for automatic creation of a complete class diagram from a Java project?
I've spent significant time looking online, trying Papyrus, Jar2UML, UML2Tools, DiaGen, jGraps, Class-visualizer, but have not found any currently working solution. Although most of the mentioned tools work (some do not currently work), they do not automatically generate a diagram of the full class hierarchy. I realise this might be the holy grail, and may require parameterisation, but thought it should be possible this day.
Requirements for wider use would be:
Currently working
Easy to use, or up-to-date tutorial on exactly how to do this
Does not require manual coding
Stand alone or Eclipse/NetBeans/IntelliJ plugin
Free
If there is nothing like this available, I'm considering creating something like this.
Out of the fact I am not sure to have all the classes of a project into one class diagram is a good idea because the result is unreadable with lot of classes, you can do that for instance with my tool BoUML. After you download/install/run it :
create a new project
select Java in the global menu Languages
for the first directory dialog appearing press the button cancel (you do not have a java catalog) then for the second directory dialog select the root directory containing all the sources of Java you want to model, then wait for end
in the browser on the left in any of the created class view or in a new one you create yourself do a right mouse click and choose New class diagram and double click on it to open it
probably you need to hide details of classes in the diagram to limit its size (you can do that later but better to do that right now in case you have lot of classes), in that case do a right mouse click into the diagram or on it into the browser to edit the drawing settings and set to yes the settings hide classes attributes and hide classes operations then confirm (button ok)
use the button binocular on the top (near print button), change kind to class then use buttons search then mark them then close
into the open diagram (shown into the right part of the window) do a right mouse click and choose add marked elements placing classes in random position then redo a right mouse click and choose automatic layout (you can also move the classes by yourself of course)
As you can see all the relations between classes are drawn, not only the generalization/realization. If you want only them without having for instance to hide all other relations one by one by hand you can develop a plug-out marking all the classes and generalization/realization of the model, then changing the procedure I given :
when you edit the drawing settings also go into the second tab and set to no the setting draw all relations
rather than to use the browser search (binocular button) to select all he classes use your plug-out
Anyway, again, to show all the classes into one diagram is a bad idea except if you have few.
In the page documentation you have the reference manual and (old) video tutorials including the two ones dedicated to Java and an other one about to write a plug-out
Note you can also use Doxygen to make your diagram without using an UML modeler
Although BoUML does an ok job on this, for a large project it's not pretty.
For a better solution to fully automatically create a basic but complete class diagram from source code, try the simple extractor I put together in Java:
https://github.com/folterj/ClassDiagramExtractor
The project uses reflection, and produces a diagram from all the packages in a folder (and sub-folders).
Notes:
No command line options - clone & run setting source folder in code
This produces a gv file for use with GraphViz (dot), available here: https://www.graphviz.org/
The result looks quite good, as it groups packages together and even uses coloring.

Detect open folder in Java (JNativeHook)

I'm using JNativeHook to detect drags and clicks outside a JFrame in my program and it's running perfectly. The thing is I need a way (either using JNativeHook or anything else) to check if a folder is opened in my explorer (Finder for Mac) so that I can move a file to this opened folder. JNativeHook doesn't seem to have the option of detecting on what program or window was the click made.
I expect the output of the code I'm looking for to return the path of open folders in my system explorer so that I can move files to this path.
You will not be able to detect if explorer is opened to a particular folder. There are API's to detect things like the window under the cursor and get information like the title, however, if explorer is not displaying the path in the title, it will be very hard to detect without traversing the application components and finding the address bar of the window. See WindowFromPoint and GetWindowTextA for a staring point. It should work fine under JNA and can be combined with the coordinates returned from JNativeHook.

Eclipse Plugin Development: Extending default Java Editor/Text Hover

I've been trying develop my custom plugin for Eclipse, and basically I want to make is a "richer" version on the current TextHover. I don't know what widget(?) Eclipse uses to display the hovering text, but I want to use something different, like SWT Image or SWT Browser.
Most of the tutorials that I've read suggest that I have to implement my own Java Editor to do this, but I don't want the user to switch to my custom editor just for a simple feature (and I don't want to implement a whole editor).
Some Tests:
I've already created two Eclipse Plugin Projects. The first one is a extension for the JavaEditorTextHovers, and with this project I managed to show some custom Strings when hovering some random texts, but wasn't able to change the hover appearance. The second project was a editor plugin. With this last one I managed to get a Browser to appear when hovering a random text(this tutorial helped me), but again, this editor had nothing, no syntax coloring, no rules, etc., and for the previous reasons, I couldn't accept this has a solution.
Maybe if there was way to change the (or set a new) SourceViewerConfiguration of the current editor I could pass my custom SourceViewerConfiguration, but I'm not sure if this is possible.

How to make dock-able plugins for NetBeans IDE in Java?

I have created one analogue clock with Java. But i want to make it dock-able in NetBeans IDE (like shown in the screen shot).
like the left side navigator, files, bottom tasks are hidden, once i press it it shows in left or bottom
Any help on this, how can i tell my NetBeans plugin to act like dock-able? After making it working i would like to publish it to the community plugin.
This is not too complicated using the NetBeans Rich Client Platform. Follow this tutorial - http://platform.netbeans.org/tutorials/nbm-paintapp.html#impMod
Basically, you'll create a ClockTopComponent using the wizard. TopComponents automatically get nice windowing features for free, like docking, hiding, tiling, etc.
FAQs about TopComponent

How to create a "help / information bubble" with netbean

I'm trying to create a GUI with netbean, and I've created a tool bar with different icon. What I want to do is this: When you mouse over one of the button I want a little text bubble to appear with text that I will have specified.
I've been searching the web for a while, and all I could find was something about this package: "org.openide.awt" wich contains (in theory from what I've read) NotificationDisplayer.
If this thing really works with java and netbeans well, I can't get it to work. All I need to know is does this package is actually netbean/java compatible, or better, if there is a simpler way to display a text bubble.
A tool tip?
The JComponent API has support for that.
Check if this is what you need:
How to Use Tool Bars
ie:

Categories

Resources