AWT bridge's "Hello World" - swing

I've heard about the JavaFX->AWT bridge (or hack) for a moment now.
But examples I find are quite fuzzy or blur to me.
So, if anyone knows an "Hello World" example for this bridge I'd be really interested !
(Just to be clear I don't need a way to embed a Swing component in a JFX animation or to launch a JFX from a Swing based program, I really need to embed some JFX inside a panel).
Thanks in advance ^^

If you need to embed JavaFX inside Swing, I recommend to take a look at this hack.

The link above does not work for JavaFX 1.2, see my blog entry on this.
Nonetheless, this is still a hack.
The JFXtras project is incorporating support for this.

Related

How to render basic HTML markup inside a JPanel in Java Swing?

I want to do something really simple like this:
JPanel htmlPanel = new HtmlPanel("<html><body><h1>hello world</h1></body></html>");
I think I had seen code somewhere that did exactly this. What about CSS and JS? Can the JPanel be made to support this easily? Are there libraries somewhere that do what I am asking for?
Check here to see how to add CSS support to your JEditorPane. You will need an HTMLEditorKit.
I do not see why you would need JavaScript support for a JEditorPane. The basic use of it is to render Help pages written in HTML and CSS.
If you need to have the real McCoy embedded into your application, try the Lobo Java Web Browser. Lobo does JavaScript and CSS and is open source 100% Java.
November 2015: The latest fork of the Lobo Browser is Lobo Evolution.
Sounds like you were thinking of the JEditorPane. It can display html from e.g. an URL.
Swing tutorial, Editor panes.
The support for javascript is nonexistent.
You can try out third party components such as flying-saucer, which is a XML/XHTML and CSS 2.1 renderer in pure Java.
In case anyone is still looking for an easy solution to just enable display of HTML-Markup: Use a JLabel and enclose the text in '<html>' and '</html>' (body tag isn't needed).
Have a look at How to Use HTML in Swing Components. I just came across this when looking for an easy way to display data in tables, and it works like a charm.
There was JWebPane, a Java component based on WebKit, but that project seems to have died a long time ago and/or has just gone quiet. Some people are still hoping it will be released, The other one I know of is WebKit for SWT, but it appears to be for Win32 only. :(

Sencha Touch: How the heck does this framework work?

I am having an absolute nightmare trying to build anything of value with Sencha Touch. The docs seem to describe everything in bits in pieces without every tying everything together..
One of my key gripes is that I don't understand how anything is loaded into the browser.. If I simply define an Ext.List in index.js within this method:
Ext.setup({
onReady: function() {
}
})
Then that Ext.List is loaded into the browser for some reason. If I define multiple objects in that method, how does it know which to put into the browser? Furthermore, when I extend Ext.List and put that in the above method, nothing happens. What's going on?
Better yet, where I can find good documentation that explains how this framework works? I've pored over everything on the Sencha Touch site, including the tutorials, and all of it is horribly incomplete.
It does seem confusing at first. What's important to understand is that Sencha Touch different from jQTouch or jQuery Mobile in that you create your interface in a completely programmatic way, os there's no defining the UI in a HTML file or anything like it. The framework is written much more in the tradition of classic widget set's, QT for example. This style isn't something traditional web developers are used to, but I'd actually say the documentation is quite complete. It's just not written in a style familiar to web developers.
This is how it works: one component needs to have an attribute fullscreen: true set on it. This component becomes the root, and all other visible UI components are added to this component using the .add() method. But there all defined in Javascript. That's the most crucial thing to remember.
You have probably already found it, but the main documentation repository is the API documentation (here). If you're going to get anywhere you will have to get used to reading stuff from here quite a lot. Important facts here is that everything in the UI inherits from the Component class, and that Panel is probably
When I was getting started, I found this page a little bit better for starting. I especially recommend Drew Neil's excellent screen casts on panels.
I think this has a lot to do with the fact that Sencha Touch is still a young library, and that it has it's roots in the highly programmatic and OO-centric Ext.js framework. Taking some time to really learn the fundamentals of Ext.js probably helps a lot in the long run when trying to get going with Sencha Touch (tip: Observable is the most important class).
So sorry, you're right that the documentation isn't very friendly. But the UI you get from Sencha Touch still blows the competition out of the water when it comes to mobile interfaces, so I'd say that it's still worth it if you're really want the most slick mobile UI there is.
I recommend you to checkout the conference videos http://www.sencha.com/conference/videos specially the "Structuring Your Sencha Touch Application", I restarted an app from scratch following the MVC pattern explained in the video, in two days I got where I was before plus a ton of fixed bugs but most importantly now I really understand what I'm doing and why it was so hard to get things to work before using this standard pattern.
I found one of the best places to learn sencha touch is this 4 part series on building a simple SenchaTouch1.0 app :-
http://miamicoder.com/2011/writing-a-sencha-touch-application-part-1/
Follow it up with the MVC example :
http://miamicoder.com/2011/writing-a-sencha-touch-mvc-application/
Having completed the above tutorials gives you the comfort and confidence to approach SenchaTouch's own documentation, tutorials and screencasts.

Drag and Drop from Flash/Flex to HTML and Vice-Versa

Is there a library simplifying the process of dragging and dropping between the Flash/Flex environment and the surrounding browser?
I've done some research on the process, and so far the closest thing that I have found is from HTML to Flash in a Floorplanning application. I have yet to find a demo going in the other direction however.
Is there a simpler way to do this now?
I didn't even think it was possible at first until I looked at that link, and I agree with their description that it will be very difficult to get working on all browsers / OS's.

Flash parser for html

As I was working on this project for a friend of mine who is terrified of changing from HTML to flash, I realized that maybe there could be a bridge between them. So I started working on a flash project that would grab the HTML from his page and parse it to display it in flash. Although I am sure there are resources available for this already, I figured that the experts on SO might be willing to suffer through the logic of one user trying to develop this script.
So basically, I am not asking for an answer, I am asking for some step-by-step direction that could be posted so other people could see the logic behind breaking down this project. I think it would be really useful (not just for me, but for anyone wanting to learn more about objects and oop).
So, much like the thread between primarily Senocular and Rampage, this would be a thread where I would be the student asking the questions in a logical step-by-step manner and someone else (or someones else) could provide guidance.
Let me know if you are interested and I can start by posting what I have already written. We can go from there and I am sure it will prove insightful to anyone who reads it. If no one is interested, or no one has the time or inclination, no problem.
Best wishes,
Jase
Who in their right mind would change from html to flash for displaying a simple website? I don't see the logic behind it, it's more like you are trying too hard. Flash has its function in the web, as well as html does. If it's just for simple displaying, using flash is just the wrong way and won't make your website any better but worse because its loading time will be too long.
Goole Search retrieved these:
HTMLWrapper
Groe.org HTMLParser
There is an article about the 1st on *drawlogic. I think the seconds' home is on sourceforge here.
Thing is, browsers already do a fine job at parsing html code. Having the flash player parse html files not only does away with any accessibility advantage your markup can offer but it also feels like reinventing the wheel. If you need to display html content, leave it to the browser.
Slightly offtopic - Flashpaper can convert most HTML pages into swf format.
Given properly "disciplined" HTML, you can use the XML parser in the player for the basic parsing. Are you really talking about writing an HTML renderer in Flash though? Or just being able to pull information from HTML dynamically?

Adding Prototip disabled Mootools. How can these two coexist?

Using both libraries will make my life easier. But there seem to be some sort of a problem. Anyone knows the solution to this? Thank you.
I agree with Dimitar, use one framework where you can, it will make life much easier. Mootools has a raft of goodies that you can plug in and get going with. I suggest you have a look at the clientcide site http://www.clientcide.com/ and their download page where you will find Tips.Pointy which will do just what you want.
http://www.clientcide.com/js
So you know Mootools has done alot of work to allow it to run side by side with other frameworks but any plugins written for them have to use these new features for it to all play nice. All of clientcide's code has been re-written to allow it to use these new "play nice" features in Moo.
Enjoy
you can make a non-prototypial library co-exist with mootools or prototype (for example, jquery) but you can't easily get libraries that change / extend the native prototypes to co-exist with each other.
chances are you can get things going if you namespace but any code that you have that depends on the first framework that you load may stop working as expected (prototypes again)
as far as i remember, there were some efforts in the past to get this going - there was a project called SmoothGallery or something.
my advice is - find a tooltip plugin for mootools and drop prototip. forcing two frameworks on your users is a bad practice anyway
good luck :)