Adding jlabel to a jframe using components
I have 2 classes, My main class creates a frame and I want another class to add content to it. A bit of reading arroudn told me I should use components to do this however when I run my code the frame is empty. public static void main(String[] args) { // create frame JFrame frame = new JFrame(); final int FRAME_WIDTH = 800; final int FRAME_HEIGHT = 600; // set frame attributes frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); frame.setTitle("My Frame"); frame.setVisible(true); Component1 Com = new Component1(); Component add = frame.add(Com); } My Component class creates a JLabel public class