Cayden Humphreys :
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Class {
public static void main(String[] args) {
//Establishing the JFrame
JFrame frame = new JFrame("Application");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
frame.setSize(800, 500);
//adding labels
JLabel label1 = new JLabel("Label Text", JLabel.RIGHT);
label1.setText("Today's Task");
label1.setVisible(true);
label1.setVerticalAlignment(JLabel.TOP);
}
}
I have looked into creating a label for a JFrame but for some reason I am just bamboozled. If someone could please enlighten me as to why my label is not appearing in my JFrame please do because I am confused... Thank you! I am new to coding so I do apologize for asking such a simple easy question.