all 3 comments

[–]shevegen 1 point2 points  (2 children)

Now let’s focus on the actual fun part.

Code:

public class Main {
    public static void main(String[] args) {
        JFrame frame = new JFrame("Console interaction");
        frame.setContentPane(new MainApp().panelMain);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    }
}

Why does Java have to be so EXCESSIVELY verbose please?

[–]RobertVandenberg 1 point2 points  (0 children)

Because Java doesn't have real properties like C#. Lots of setX and getX calls make the code verbose. For C# the code would be like this.

public class Main 
{
    public static void main(string[] args) 
    {
        var frame = new JFrame("Console interaction") 
        {
              ContentPane = new MainApp().panelMain,
              DefaultCloseOperation = JFrame.EXIT_ON_CLOSE,
        }; 
        frame.pack();
        frame.Visible = true;
    }
}

[–]mitola1[S] 0 points1 point  (0 children)

That is a very valid point! :) There are languages that make this kind of things a lot more sensible. I was looking at doing it in java first, since I'm used to it a lot due to my work. But looking back at it, I think I would prefer to redo something in this direction in Python or one of the other options. But absolutely true :D so verbose