• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why shapes / transitions / drawing constitute a big part in JavaFX?

 
Khaled Za
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to both Java and GUI. There is a lot of materials in all JavaFX books/ tutorials teaching you how to draw lines , shapes , animate ..etc
Why would I do this? Maybe I can use some fade in/out and simple animation but that is it .. Are these things for game designers or presentations?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or graphs, or charts, or maps, or.... Why would it surprise you that GUI system would have graphics (the G in GUI) as a major component?
 
Khaled Za
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Or graphs, or charts, or maps, or.... Why would it surprise you that GUI system would have graphics (the G in GUI) as a major component?

Well, by graphic I know that it could be menus , bars , buttons .. This is not what most of us used to .. Swing for example didn't have these features neither on windows when I used to learn .NET
 
Khaled Za
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe this could turn to a similar era to the one of javascript beginnings where people used marquee and flying mice.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Khaled Za wrote:Well, by graphic I know that it could be menus , bars , buttons ..

How do you think those are drawn on the screen?

This is not what most of us used to

You can only speak for yourself. I fully expect a graphics system to support graphics.

This is not 1995 when GUIs only consisted of text fields and buttons.

Khaled Za wrote:I believe this could turn to a similar era to the one of javascript beginnings where people used marquee and flying mice.


Anyone can use technology badly.
 
Khaled Za
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote: I fully expect a graphics system to support graphics.
ha this made me laugh!
Is this available in Swing?
 
John Damien Smith
Ranch Hand
Posts: 296
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Is this available in Swing?

Java2D supports similar concepts for handling drawing shape primitives on Graphics.
Swing is just a GUI widget toolkit, so it focuses mostly on higher level controls, like buttons and tables, rather than low level primitives like shapes.

The scope of JavaFX is larger than Swing or Java2D. JavaFX encompasses most of the functionality of those toolkits (and others like awt/Java3D) and also provides additional functionality not previously found in any Sun or Oracle Java GUI toolkit.

The closest thing in JavaFX that corresponds to the javax.swing package is the javafx.scene.control package. Using pretty much only the control package of JavaFX, you can generally accomplish in JavaFX most of the tasks that you would accomplish with Swing.

JavaFX also provides additional control skin technology, FXML based layout and CSS customizations for widgets (controls). Swing has customization capabilities through look and feels, but the JavaFX system is probably simpler to use and more flexible for the majority of customization tasks (IMO).

JavaFX also has javafx.scene.canvas for a issuing a list of low level drawing commands similar to Java2D.

However, most people find it more convenient to program graphics against the JavaFX scene graph rather than the canvas as the scene graph operates in a kind of retained graphics operation mode. This mode (IMO) simplifies many graphics operations, as the programming model is more declarative and the order of operations don't matter as much. The JavaFX runtime system is helping keep track of and render all the graphics that have been added to the scene graph. This removes much of the burden from application code for doing things like tracking, invalidating and repainting screen regions. There is no similar scene graph system in-built to Swing, Java2D or other APIs that ship with Oracle JDK 8.

So JavaFX is essentially a reboot of the Java graphics stack providing replacement technology for some existing Java APIs like awt, swing, Java2D, Java3D, etc. as well as adding additional technology for scene graphs, css customization, animation, graphing and other technologies that are not provided as part of any of the awt/swing/Java2D/Java3D packages. For a quick overview of JavaFX capabilities, see the answer to http://programmers.stackexchange.com/questions/180414/using-mvc-in-a-java-app/180497#180497

In short, there are many things in JavaFX, you don't need to use all of them. If you want to restrict your JavaFX programming to just use predefined widgets similar to those provided by Swing, you can easily do that by using javax.scene.control as your primary programming API.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice post, John. A cow-worthy one!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic