Hi all,
I am a VB dev by nature but I am tyring to get through a Java course. I need to build a class using swing that places the date in the upper left hand corner. Has an input field for a social security number. Has six inpuit boxes where a person could sign in or out during the day, etc. I just need to get the layout done. But I am haxing a real hard time just getting the labels to display. Here is my code:
It displays the window, but nothing inside of it. What is going on?Code:import java.awt.*; import javax.swing.*; public class EmpTimeCard extends JFrame { public static void main(String[] args) { //first thing we need to do is create a new panel (container) JFrame j = new JFrame(); j.setSize(300,300); JPanel p1 = new JPanel(); int cols = 5; int cols1 =15; int cols2 = 13; //then we need to setup the areas that the text boxes will reside JLabel lblLName = new JLabel("Last Name:", JLabel.RIGHT); JTextField LName = new JTextField(cols); p1.add(lblLName); p1.add(LName); p1.setVisible(true); j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); j.setVisible(true); }




Reply With Quote