Hello could someone please help me as my program is generating some weird error" java.lang.IllegalArgumentException: adding a window to a container"
Could someone please look at it and tell me what I'm doing wrong. Im trying to add an object of fan to the panel it creates that error. whenever I remove the add(fan, BorderLayout.CENTER); the error goes away. Please someone help me come up with a
I have attached my programs

import javax.swing.JPanel;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
	public class FanControl extends JPanel {
		  private RunFan fan = new RunFan();
		  private JButton jbtStart = new JButton("Start");
		  private JButton jbtStop = new JButton("Stop");
		  private JButton jbtReverse = new JButton("Reverse");
		  private JScrollBar jsbDelay = new JScrollBar();

		  public FanControl() {
		    // Group buttons in a panel
		    JPanel panel = new JPanel();
		    setLayout(new BorderLayout());
		    add(jsbDelay, BorderLayout.SOUTH);
		    add(fan, BorderLayout.CENTER);
		    jbtStart.addActionListener(new ActionListener() {
		        public void actionPerformed(ActionEvent e) {
		      jbtStop.addActionListener(new ActionListener() {
		        public void actionPerformed(ActionEvent e) {
		      jbtReverse.addActionListener(new ActionListener() {
		        public void actionPerformed(ActionEvent e) {

Your problem is in RunFan. You make it a JFrame, which you cannot add. Instead make it a JComponent and you should be good.

Please remember code tags when posting code.

My fan shrunk on my panel, can anybody offer any help as I can get it bigger?

I didn't check out the files you have attached, but my assumption is that you need to set the size of the fan.

Personally I would just give your panel a gridbaglayout and set the weight x and weight y to your preference.