this is the simple program that i write
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JFrame;
import java.awt.FlowLayout;
 
 

	public class ShowFlowLayout extends JFrame
	{
		public ShowFlowLayout()
		{
		setLayout(new FlowLayout(FlowLayout.LEFT,10,20));
		add(new JLabel("firstname"));
		add(new JTextField(10));
		add(new JLabel("MI"));
		add(new JTextField(10));
		add(new JLabel("Lastname"));	
			
		}
	
    
    public static void main(String[] args) 
    {
    	JFrame frame=new JFrame("ShowFlowLayout");
    	
       	frame.setSize(400,500);
    	frame.setLocationRelativeTo(null);
    	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    	
    	
    }
    
}
but why when i run it..only the frame with the title ShowFlowLayout generated but where is the JLabel,JTextField????
i dont know where my mistake please help me someone...thanks...please again.....
this is the simple program that i write
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JFrame;
import java.awt.FlowLayout;
 
 

	public class ShowFlowLayout extends JFrame
	{
		public ShowFlowLayout()
		{
		setLayout(new FlowLayout(FlowLayout.LEFT,10,20));
		add(new JLabel("firstname"));
		add(new JTextField(10));
		add(new JLabel("MI"));
		add(new JTextField(10));
		add(new JLabel("Lastname"));	
			
		}
	
    
    public static void main(String[] args) 
    {
    	JFrame frame=new JFrame("ShowFlowLayout");
    	
       	frame.setSize(400,500);
    	frame.setLocationRelativeTo(null);
    	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    	
    	
    }
    
}
but why when i run it..only the frame with the title ShowFlowLayout generated but where is the JLabel,JTextField????
i dont know where my mistake please help me someone...thanks...please again.....

i figure out the problem...it is in the main method...where new ShowFlowLayout should be created...

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.