noidea noidea - 5 months ago 7
Java Question

Open second JFrame and components don't show

Before you say something, i know the implications of having more than one JFrame. I'm kinda delayed and i need to add the components manually.

So, i open a JFrame that i have designed with a button click:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

JFrame DataCalc = new JFrame();
DataCalc.setSize(500, 500);

Then the JFrame shows up but doesn't show my components. I read that if i setVisible before adding components they won't show, but they're already there cause i designed them.

If i change my code and add the setSize and setLocation like the following code, nothing happens besides the JFrame opening.

public DataCalc() {
this.setSize(500, 500);

Sry for the post, i'll edit my post if you need more info.

JFrame DataCalc = new JFrame();

Should be:

JFrame dataCalc = new DataCalc(); // use the CUSTOM frame!