Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Java's answer to WPF? [closed]

Tags:

java

.net

wpf

I'm mostly a .Net person at the moment, but I've been playing with Java some lately-- exploring what's out there.

Now I'm looking for the Java equivalent for WPF. I know I could find an OpenGL library or two out there, but that's not really as rich or simple as the WPF system.

like image 694
Joel Coehoorn Avatar asked Nov 12 '08 20:11

Joel Coehoorn


People also ask

What is the replacement for WPF?

Universal Windows Platform. Both Windows Forms and WPF are old, and Microsoft is pointing developers towards its Universal Windows Platform (UWP) instead. UWP is an evolution of the new application platform introduced in Windows 8 in 2012.

Will WPF be discontinued?

It may indeed get phased out eventually “The WPF's goal in user interface and graphics rendering in the . NET Framework 3.0 release is to provide a windowing system for the desktop environment on Microsoft Windows.

How do I know if a WPF window is open?

In WPF there is a collection of the open Windows in the Application class, you could make a helper method to check if the window is open. Here is an example that will check if any Window of a certain Type or if a Window with a certain name is open, or both. Show activity on this post. Show activity on this post.

What WPF means?

WPF stands for Windows Presentation Foundation. It is a powerful framework for building Windows applications.


Video Answer


2 Answers

I think a combination of JavaFX, Swing, Java2D, and Java's browser-based JRE comprise the solutions that WPF provides:

  • JavaFX applications (actually, any Java app) can run in the browser or on a desktop
  • JavaFX provides high-end video support
  • JavaFX provides for scripted animations and visual special effects
  • Swing provides UI capabilities, and can be used in both Java and JavaFX
  • Java2D, which provides the underpinnings for all drawing tasks (including Swing), takes advantage of hardware acceleration and DirectX support
  • The JRE on the desktop or the browser enable Java applications to be deployed to multiple environments (including other screens, like set-top boxes or phones)
like image 70
David Koelle Avatar answered Sep 17 '22 21:09

David Koelle


I've programmed Aqua, Macintosh Quick Draw, Windows GDI and GDI+, Qt, and .NET Winforms and WPF is by far the most sophisticated API I've used. Although it has a pretty capable feature set that's better than preceding technologies such as swing, it's no match for WPF. It solves some major problems that have plagued graphics programming. If you're coming from the HTML/JS world, it is easy to learn, but if you're coming from the traditional graphics programming world, it's a major paradigm shift. Regardless, it's much easier to learn than CSS/HTML/JS. It's a clean break from the legacy concepts which plague other graphics programming environments.

The biggest strength of WPF is that it's resolution independent. It can scale across devices with little to no modifications. It requires little work to take a screen version of a drawing and output it to a high resolution printer without resolution loss.

It also supports event triggering. UI elements can respond to events of other UI elements or to your applications code, making dynamic interfaces possible. It makes it easy to separate your code from the UI in a way that even HTML/JS can't achieve. Elements can broadcast and listen to events and respond accordingly.

Another strength is its highly object-oriented and declarative capable API. Using XAML, you can easily construct a working interface quickly and efficiently with a few lines. Unlike HTML/JS, it is easier to learn and its output is far more predictable and efficient. You can even program WPF completely in code, but it's generally not worth the minor performance gain. A better method is to compile your Xaml into .NET code.

In addition, the tooling available for WPF is very extensive compared to JavaFX. There are tons of tools including Expression Blend available. There are also numerous tools for taking vector graphics formats such as SVG and Adobe Illustrator and converting them into XAML. Now, designers and programmers can collaborate on desktop publishing in a way that was very difficult to do before.

In summary, WPF is so comprehensive that the Mono team opted not to port it to the Mono code base. They claimed it would take many man years to fully implement a reasonable feature set. If a Mono compatible version of WPF existed, it would make .NET the de facto cross-platform application framework. In fact, it may even supersede HTML/CSS, since it is far more powerful and easier to get your head around. Unfortunately, Microsoft didn't see a business case for a cross-platform enabled WPF. It's why SilverLight/WPF lost to HTML5/JS. Thanks to this mistake, they are now forced to hand over not only the web but part of their desktop to HTML 5/JS.

like image 31
3 revs Avatar answered Sep 17 '22 21:09

3 revs