First of all i want to say hi, because I am new here.

I am doing some school project, and I need some help with Panels and Layouts.

Here is picture how program looks when I run it, and as you see JTabbedPane called Pacijenti is on center of screen, but I dont want to look like that.

I want to stretch it from toolbar to statusbar. I hope you can help me.



Here is code of the main window.

package test2;
 
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
 
 
 
 
 
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
public class GlavniProzor extends JFrame {
 
	JMenuBar meni;
	JToolBar toolbar;
	JButton dugme1, dugme2, dugme3, dugme4;
	JLabel l1,l2,l3,l4,l5;
	JTextField txt1,txt2,txt3,txt4,txt5;
	JTabbedPane jtp;
	GraphicsDevice myDevice ;
	Window myWindow;
 
	public GlavniProzor(){
		super("Test");
		Container cont = getContentPane();
		cont.setLayout(new GridLayout(3,0));
		// centriranje prozora
		Toolkit tk = Toolkit.getDefaultToolkit();
	    Dimension screenSize = tk.getScreenSize();
	    int screenHeight = screenSize.height;
	    int screenWidth = screenSize.width;
	    setSize(screenWidth / 2, screenHeight / 2);
	    setLocation(screenWidth / 4, screenHeight / 4);
	    JPanel panel2 = new JPanel();
		panel2.setLayout(new BorderLayout());
	    jtp = new JTabbedPane();
		jtp.add(new PacijentProzor(), "Pacijenti");
 
 
		add(jtp);
 
 
 
 
 
	    //meni
	    meni = new JMenuBar();
		setJMenuBar(meni);
		// Dodadavanje FILE
		JMenu file = new JMenu("File");
		meni.add(file);
		meni.setBorder(LineBorder.createGrayLineBorder());
		JMenu edit = new JMenu("Edit");
		meni.add(edit);
		JMenu help = new JMenu("Help");
		meni.add(help);
 
		JPanel panel1 = new JPanel();
		panel1.setLayout(new BorderLayout());
 
		JToolBar toolbar = new JToolBar();
		toolbar.setFloatable(false);
 
		ImageIcon tbExit = new ImageIcon("exit.png");
		JButton exitDugme = new JButton(tbExit);
		exitDugme.setText("Izlaz");
		// ubacivanje dugmica u toolbar
		toolbar.add(exitDugme);
		// dodavnje granice oko dugmica
		exitDugme.setBorder(new EmptyBorder(0,0,0,0));
		exitDugme.setToolTipText("Izlaz");
		exitDugme.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				System.exit(0);
			}
		});
 
		panel1.add(toolbar, BorderLayout.NORTH);
		panel2.add(jtp);
		cont.add(panel1);
		cont.add(panel2);
 
 
 
		JPanel panel3 = new JPanel();
		panel3.setLayout(new BorderLayout());
		JLabel statusbar = new JLabel("Status: Pokrenut je program TEST...");
        statusbar.setPreferredSize(new Dimension(-1, 22));
        statusbar.setBorder(LineBorder.createGrayLineBorder());
        panel3.add(statusbar, BorderLayout.SOUTH);
        cont.add(panel3);
	}
 
	public static void main(String[] args) {
		GlavniProzor a = new GlavniProzor();
		a.setVisible(true);
		a.setDefaultCloseOperation(EXIT_ON_CLOSE);
 
 
	}
 
}

And here is code of another class, where I created stuff in JTabbedPane

 
package test2;
 
 
 
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.text.ParseException;
import java.util.Date;
 
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
public class PacijentProzor extends JPanel implements ActionListener, FocusListener{
	private static final long serialVersionUID = 3073076482598940379L;
 
	private JLabel lblId;
	private JTextField tfPrezime, tfIme, tfDatum, tfTelefon, tfAdresa, tfGrad, tfStomatolog;
	private JButton btnPrethodni, btnSljedeci, btnBrisi, btnNovi;
 
 
	private int pnum = 0;
	private JFrame prozor = null;
 
	public PacijentProzor()
	{
		postaviGUI();
	}
 
	public PacijentProzor(boolean noviProzor)
	{
		postaviGUI();
		if(noviProzor)
		{
			prozor = new JFrame("Pacijenti");
			prozor.add(this);
			prozor.pack();
			prozor.setVisible(true);
		}
	}
 
	public void prikazi()
	{
		if(prozor == null) return;
		prozor.setVisible(true);
		prozor.toFront();
	}
 
	private void postaviGUI()
	{
		addFocusListener(this);
		setLayout(new GridLayout(10, 2));
 
		btnPrethodni = new JButton("< Prethodni"); btnPrethodni.addActionListener(this);
		add(btnPrethodni);
 
		btnSljedeci = new JButton("Sljedeći >"); btnSljedeci.addActionListener(this);
		add(btnSljedeci);
 
		add(new JLabel("ID"));
		lblId = new JLabel("0");
		add(lblId);
 
		add(new JLabel("Prezime"));
		tfPrezime = new JTextField();
		tfPrezime.addFocusListener(this);
		add(tfPrezime);
 
		add(new JLabel("Ime"));
		tfIme = new JTextField();
		tfIme.addFocusListener(this);
		add(tfIme);
 
		add(new JLabel("Datum rođenja"));
		tfDatum = new JTextField();
		tfDatum.addFocusListener(this);
		add(tfDatum);
 
		add(new JLabel("Broj telefona"));
		tfTelefon = new JTextField();
		tfTelefon.addFocusListener(this);
		add(tfTelefon);
 
		add(new JLabel("Adresa"));
		tfAdresa = new JTextField();
		tfAdresa.addFocusListener(this);
		add(tfAdresa);
 
		add(new JLabel("Grad"));
		tfGrad = new JTextField();
		tfGrad.addFocusListener(this);
		add(tfGrad);
 
		add(new JLabel("Stomatolog"));
		tfStomatolog = new JTextField();
		tfStomatolog.addFocusListener(this);
		add(tfStomatolog);
 
		btnBrisi = new JButton("Obriši"); btnBrisi.addActionListener(this);
		add(btnBrisi);
 
		btnNovi = new JButton("Dodaj"); btnNovi.addActionListener(this);
		add(btnNovi);
 
 
	}
 
	@Override
	public void focusGained(FocusEvent arg0) {
		// TODO Auto-generated method stub
 
	}
 
	@Override
	public void focusLost(FocusEvent arg0) {
		// TODO Auto-generated method stub
 
	}
 
	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
 
	}
}