Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: swing or javafx or ?

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Thanked 0 Times in 0 Posts

    Default swing or javafx or ?

    hi expert people!

    i do not have any experience in GUI in Java and i suddenly have a task to create an application that performs the following:

    users should be able
    1) to draw initial rectangle area
    2) place or draw and be able to move, rotate and scale smaller rectangles on the first area
    3) for every smaller rectangle it should be possible to assign two numbers
    4) place or draw some kind of connection lines between rectangles (roads) (should be possible to set width of the connection line)

    the application should be able
    1) return the area of the first big rectangle and area of every smaller rectangle
    2) return the total area of the connection roads
    3) return the assigned two numbers for every small rectangle
    4) return the exact position of every smaller rectangle and distances between them

    so, the question is - is Swing a good choice for that, should i look into JafaFX for instance or something else?
    i would be glad to receive any tips and thoughts on how to achieve that)
    might be you can advice me some good books on Swing or 2D graphics in Java.

    thanks a lot!

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 688 Times in 675 Posts

    Default Re: swing or javafx or ?

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    You'll find the most tutorials online and help in forums like this one if you choose the Swing route. JavaFX is an okay option, and you'll be smarter at it than most if you complete the task using JavaFX, but you'll be largely blazing your own trail.

    The basics for drawing or painting in Swing are in the lesson, Performing Custom Painting. There are similar, largely 3rd party, tutorials for JavaFX that you should be able to find.

    Good luck!

  3. #3
    Junior Member
    Join Date
    Mar 2014
    Denmark, Albertslund
    Thanked 1 Time in 1 Post

    Default Re: swing or javafx or ?

    You can also use booth off them.

    But swing is best to painting and graphics things.

  4. #4
    Forum VIP
    Join Date
    Jul 2010
    Thanked 329 Times in 305 Posts

    Default Re: swing or javafx or ?

    But swing is best to painting and graphics things.
    I'd like to disagree with this statement. I've been blow away by some of the painting and drawing abilities in JavaFX. With that being said, if you are familiar with Swing, there is a bit of a learning curve which can make JavaFX feel worse, but once I got used to it, I found it far better.

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

Similar Threads

  1. JavaFX
    By bodylojohn in forum JavaFX
    Replies: 1
    Last Post: February 14th, 2014, 05:00 AM
  2. javafx problem
    By darshan.bhogale in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 7th, 2013, 06:29 AM
  3. JavaFX on javaprogrammingforums
    By cselic in forum Forum Updates & Feedback
    Replies: 1
    Last Post: July 31st, 2012, 03:48 PM
  4. [SOLVED] JavaFx
    By chronoz13 in forum Java Theory & Questions
    Replies: 2
    Last Post: August 28th, 2009, 09:13 PM