import java.awt.*; 
import java.awt.event.*; 
import javax.swing.*; 
import javax.swing.event.*; 

public class LoginScreen extends JFrame
{
	JLabel userId; 
	JTextField userIdT; 
	JButton userIdHelp;
	WelcomeLogin welcome; 
	public LoginScreen()
	{
		super("User Login Screen"); 
		Container surface = getContentPane(); 
		setSize(1024,750);
		setDefaultCloseOperation(EXIT_ON_CLOSE); 
		setLocationRelativeTo(null); 
		surface.setLayout(null);
		
		welcome = new WelcomeLogin(); 
		surface.add(welcome); 
		
		userId = new JLabel("User ID       :",JLabel.LEFT); 
		userId.setBounds(20,50,80,20);     surface.add(userId); 
		
		userIdT = new JTextField(40); 
		userIdT.setBounds(120,50,150,20);  surface.add(userIdT); 
			
		userIdHelp = new JButton("?");     
		userIdHelp.setBounds(290,50,50,20);surface.add(userIdHelp);
	}	 
	
		public static void main(String[] args)
	{
		LoginScreen login = new LoginScreen(); 
		login.setVisible(true);
	}
}

class WelcomeLogin extends JPanel
{
	public void paintComponent(Graphics g)
	{
		super.paintComponents(g);
		g.drawString("hey hi, how are you doing!",50,70);
	}
	
}

sorry forgot the problem.

here i'm using null layout. i would like to draw a string in the frame. i used jpanel and overrided paintComponent, but no display is coming???????

i feel like i'm not adding the 'welcome' object of jpanel to the frame properly, any idea.

tanx

You haven't set any bounds for the 'welcome' panel before you add it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.