Memo..~ 0 Newbie Poster

Hi everyone..
I wrote this program but I could not get the panels as what I arranged them.. also I don't know what's wrong with the scrollbar cuz I couldn't get the concept of it very well..

import javax.swing.JFrame;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Bodoor extends JFrame implements ActionListener
{
	JTextField T1,T2,T3,T4,T5,T6;
	public static final int WIDTH=60;
	public static final int HEIGHT=40;
	public static final int LINES=15;
	public static final int CHAR_PER_LINE=30;
	
	
	 JTextArea memoDi;
	 String memo1;
	public static void main (String[] args)
	{
		Bodoor b=new Bodoor();
		b.setVisible(true);
	}
	public Bodoor()
	{   setSize(2000,600);
	    setTitle("RED ROSE SHOP");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		ImageIcon PIC=new ImageIcon("imagesCAU20P8A.jpg");
		JPanel P1=new JPanel();
		JPanel P2=new JPanel();
		JPanel P3=new JPanel();
		JPanel P4=new JPanel();	
		JLabel L1=new JLabel("Number of rosess");
		JLabel L2=new JLabel("The price of each rosess");
		JLabel L3=new JLabel("The Valantien day");
		JLabel L4=new JLabel("The Reguler day");
		JLabel L5=new JLabel(PIC);
		JLabel L6=new JLabel("RED ROSE SHOP");
		JLabel L7=new JLabel("Number of rosess");
		JLabel L8=new JLabel("The price of each rose");
		Font   f=new  Font("Arial Black",Font.BOLD,24);
		FlowLayout w=new FlowLayout();
		P1.setLayout(w);
		P2.setLayout(w);
		P3.setLayout(w);
		P4.setLayout(w);
		L1.setForeground(Color.RED);
		L2.setForeground(Color.RED);
		L3.setForeground(Color.BLUE);
		L4.setForeground(Color.BLUE);
		L5.setForeground(Color.RED);
		L6.setForeground(Color.RED);
		L7.setForeground(Color.RED);
		L8.setForeground(Color.RED);												
		T1=new JTextField(2);
		T2=new JTextField(2);
		T3=new JTextField(2);
		T4=new JTextField(2);
		T5=new JTextField(2);
		T6=new JTextField(2);
		JButton B1=new JButton("Calculate Total1");
		JButton B2=new JButton("Calculate Total2");
		JButton B3=new JButton("End");
		add(P1,BorderLayout.NORTH);
		add(P2,BorderLayout.WEST);
		add(P3,BorderLayout.EAST);
		add(P4,BorderLayout.SOUTH);
		B1.setForeground(Color.RED);
		B2.setForeground(Color.RED);	
		JButton memo1=new JButton("save memo");
		memo1.addActionListener(this);
		P4.add(memo1);
		JButton clear=new JButton("clear");
		clear.addActionListener(this);
		P4.add(clear);
		JButton get=new JButton("get memo");
		get.addActionListener(this);
		P4.add(get);
		JPanel textpanel=new JPanel();
		textpanel.setBackground(Color.BLUE);
		memoDi=new JTextArea(LINES,CHAR_PER_LINE);
		memoDi.setBackground(Color.WHITE);
		JScrollPane  scrolledText=new 	JScrollPane(memoDi);
		scrolledText.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		scrolledText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		textpanel.add(scrolledText);
		add(textpanel,BorderLayout.CENTER);		
		P1.add(L6);
		P1.add(L5);
		P2.add(L4);
		P2.add(L1);
		P2.add(T1);
		P2.add(L2);
		P2.add(T2);
		P2.add(B1);
		P2.add(T3);
		P3.add(L3);
		P3.add(L7);
		P3.add(T4);
		P3.add(L8);
		P3.add(T5);
		P3.add(B2);
		P3.add(T6);
		P3.add(B3);
		B1.addActionListener(this);
		B2.addActionListener(this);
		B3.addActionListener(this);
		
		
	}
	public void actionPerformed(ActionEvent ae)
	{
		String actionCommand=ae.getActionCommand();
		if (actionCommand=="save memo")
			memo1=memoDi.getText();
		else if (actionCommand=="clear")
			memoDi.setText("  ");
		else if (actionCommand=="get memo")
			memoDi.setText(memo1);
			
			
		 else if (actionCommand=="Calculate Total1")
		 {			
		double a=Double.parseDouble(T1.getText());
		double b=Double.parseDouble(T2.getText());
		T3.setText(Double.toString(a*b));
		 }
		else if(actionCommand=="Calculate Total2")
		{			
		double u=Double.parseDouble(T4.getText());
		double n=Double.parseDouble(T5.getText());
		T6.setText(Double.toString(u*n));
		}
	}
	}
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.