I am just new to Java. When I run the program below I get nothing - no JLabel
is added to the window
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.FlowLayout;
public class MainProgram{
public static void main(String[] args) {
JFrame frame = new JFrame("This is the title of the window");//adding the JFrame or window
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//so it really and literally close when we
//hit the close button on the window
frame.setVisible(true);//setting the visibility
//adding the label
JLabel label_1 = new JLabel("this is a JLabel");
//adding the label to the window
label_1.setToolTipText("This is the tool tip");
add(label_1);
}
}
Any suggestions?