I have a colleague interested in using replit.com for a class (yay!), and asked me to run some code. In an ordinary Java replit, this:
import javax.swing.;
import java.awt.;
class Example extends JFrame {
public static void main(String args) {
Example ex = new Example();
// ex.setLayout(new FlowLayout());
// ex.setPreferredSize(new Dimension(500,500));
ex.setVisible(true);
}
}
just produces a very small window at the top left of the output pane (see attached). I threw in the commented out statements for good measure (minus the //!) but it still produced the same. As you can tell, I don’t do much with Swing, but I’d like to be able to tell them why what they wrote didn’t work – and also direct them to the Swing-specific replit.
So, why is this happening? Is this expected behavior?
Thanks for any info,
Michael