Page 1 of 3 123 LastLast
Results 1 to 20 of 54
Like Tree6Likes

Thread: Is it worth to learn Swing?

  1. #1
    asdfg is offline Senior Member
    Join Date
    Nov 2016
    Posts
    132
    Rep Power
    0

    Default Is it worth to learn Swing?

    I heard that Swing is outdated. Because it requires alot code writing and is difficult.
    There should be newer/modern plugins/addons (whateerver you call) to use in eclipse.

    What can you recommend to use in eclipse to create GUI's ?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,395
    Blog Entries
    7
    Rep Power
    25

    Default Re: Is it worth to learn Swing?

    A lot of GUIs are still written using Swing; it is far from dead. You can create Swing applications in Eclipse easy enough.

    kind regards,

    Jos

    edit: I moved this thread to the New to Java section; there's nothing advanced about it.
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    asdfg is offline Senior Member
    Join Date
    Nov 2016
    Posts
    132
    Rep Power
    0

    Default Re: Is it worth to learn Swing?

    Programming teacher said.

    Any alternatives or something to do GUIs ?

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    5,847
    Rep Power
    10

    Default Re: Is it worth to learn Swing?

    Quote Originally Posted by asdfg View Post
    Programming teacher said.

    Any alternatives or something to do GUIs ?
    I don't understand the statement. What did your teacher say?

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  5. #5
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,722
    Rep Power
    6

    Default Re: Is it worth to learn Swing?

    Quote Originally Posted by asdfg View Post
    Programming teacher said.

    Any alternatives or something to do GUIs ?
    JavaFX is the new GUI toolkit in Java. If you want to try GUI development in Java, try that first.

    Swing is old, so outdated, yes, but it still works. It's more complicated than JavaFX, I'll agree to that, but to say it's dead, no. I am a senior developer for the past 11 years in a company that sells a Java Swing application internationally. So is it alive: hell yes. Should you make it your first choice of GUI toolkits for new projects these days: no.
    asdfg likes this.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  6. #6
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    241
    Rep Power
    3

    Default Re: Is it worth to learn Swing?

    Quote Originally Posted by SurfMan View Post
    It's more complicated than JavaFX, I'll agree to that.
    Not so sure about that. Some aspects are easier, some are not.
    Many issues with AWT/Swing were resolved, some were newly created.

  7. #7
    asdfg is offline Senior Member
    Join Date
    Nov 2016
    Posts
    132
    Rep Power
    0

    Default Re: Is it worth to learn Swing?

    Can someone give useful details about JavaFX, because internet overrun info.
    Is it plugin or needs manual installiation? Where from?

  8. #8
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    241
    Rep Power
    3

    Default Re: Is it worth to learn Swing?

    It comes with your latest JDK or JRE installation. So, if you have Java 8, you're good to go.
    In some IDE you still have to install the add-on, but that's only the IDE support and runtime platform. In eclipse the add-on is called e(fx)clipse.
    asdfg likes this.

  9. #9
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    5,847
    Rep Power
    10

    Default Re: Is it worth to learn Swing?

    Yes it is worth learning Swing. It isn't really that difficult to learn. And you will probably encounter Swing more than JavaFX (which you should also learn although I
    have only skimmed the surface). But before you learn either Swing or JavaFX I would focus on the basic Java classes (etc. java.lang and java.util). You will use those in both Swing and FX.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  10. #10
    asdfg is offline Senior Member
    Join Date
    Nov 2016
    Posts
    132
    Rep Power
    0

    Default Re: Is it worth to learn Swing?

    Quote Originally Posted by jim829 View Post
    Yes it is worth learning Swing. It isn't really that difficult to learn.
    Watched a video. They creatind diffrend java files. Im no sure if this is a must, barely can comprehend.
    Also there lacks info how to optimize JButton. It should be possible to choose resolution of it. Not just long ones from border to border.
    But before you learn either Swing or JavaFX I would focus on the basic Java classes (etc. java.lang and java.util). You will use those in both Swing and FX.
    Honestly. Cant understand those java literatures. Easier to focus on doing particular action.
    So very useful for me, when someone shows short algorithm.
    I.E. How to scan a text from a file. It was huge step forward to me. Even I didint knew what hasNext & nextLine means.

  11. #11
    asdfg is offline Senior Member
    Join Date
    Nov 2016
    Posts
    132
    Rep Power
    0

    Default Re: Is it worth to learn Swing?

    I have java FX 2.4.0
    I saw numerous posts that say, it is outdated, nolonger updated and dies soon.
    Also I find that there is javaFX 8, as it is new one. I dont know how that addon is called in eclipse market-place?

  12. #12
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,239
    Rep Power
    23

    Default Re: Is it worth to learn Swing?

    I would hope you are learning Java using Java 8, so you would have JavaFX built in...which would be FX 8.
    No need to use one of the older ones.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  13. #13
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    241
    Rep Power
    3

    Default Re: Is it worth to learn Swing?

    You can find the name of the eclipse plugin in comment #8 of this post. The latest version is 2.4.0. This is not the version number of the JavaFX API or the Scenebuilder app.
    JavaFX will be included with the Java 9 SDK and JRE and there will be primary support for Java 9 until 2025 plus another 3 years extended support. That is a very long time in the IT world.
    I can only encourage you to learn an API that has a split setup: the core graphics info in a markup language format like XML, (HTML? or JSON as meta-markup language) and the logic in an OOP language like Java. This setup is a big trend in the IT world and JavaFX follows that trend.

  14. #14
    asdfg is offline Senior Member
    Join Date
    Nov 2016
    Posts
    132
    Rep Power
    0

    Default Re: Is it worth to learn Swing?

    I have download eclipse from ninite 3 months ago.
    I was installed java fx 2.4 .
    Now i have uninstalled it. and code drops several mistakes. It requires to configure project/search repositories, but I think its caused, because I uninstalled fx 2.4 and eclipse dont have it by default.

    Java Code:
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    
    public class Main extends Application {
    
        Stage window;
        Button button;
    
        public static void main(String[] args) {
            launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) throws Exception {
            window = primaryStage;
            window.setTitle("thenewboston - JavaFX");
            button = new Button("Click me");
    
            StackPane layout = new StackPane();
            layout.getChildren().add(button);
            Scene scene = new Scene(layout, 600, 600);
    
            window.setScene(scene);
            window.show();
        }
    
    
    }
    Before uninstalliation of FX, it had no errors.

  15. #15
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    241
    Rep Power
    3

    Default Re: Is it worth to learn Swing?

    You have uninstalled an eclipse plugin. Please install the e(fx)clipse plugin. That should take care of it.

  16. #16
    asdfg is offline Senior Member
    Join Date
    Nov 2016
    Posts
    132
    Rep Power
    0

    Default Re: Is it worth to learn Swing?

    So I will.
    Is there any good sources to learn javaFX, who would explain what every line/method doing. Showing results and full code.
    I found some:
    JavaFX Tutorials
    https://www.tutorialspoint.com/javaf...x_tutorial.pdf

  17. #17
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    241
    Rep Power
    3

    Default Re: Is it worth to learn Swing?

    looks like a reasonable Tutorial to me. In order to get my feet wet, I started with a book called JavaFX 8, Introduction by example. That was a good book also.

  18. #18
    asdfg is offline Senior Member
    Join Date
    Nov 2016
    Posts
    132
    Rep Power
    0

    Default Re: Is it worth to learn Swing?

    For some reasons I fail to understand it. Very confusing, because of tons of code writing. Dont know where to start.

  19. #19
    asdfg is offline Senior Member
    Join Date
    Nov 2016
    Posts
    132
    Rep Power
    0

    Default Re: Is it worth to learn Swing?

    Java Code:
    package Button;
    
    import javafx.application.*;
    import javafx.stage.*;
    import javafx.scene.*;
    import javafx.scene.layout.*;
    import javafx.scene.paint.Color;
    import javafx.scene.text.Font;
    import javafx.scene.text.FontPosture;
    import javafx.scene.text.FontWeight;
    import javafx.scene.text.Text;
    import javafx.scene.control.*;
    
    public class Scen extends Application {
    
        Stage window;
        Scene scene1, scene2, scene3;
    
        public static void main(String[] args) {
            launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) {
            window = primaryStage;
    
            //Button 1
            Label label1 = new Label("Welcome to the first scene!");
         
            
    	        Button button1 = new Button("Go to scene 2");
    	        button1.setOnAction(e -> window.setScene(scene2));
    	  
    	        Button but1 = new Button ("go to");
    	        but1.setOnAction ( e -> window.setScene (scene2));
          
            
            VBox layout1 = new VBox(100);
            layout1.getChildren().addAll( button1,label1,but1);
            scene1 = new Scene(layout1, 500, 500);
    
            
          // / /   /  
            
            
            Text text = new Text("This is a colored circle");
            text.setX(200);
            text.setY(250);
            text.setFill(Color.CYAN);
            
           
    	        Button but4 = new Button("Go to scene 1");
    	        but4.setOnAction(e -> window.setScene(scene1));
    	  
    	        Button but5 = new Button ("go to");
    	        but5.setOnAction ( e -> window.setScene (scene1));
            
            
            VBox layout2 = new VBox (50);
            layout2.getChildren().addAll (text, but4, but5);
            scene2 = new Scene (layout2,500,500);
            
            
    
          
            
            
    
        
            window.setScene(scene1);
            window.setTitle("Title Here");
            window.show();
        }
    
    }
    Im writing a code, who changes scenes, if Button is clicked.

    There is a problem, that I want to positioning text and button location (coordinates).

    47 and 48 code line does no impact?Why?

  20. #20
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    241
    Rep Power
    3

    Default Re: Is it worth to learn Swing?

    the method .setX() sets the width of the node (not the font size though).

    If you want to move the node around you have to use the method .setTranslateX()
    asdfg likes this.

Page 1 of 3 123 LastLast

Similar Threads

  1. Learn Niche Technology , browse your book now and learn
    By tech-ebooks in forum Reviews / Advertising
    Replies: 10
    Last Post: 11-08-2016, 02:11 PM
  2. What do I need to learn AWT or Swing?
    By kkid in forum AWT / Swing
    Replies: 5
    Last Post: 10-19-2012, 05:53 PM
  3. Replies: 4
    Last Post: 07-17-2010, 10:50 AM
  4. Replies: 0
    Last Post: 08-05-2008, 10:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •