Border Layout ??? 
	 
	
		| Author | 
		Message | 
	 
		 
		Kyle
 
  
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 12:04 pm    Post subject: Border Layout ???  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				ALright!
 
For my end year project i decided to make a Bibliography Generator. (I know its lame and simple). So the user has to input the required information and then it will be outputed.... like i said simple. 
 
The only problem that i have is the "Border Layout".
 
It seems that the Most of the Texts Fields are hidden. But i know they are there because when i use the tab key and type stuff and hit the GUI button it outputs all the stuff i typed in.
 
 
SO my question is how will do i fix this.
 
 
 
	  | code: | 	 		  
 
import java.awt.*;
 
import java.awt.event.*;
 
import javax.swing.*;
 
 
 
public class BibGen
 
{
 
 public static void main (String[] args)
 
 {
 
  
 
  WindowName frame = new WindowName();
 
  frame.setSize (700, 300);
 
 
 
  JPanel pane = (JPanel) frame.getContentPane();
 
  frame.setVisible(true);
 
 }
 
}
 
 
class WindowName extends JFrame implements ActionListener
 
{
 
 private JTextField AFirstName;
 
 private JTextField ALastName; 
 
 private JTextField Title; 
 
 private JTextField TodaysDate;
 
 private JTextField UpdateDate;
 
 private JTextField Url;
 
 private JTextField totalName;
 
 
 
 public WindowName ()
 
 {
 
  super("Bibliography Generator");//this will give the window the name of (:Bibliogaphy Generatot")
 
  //Organized content pane
 
  JPanel pane = (JPanel) getContentPane();
 
  //Create fields for I/O 
 
  AFirstName = new JTextField(15);
 
  ALastName = new JTextField(15);
 
  Title = new JTextField (30);
 
  TodaysDate= new JTextField(20);
 
  UpdateDate = new JTextField(20);
 
  Url = new JTextField(60);
 
  totalName = new JTextField(60);
 
  
 
 
 
  // add labbled input fields
 
  JPanel inFieldPane = new JPanel();
 
  
 
  inFieldPane.add (new JLabel("First Name"));
 
  inFieldPane.add(AFirstName);
 
  AFirstName.addActionListener(this);
 
  
 
  inFieldPane.add(new JLabel ("Last Name"));
 
  inFieldPane.add(ALastName);
 
  ALastName.addActionListener (this);
 
  
 
  inFieldPane.add(new JLabel ("Article Title"));
 
  inFieldPane.add(Title);
 
  Title.addActionListener (this);
 
              
 
  inFieldPane.add(new JLabel ("DD Mo. YYYY day viewed"));
 
  inFieldPane.add(TodaysDate);
 
  TodaysDate.addActionListener (this);
 
  
 
  inFieldPane.add(new JLabel ("Last Published DD Mo. YYYY"));
 
  inFieldPane.add(UpdateDate);
 
  UpdateDate.addActionListener (this);
 
 
  inFieldPane.add(new JLabel ("URL"));
 
  inFieldPane.add(Url);
 
  Url.addActionListener (this);
 
 
  
 
              
 
  pane.add(inFieldPane,BorderLayout.NORTH);
 
  
 
  // Add Submission Button
 
  JPanel submitPane = new JPanel();  
 
  JButton submitButton = new JButton ("Generate!");
 
  submitButton.addActionListener (this);
 
  submitPane.add(submitButton);
 
  pane.add(submitPane, BorderLayout.SOUTH);
 
  
 
  //Add Output Fields
 
  JPanel outFieldPane = new JPanel();
 
  outFieldPane.add (totalName);
 
  pane.add(outFieldPane, BorderLayout.WEST );
 
  
 
  //Display the final product
 
  pack();
 
  setVisible(true);
 
 }
 
 public void actionPerformed (ActionEvent e)
 
 {
 
  //Displays Authers total name if and only if button was pushed
 
  if ( e.getActionCommand ().equals ("Generate!"))
 
  {
 
   String fullString = ALastName.getText().trim() + " , " + AFirstName.getText().trim() + ". " + Title.getText().trim()+ TodaysDate.getText().trim()+ UpdateDate.getText().trim()+ Url.getText().trim();
 
   totalName.setText(fullString);
 
  }
 
 }
 
}
 
 
class Title extends JComponent // a class which is painting the main title (Biblio-Generator)
 
{
 
 public Title ()
 
 {
 
  repaint();
 
 }
 
 public void paint (Graphics g)// method to draw the title
 
 {
 
  
 
 
          Font font = new Font("Serif", Font.ITALIC, 40);// changes the titles text font and size
 
        g.setFont(font); //changes the font
 
       
 
  g.drawString("Bibliography Generator ", 50,30);// locates the position of the title and outputs it in the window (draws title). 
 
 }    
 
}
 
 
 
  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		wtd
 
 
 
    
		 | 
		
		 | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Kyle
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Jun 01, 2006 12:48 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				All right thanks for the link...
 
Well i finished it and i got my programe to work  
 
But Border layout is very limited... i was looking at grid layout but i have no idea how i can change it to grid layout. 
 
	  | code: | 	 		  import java.awt.*;
 
import java.awt.event.*;
 
import javax.swing.*;
 
 
public class project
 
{
 
 public static void main (String[] args)
 
 {
 
 
 
  WindowName frame = new WindowName();
 
  frame.setSize (700, 300);
 
 
 
  JPanel pane = (JPanel) frame.getContentPane();
 
  frame.setVisible(true);
 
 }
 
}
 
 
class WindowName extends JFrame implements ActionListener
 
{
 
 private JTextField AFirstName;
 
 private JTextField ALastName; 
 
 private JTextField Title;
 
 private JTextField TodaysDate;
 
 private JTextField UpdateDate;
 
 private JTextField Url;
 
 private JTextField totalName;
 
 
 
 public WindowName ()
 
 {
 
  super("Bibliography Generator");//this will give the window the name of (:Bibliogaphy Generatot") 
 
  //Organized content pane
 
  JPanel pane = (JPanel) getContentPane();
 
  //Create fields for I/O
 
  AFirstName = new JTextField(15);
 
  ALastName = new JTextField(15);
 
  Title = new JTextField (30);
 
  TodaysDate= new JTextField(20); 
 
  UpdateDate = new JTextField(20);
 
  Url = new JTextField(60);
 
  totalName = new JTextField(60);
 
 
 
  // add labbled input fields
 
  JPanel inFieldPane = new JPanel();
 
  JPanel inFieldPane2 = new JPanel(); 
 
 
 
  inFieldPane.add (new JLabel("First Name"));
 
  inFieldPane.add(AFirstName);
 
  AFirstName.addActionListener(this);
 
 
 
  inFieldPane.add(new JLabel ("Last Name"));
 
  inFieldPane.add (ALastName);
 
  ALastName.addActionListener (this);
 
 
 
  inFieldPane.add(new JLabel ("Article Title"));
 
  inFieldPane.add (Title);
 
  Title.addActionListener (this);
 
    
 
  inFieldPane2.add(new JLabel ("DD Mo. YYYY day viewed")); 
 
  inFieldPane2.add(TodaysDate);
 
  TodaysDate.addActionListener (this);
 
 
 
  inFieldPane2.add (new JLabel ("Last Published DD Mo. YYYY"));
 
  inFieldPane2.add(UpdateDate);
 
  UpdateDate.addActionListener (this);
 
 
  inFieldPane2.add(new JLabel ("URL"));
 
  inFieldPane2.add(Url);
 
  Url.addActionListener (this);
 
   
 
  pane.add(inFieldPane,BorderLayout.PAGE_START);
 
  pane.add(inFieldPane2, BorderLayout.LINE_START);
 
 
 
  // Add Submission Button
 
  JPanel submitPane = new JPanel(); 
 
  JButton submitButton = new JButton ("Generate!");
 
  submitButton.addActionListener (this);
 
  submitPane.add (submitButton);
 
  pane.add(submitPane, BorderLayout.LINE_END);
 
 
 
  //Add Output Fields
 
  JPanel outFieldPane = new JPanel();
 
  outFieldPane.add (totalName);
 
  pane.add(outFieldPane, BorderLayout.PAGE_END );
 
 
 
  //Display the final product
 
  pack();
 
  setVisible(true);
 
 }
 
 public void actionPerformed (ActionEvent e)
 
 {
 
  //Displays Authers total name if and only if button was pushed
 
  if ( e.getActionCommand ().equals ("Generate!"))
 
  {
 
   String fullString = ALastName.getText().trim() + " , " + AFirstName.getText().trim() + ". " + Title.getText().trim()+ TodaysDate.getText ().trim()+ UpdateDate.getText ().trim()+ Url.getText().trim();
 
   totalName.setText(fullString);
 
  }
 
 }
 
}
 
 
class Title extends JComponent // a class which is painting the main title (Biblio-Generator)
 
{
 
 public Title ()
 
 {
 
  repaint();
 
 }
 
 public void paint (Graphics g)// method to draw the title
 
 {
 
          Font font = new Font("Serif", Font.ITALIC, 40);// changes the titles text font and size
 
        g.setFont (font); //changes the font
 
      
 
  g.drawString("Bibliography Generator ", 50,30);// locates the position of the title and outputs it in the window (draws title).
 
 }   
 
}  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |