tags:

views:

56

answers:

2

I'm pretty sure I've done it this way before, but for some reason, the JFrame won't show up when I run it.

    JLabel originalString =  new JLabel("Original String: " 
                                        + str.getMutator());
    JLabel currentString = new JLabel("Current String: " 
                                      + str.getMutator());
    JLabel finalString =  new JLabel("Final String: " + str.getTarget());

    JPanel panel = new JPanel();
    panel.add(originalString);
    panel.add(currentString);
    panel.add(finalString);

    JFrame frame = new JFrame("Mutating String!");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
}
+1  A: 
Colin Hebert
I found the issue. I feel a bit embarrassed about this, I had a Scanner reading in user input and forgot about it...
Dave
We've all been there, comrade :) The mere act of asking a question often leads to an answer.
Geoffrey Zheng
A: 

Try to set size or check with the preferred size of your components probably because you call pack().

frame.setSize(x, y);

Sheng Chien