In Java, you can do something like this:
import javax.swing.*
And then, without declaring JButton anywhere, you can do:
JButton button = new JButton();
So a single import statement automatically makes everything under javax.swing.
a locally accessible variable. This is quite nice and saves a lot of typing. One import statement gives you everything.
With Node JS, my understanding is you would have to do something like:
var swing = require('javax.swing');
And then if you want properties of swing
available as variables you would need to do:
var JButton = swing.JButton;
And then you can finally do:
var button = new JButton();
Is there anyway to automatically create locally scoped variables from imported files with a single require statement in Node JS?