I am trying to make my program look like the image I attached but I don't know how to. I can't make the JTextFields positioned like that.

I also want to make it a JScrollPane instead of JPanel

import java.awt.*;
import javax.swing.*;
import java.text.NumberFormat;
import javax.swing.JFormattedTextField;
import java.awt.event.*;
import java.text.*;

public class Database extends JFrame
{

	private		JSplitPane	splitPaneV;
	private		JSplitPane	splitPaneH;
	private		JPanel		panel1;
	private		JPanel		panel2;
	private		JPanel		panel3;

	private JLabel gradeL, equivL;
	private JFormattedTextField gradeTF, equivTF;
	private JButton calculateBC, clearBC;
	
	private CalculateButtonHandlerC cbHandlerC;
	private ClearButtonHandlerC clHandlerC;
	
	private JLabel prelimL, midtermL, endtermL, finalL;
	private JFormattedTextField prelimTF, midtermTF, endtermTF, finalTF;
	private JButton calculateBS, clearBS;
	
	private CalculateButtonHandlerS cbHandlerS;
	private ClearButtonHandlerS clHandlerS;
	
	public Database()
	{
		setTitle( "Split Pane Application" );
		setBackground( Color.green );

		JPanel topPanel = new JPanel();
		topPanel.setLayout( new BorderLayout() );
		getContentPane().add( topPanel );

		// Create the panels
		createPanel1();
		createPanel2();
		createPanel3();

		// Create a splitter pane
		splitPaneV = new JSplitPane( JSplitPane.VERTICAL_SPLIT );
		topPanel.add( splitPaneV, BorderLayout.CENTER );

		splitPaneH = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT );
		splitPaneH.setLeftComponent( panel1 );
		splitPaneH.setRightComponent( panel2 );

		splitPaneV.setLeftComponent( splitPaneH );
		splitPaneV.setRightComponent( panel3 );
	}

	public void createPanel2()
	{
		panel2 = new JPanel();
		panel2.setLayout(new GridLayout(5,2));

		// Add some buttons
		gradeL= new JLabel("Final Grade: ", SwingConstants.RIGHT);
		equivL = new JLabel("Equivalent: ", SwingConstants.RIGHT);
		
		NumberFormat real = NumberFormat.getNumberInstance();
		real.setGroupingUsed(false);
		real.setMaximumFractionDigits(2);
		real.setMinimumFractionDigits(2);
		
		gradeTF = new JFormattedTextField(real);
		equivTF = new JFormattedTextField(real);
	
		calculateBC = new JButton("Calculate");
		cbHandlerC = new CalculateButtonHandlerC();
		calculateBC.addActionListener(cbHandlerC);
		
		clearBC = new JButton("Clear");
		clHandlerC = new ClearButtonHandlerC();
		clearBC.addActionListener(clHandlerC);
		
		equivTF.setEditable(false);
		
		panel2.add(gradeL);
		panel2.add(gradeTF);
		panel2.add(equivL);
		panel2.add(equivTF);
		panel2.add(calculateBC);
		panel2.add(clearBC);

	}

	public void createPanel1()
	{
		panel1 = new JPanel();
		panel1.setLayout(new GridLayout(5,2));

		prelimL = new JLabel("Prelim Grade: ", SwingConstants.RIGHT);
		midtermL = new JLabel("Midterm Grade: ", SwingConstants.RIGHT);
		endtermL = new JLabel("Endterm Grade: ", SwingConstants.RIGHT);
		finalL = new JLabel("Final Grade: ", SwingConstants.RIGHT);
		
		NumberFormat real = NumberFormat.getNumberInstance();
		real.setGroupingUsed(false);
		real.setMaximumFractionDigits(2);
		real.setMinimumFractionDigits(2);
		
		prelimTF = new JFormattedTextField(real);
		midtermTF = new JFormattedTextField(real);
		endtermTF = new JFormattedTextField(real);
		finalTF = new JFormattedTextField(real);
				
		calculateBS = new JButton("Calculate");
		cbHandlerS = new CalculateButtonHandlerS();
		calculateBS.addActionListener(cbHandlerS);
		
		clearBS = new JButton("Clear");
		clHandlerS = new ClearButtonHandlerS();
		clearBS.addActionListener(clHandlerS);
		
		finalTF.setEditable(false);
		
		panel1.add(prelimL);
		panel1.add(prelimTF);
		panel1.add(midtermL);
		panel1.add(midtermTF);
		panel1.add(endtermL);
		panel1.add(endtermTF);
		panel1.add(finalL);
		panel1.add(finalTF);
		panel1.add(calculateBS);
		panel1.add(clearBS);
		
	}

	public void createPanel3()
	{
		panel3 = new JPanel();
		panel3.setLayout( new BorderLayout() );
                panel3.setPreferredSize( new Dimension( 500, 200 ) );
                panel3.setMinimumSize( new Dimension( 100, 50 ) );
        
		panel3.add( new JLabel( "Database" ), BorderLayout.NORTH );
		panel3.add( new JTextArea(), BorderLayout.CENTER );
	}

	public static void main( String args[] )
	{
		// Create an instance of the test application
		Database mainFrame	= new Database();
		mainFrame.pack();
		mainFrame.setVisible( true );
		mainFrame.setSize(450,400);
	}
	
	private class CalculateButtonHandlerC implements ActionListener
	{
		public void actionPerformed(ActionEvent e)
		{
			double grade, finalg;
			
			grade = Double.parseDouble(gradeTF.getText());
			
			if(grade>=99.50 && grade<101)
				finalg = 1.00;
			else if(grade<99.50 && grade>=98.50)
				finalg = 1.10;
			else if(grade<98.50 && grade>=97.50)
				finalg = 1.20;
			else if(grade<97.50 && grade>=96.50)
				finalg = 1.30;
			else if(grade<96.50 && grade>=95.50)
				finalg = 1.40;
			else if(grade<95.50 && grade>=94.50)
				finalg = 1.50;
			else if(grade<94.50 && grade>=93.50)
				finalg = 1.60;
			else if(grade<93.50 && grade>=92.50)
				finalg = 1.70;
			else if(grade<92.50 && grade>=91.50)
				finalg = 1.80;
			else if(grade<91.50 && grade>=90.50)
				finalg = 1.90;
			else if(grade<90.50 && grade>=89.50)
				finalg = 2.00;
			else if(grade<89.50 && grade>=88.50)
				finalg = 2.10;
			else if(grade<88.50 && grade>=87.50)
				finalg = 2.20;
			else if(grade<87.50 && grade>=86.50)
				finalg = 2.30;
			else if(grade<86.50 && grade>=85.50)
				finalg = 2.40;
			else if(grade<85.50 && grade>=84.50)
				finalg = 2.50;
			else if(grade<84.50 && grade>=83.50)
				finalg = 2.60;
			else if(grade<83.50 && grade>=82.50)
				finalg = 2.70;
			else if(grade<82.50 && grade>=81.50)
				finalg = 2.80;
			else if(grade<81.50 && grade>=80.50)
				finalg = 2.90;
			else if(grade<80.50 && grade>=79.50)
				finalg = 3.00;
			else if(grade<79.50 && grade>=78.50)
				finalg = 3.10;
			else if(grade<78.50 && grade>=77.50)
				finalg = 3.20;
			else if(grade<77.50 && grade>=76.50)
				finalg = 3.30;
			else if(grade<76.50 && grade>=75.50)
				finalg = 3.40;
			else if(grade<75.50 && grade>=74.50)
				finalg = 3.50;
			else
				finalg = 5.0;
				
			equivTF.setText("" + finalg);
			equivTF.setEditable(false);
		}
	}
	
	private class ClearButtonHandlerC implements ActionListener
	{
		public void actionPerformed(ActionEvent e)
		{
			gradeTF.setText("");
			equivTF.setText("");
		}
	}
	
	private class CalculateButtonHandlerS implements ActionListener
	{
		public void actionPerformed(ActionEvent e)
		{
			double prelim, midterm, endterm, finalg;
			
			DecimalFormat df = new DecimalFormat("#.##");
			prelim = Double.parseDouble(prelimTF.getText());
			midterm = Double.parseDouble(midtermTF.getText());
			endterm = Double.parseDouble(endtermTF.getText());
			
			finalg = (prelim * .30) + (midterm * .30) + (endterm * .40);
			
			finalTF.setText("" + df.format(finalg));
			finalTF.setEditable(false);
		}
	}
	
	private class ClearButtonHandlerS implements ActionListener
	{
		public void actionPerformed(ActionEvent e)
		{
			prelimTF.setText("");
			midtermTF.setText("");
			endtermTF.setText("");
			finalTF.setText("");
		}
	}
}

There are tutorials in the Java Tutorials that explain how to use layout managers.

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.