title: Change JFrame Properties From JTabbedPane
body: <p>This is the class that makes the Frame and Tabbed Panes:</p>
  
  <pre><code>package homeworkToolkitRevised;
  
  import javax.swing.*;
  import javax.swing.plaf.nimbus.NimbusLookAndFeel;
  import java.awt.event.*;
  
  public class MakeGUI extends JFrame
  {
      private static final long   serialVersionUID    = 1L;
  
      JTabbedPane TabPane;
  
      public MakeGUI()
      {
          this.setTitle("The Homework Toolkit!");
          setSize(700, 500);
          setAlwaysOnTop(false);
          setNimbus();
  
          JTabbedPane TabPane = new JTabbedPane();
          add(TabPane);
  
          TabPane.addTab("Main Menu", new MainScreen());
          TabPane.addTab("Quadratic Equations", new Quadratic());
  
          setVisible(true);
      }
  
      public void setAlwaysTop()
      {
          setAlwaysOnTop(true);
      }
  
      public void setNotAlwaysTop()
      {
          setAlwaysOnTop(false);
      }
  
      public final void setNimbus() 
      {
          try
          {
              UIManager.setLookAndFeel(new NimbusLookAndFeel());
          } catch (UnsupportedLookAndFeelException e)
          {
              e.printStackTrace();
          }
      }
  
      public static void main(String[] args)
      {
          new MakeGUI();
      }
  
  }
  </code></pre>
  
  <p>And this is a tab in the tabbed pane:</p>
  
  <pre><code>package homeworkToolkitRevised;
  
  import javax.swing.*;
  
  import java.awt.*;
  import java.awt.event.*;
  
  public class Quadratic extends JPanel implements ActionListener, ItemListener
  {
      private static final long   serialVersionUID    = 1L;
  
      JLabel lblX2 = new JLabel ("Co-Efficient Of x²:", JLabel.LEFT);
      JLabel lblX = new JLabel ("Co-Efficient of x:", JLabel.LEFT);
      JLabel lblNum = new JLabel ("Number:", JLabel.LEFT);
      JLabel lblNature = new JLabel ("Nature Of Roots:", JLabel.LEFT);
      JLabel lblVal1 = new JLabel ("Value 1:", JLabel.LEFT);
      JLabel lblVal2 = new JLabel ("Value 2:", JLabel.LEFT);
  
      JTextField tfX2 = new JTextField (20);
      JTextField tfX = new JTextField (20);
      JTextField tfNum = new JTextField (20);
  
      JTextField tfNature = new JTextField (20);
      JTextField tfVal1 = new JTextField (20);
      JTextField tfVal2 = new JTextField (20);
  
      JPanel[] row = new JPanel[7];
  
      JButton btnNature = new JButton ("Nature Of Roots");
      JButton btnCalc = new JButton ("Calculate");
      JButton btnClear = new JButton ("Clear");
  
      double a = 0, b = 0, c = 0;
      double Val1 = 0, Val2 = 0, Discriminant = 0;
      String StrVal1, StrVal2;
  
      Quadratic()
      {
  
          setLayout(new GridLayout(8,1));
  
          for(int i = 0; i &lt; 7; i++)
          {
              row[i] = new JPanel();
              add(row[i]);
              row[i].setLayout(new GridLayout (1,2));
  
          }
  
          row[3].setLayout(new GridLayout (1,3));
  
  
              row[0].add(lblX2);
              row[0].add(tfX2);
  
              row[1].add(lblX);
              row[1].add(tfX);
  
              row[2].add(lblNum);
              row[2].add(tfNum);
  
              row[3].add(btnNature);
              {
                  btnNature.addActionListener(new ActionListener()
                  {
                      public void actionPerformed(ActionEvent e)
                      {
                          Nature();
                      }
                  }
                  );
              }
              row[3].add(btnCalc);
              {
                  btnCalc.setEnabled(false);
                  btnCalc.addActionListener(new ActionListener()
                  {
                      public void actionPerformed(ActionEvent e)
                      {
                          Calculate();
                      }
                  }
                  );
              }
              row[3].add(btnClear);
              {
                  btnClear.addActionListener(new ActionListener()
                  {
                      public void actionPerformed(ActionEvent e)
                      {
                          Clear();
                      }
                  }
                  );
              }
  
              row[4].add(lblNature);
              row[4].add(tfNature);
  
              row[5].add(lblVal1);
              row[5].add(tfVal1);
  
              row[6].add(lblVal2);
              row[6].add(tfVal2);
  
              tfNature.setEditable(false);
              tfVal1.setEditable(false);
              tfVal2.setEditable(false);
  
              JCheckBox chckbxAlwaysOnTop = new JCheckBox("Always On Top");
              chckbxAlwaysOnTop.addItemListener(new ItemListener() {
                  public void itemStateChanged(ItemEvent ie) 
                  {
                      if(ie.getStateChange() == ItemEvent.SELECTED)
                      {
                          //setAlwaysTop();
                       //This is method from main class to change always on top condition of jframe
                      }
                      else if (ie.getStateChange() == ItemEvent.DESELECTED)
                      {
                          //setNotAlwaysTop();
                      //This is method from main class to change always on top condition of jframe     
                      }
                  }
              });
              add(chckbxAlwaysOnTop);
  
              setVisible(true);
      }
  
      public void Calculate()
      {
          a = Double.parseDouble(tfX2.getText());
          b = Double.parseDouble(tfX.getText());
          c = Double.parseDouble(tfNum.getText());
  
          Val1 = (-b + Math.sqrt(Discriminant)) / (2 * a);
          Val2 = (-b - Math.sqrt(Discriminant)) / (2 * a);
  
          StrVal1 = String.valueOf(Val1);
          StrVal2 = String.valueOf(Val2);
  
          tfVal1.setText(StrVal1);
          tfVal2.setText(StrVal2);
  
          tfX2.setText("");
          tfX.setText("");
          tfNum.setText("");
  
          btnCalc.setEnabled(false);
      }
  
  
      public void Clear()
      {
          a = 0; b = 0; c = 0;
          Val1 = 0; Val2 = 0; Discriminant = 0;
  
  
          tfX2.setText("");
          tfX.setText("");
          tfNum.setText("");
          tfVal1.setText("");
          tfVal2.setText("");
          tfNature.setText("");
      }
  
      public void Nature()
      {
          a = Double.parseDouble(tfX2.getText());
          b = Double.parseDouble(tfX.getText());
          c = Double.parseDouble(tfNum.getText());
  
          Discriminant = (b*b) - (4*(a*c));
  
          if (Discriminant == 0)
          {
              tfNature.setText("Equal");
              btnCalc.setEnabled(true);
          }
          else if (Discriminant &lt; 0)
          {
              tfNature.setText("Imaginary");
          }
          else
          {
              tfNature.setText("Real, Distinct");
              btnCalc.setEnabled(true);
          }
      }
      public void actionPerformed(ActionEvent arg0)
      {
          // TODO Auto-generated method stub
  
      }
  
      public void itemStateChanged(ItemEvent arg0)
      {
          // TODO Auto-generated method stub
  
      }
  
  }
  </code></pre>
  
  <p>So what I want to do is to add a checkbox to the tab that allows me to set the property of the JFrame made in the main class to be always on top.
  First of all I don't understand how to call the method properly so that it alters the always on top property. I tried making an object for it and also tried making the methods static but it just doesn't work.</p>
  
  <p>What I would like to know is what modifier to use for the methods and how to alter properties of parent JFrame from inside a JTabbedPane.</p>
  
  <p>Thanks.</p>
  
  <p>EDIT: It would also work if I could add this checkbox to the JFrame itself like below the JTabbed Pane or something which would make it easier to manage with multiple tabs.</p>