Playing Video in JFrame? - java

I'm trying to play video within a JFrame, I've been looking around online for a while and everything I have tried (VLCJ, Xuggger i think its called) doesn't work, the errors I get can I can never seem to fix, the closest I have gotten is using JMF which is very old, it can never play a video file but as mentioned, it's the furthust I've gotten. Is there any good little API's / examples I can look at?
Thanks.

I guess that depends on the video, however there are a few build in mechanism.
You could use java fx http://docs.oracle.com/javafx/2/media/simpleplayer.htm
And then build javafx into your JFrame, like here: http://docs.oracle.com/javafx/8/embed_swing/jfxpub-embed_swing.htm
If embedding in java seems to be a bad solution, there is always the possibility to open the systems media player:
Desktop.getDesktop().open(new File("the.mp4"));

Related

LWJGL input with PS3 controller?

I'm kind of new to LWJGL (I have done some things with it in Minecraft), and I need some help. I want to make a mod for Minecraft where the user could have the option of using their PS3 controller. I have looked for JInput tutorials for beginners, and found none. I have also tried looking at how Minecraft handles input with LWJGL, but I couldn't find anything good.
I'm kind of desperate now. Please help, and thanks in advance.
Checkout the JInput forum at javagaming.org, there is a sticky there for getting started with JInput that has some tutorials.
LWJGL wraps JInput for controllers, it has it's own code for keyboard and mice, but everything else goes through JInput.
Regarding the PS3 controller, as long as the underlying OS has drivers for it, and exposes it via the normal method (/dev/input/event device for linux, directx for windows etc) then JInput will see it.
HTH

Any good suggestion to animations with SWT/JFace

I'm developing a desktop application using java + SWT/JFace, which I'm not very familiar. The program need to show some pictures presenting the program's progress like this.
Sorry for my poor English, I'm not sure whether it's suitable to use the word "moving", actually I mean that the diagram is changing like Flash when an event occurs. I'm considering making some flash movies to play, but it seems difficult as I need to add third-party jars and I'm not good at flash. Is there any better way to doing work like this? I need your suggestion.
Thank you and sorry for my poor English again if I made some English mistakes that troubled you :)
You can use java2d and the awt-swt bridge or there is a framework called Timing Framework which works for swt and swing.
probably you need a gif embeded in your window. java cannot paly any animations unless you have series pictures and play them one by one very soon.

Add a video file (any format) into a JButton

Is there any way to add a video (not .gif pictures) as a background for a JButton? Or even for a JLabel?
I'm still a Java beginner so go easy on me please, I'm eager to learn :)
Java does not support video 'out of the box'. It would require some extra API such as JMF. Even then, it would take effort to shoehorn that video into the background of a JComponent.
Since you are a beginner, my advice is to start with (much) simpler tasks.

How to implement animation into a JFrame

I am used to making web pages with animation using JQuery. I am now making a Java Desktop Application using Netbeans and Netbeans' Swing and without any animation it's looking pretty plain and boring.
Are there any resources I can use for a guide to implement animation into my program?
Does anyone have suggestions on what method to use?
Edit: I am not interested in something I'd have to buy.
A good starting point would be Filthy Rich Clients. Both the principles and the framework code may be helpful to you.
If you're looking for a nice look and feel then Substance might be a good way forward. It's not over-the-top animated or anything like that, but it's got a lot of skins and some in particular look very nice.
Many thanks to stemm who pointed me in the right direction.
I decided to use JavaFX (JavaFX 2 to be exact)
Here is some resources I am using:
http://download.oracle.com/javafx/
http://download.oracle.com/javafx/2.0/swing/jfxpub-swing.htm

Android drawing program

I'd like to learn android programming, I already know java, and I have already compiled all the simple "Hello world" tutorial apps I could.
I want to do something with a basic touchscreen interaction, and canvas drawing. Just "get the touch position and draw a dot there".
Can you recommend some tutorial about graphics/canvas on Android? I just want to get started, knowing all do's and don'ts for a simple situation such as this.
You will probably encounter the Canvas system. Therefore you should start with this tutorial series, where you will learn how to interact using MotionEvent.
Below link might help you http://marakana.com/tutorials/android/2d-graphics-example.html
You should look here in the documentation.

Categories

Resources