Basic question about subpanels and scope

I’m sorry for the basic question but, I’m not happy with what I’ve got.
I’m trying to use a use a sub-panel to input 3D locations/rotations. I can’t figure out how the scope works so that I can return a location/rotation to the main panel and then update my Spatial:
mySpatial.setLocalTranslation(v)) or mySpatial.setLocalRotation(new Quaternion(a)).
It works, but is there another way?
Ack, sorry about the tabs - they are more efficient than 4 spaces.

After…

Display3DPanel myPanel;
myPanel = new Display3DPanel(x, y, ....);

I can’t do:

myPanel.add(new ActionListener()...) because the panel doesn’t have addActionListener() and JTextFields are buried inside.  

I can’t do:

myPanel.addActionListener(new java.awt.event.ActionListener(){
    @Override
    public void actionPerformed(ActionEvent e){
        //do something
    }
});

For the same reason.
I’m passing in the main program and it works, but it seems like there is a smoother way.

/**
 *
 * @author Owner
 */
/*
 * example
 * title
 * x= x y= y z= z
 */
package core.utils;

import Ant.Ant;
import PercentageLayout.PercentageLayout;
import com.jme3.app.SimpleApplication;
import com.jme3.math.Vector3f;
import core.AntHill;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;
import java.text.ParseException;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.text.NumberFormatter;
//import javax.vecmath.*;

import javax.swing.JPanel;
import javax.vecmath.Vector3d;

public class Display3DHorizontal extends Panel implements ActionListener{
	public static final int NORMAL = 0;
	public static final int DEGREE = 1;
	public static final int DISTANCE = 2;
	public static final int SN = 2;
	
	public static final int L = 0;
	public static final int R = 1;
	public static final int LV = 2;
	public static final int RV = 3;

	JPanel		footer;
	JLabel		xLabel, yLabel, zLabel;
	JTextField	xText, yText, zText, header;
	JTextField	jtf;
	String		xString = "*", yString = "*", zString = "*";
	float		x = 1f, y = 1f, z = 1f;
	int				format = 0;
	int			thing = 0;
	//SimpleApplication sa;
	Ant				currentAnt;
	AntHill				sa;
	DecimalFormat scientificNotationFormat = new DecimalFormat("0.000E00");
	DecimalFormat degreeFormat = new DecimalFormat("000.00");
	NumberFormatter scientificNotationFormatter = new NumberFormatter(scientificNotationFormat);
	NumberFormatter degreeFormatter = new NumberFormatter(degreeFormat);
 	
	public Display3DHorizontal(){
		
	}
	
	//public Display3DHorizontal(String xs, String ys, String zs, float x, float y, float z, SimpleApplication sa){
	public Display3DHorizontal(String xs, String ys, String zs, float x, float y, float z, SimpleApplication sa, int thing){
		this.xString = xs;
		this.yString = ys;
		this.zString = zs;
		this.x = x;
		this.y = y;
		this.z = z;
		this.sa = (AntHill)sa;
		//this.jtf = jtf;//tried to pass in the JTextField i wanted to change
		this.thing = thing;
		

		//scientificNotationFormatter.setOverwriteMode(true);
		//scientificNotationFormatter.setAllowsInvalid(false);

		setMinimumSize(new Dimension(50, 50));
		setVisible(true);
		//setLayout(new PercentageLayout(new int[]{100}, new int[]{16, 16, 16, 16, 16, 16}, true));//h, v
		//setLayout(new PercentageLayout(new int[]{100}, new int[]{10, 20, 10, 20, 10, 20}));//h, v

		add(xLabel = new JLabel(xString), Integer.toString(0));
		add(xText = new JTextField(Float.toString(x)), Integer.toString(1));
		xText.addActionListener(this);

		add(yLabel = new JLabel(yString), Integer.toString(2));
		add(yText = new JTextField(Float.toString(y)), Integer.toString(3));
		yText.addActionListener(this);
		add(zLabel = new JLabel(zString), Integer.toString(4));
		add(zText = new JTextField(Float.toString(z)), Integer.toString(5));
		zText.addActionListener(this);
	}
	
	
	@Override
	public void actionPerformed(ActionEvent e){
		float nx = 0f;
		float ny = 0f;
		float nz = 0f;
		Vector3f v = new Vector3f();
		float[] a = new float[4];
		//NOW WHAT DO I DO WITH IT
		//How does one instance of this return a location and
		//another instance of this return a rotation (euler)
		//This works but I think there is a better way.
		if (thing == L){
			nx = Float.parseFloat(xText.getText());
			ny = Float.parseFloat(yText.getText());
			nz = Float.parseFloat(zText.getText());
			v = new Vector3f(nx, ny, nz);
			sa.setCurrentAntLocation(v);
			//setmytest();//no scope
		}
		else if (thing == R){
			a[0] = nx;
			a[1] = ny;
			a[2] = nz;
			sa.setCurrentAntRotation(a);
		}
	}

	
	public void setDisplay(Vector3f p){
		if (format == NORMAL){
			xText.setText(Double.toString(p.x));
			yText.setText(Double.toString(p.y));
			zText.setText(Double.toString(p.z));
		}
		else if (format == DEGREE){
			xText.setText(degreeFormat(p.x));
			yText.setText(degreeFormat(p.y));
			zText.setText(degreeFormat(p.z));
		}
		else if (format == SN){//to kilometers
			xText.setText(scientificNotationFormat(p.x/1000));
			yText.setText(scientificNotationFormat(p.y/1000));
			zText.setText(scientificNotationFormat(p.z/1000));
		}
		else
			System.out.println("Display3D format code error");
		//repaint();//done every cycle anyway = causes backup
	}
	

	public void setDisplay(float[] a){
		if (format == NORMAL){
			xText.setText(Double.toString(a[0]));
			yText.setText(Double.toString(a[1]));
			zText.setText(Double.toString(a[2]));
		}
		else if (format == DEGREE){
			xText.setText(degreeFormat(a[0]));
			yText.setText(degreeFormat(a[1]));
			zText.setText(degreeFormat(a[2]));
		}
		else if (format == SN){//to kilometers
			xText.setText(scientificNotationFormat(a[0]/1000));
			yText.setText(scientificNotationFormat(a[1]/1000));
			zText.setText(scientificNotationFormat(a[2]/1000));
		}
		else
			System.out.println("Display3D format code error");
		//repaint();//done every cycle anyway = causes backup
	}
	

	public void setDisplay(Vector3d p){
		if (format == NORMAL){
			xText.setText(Double.toString(p.x));
			yText.setText(Double.toString(p.y));
			zText.setText(Double.toString(p.z));
		}
		else if (format == DEGREE){
			xText.setText(degreeFormat(p.x));
			yText.setText(degreeFormat(p.y));
			zText.setText(degreeFormat(p.z));
		}
		else if (format == SN){//to kilometers
			xText.setText(scientificNotationFormat(p.x/1000));
			yText.setText(scientificNotationFormat(p.y/1000));
			zText.setText(scientificNotationFormat(p.z/1000));
		}
		else
			System.out.println("Display3D format code error");
		//repaint();//done every cycle anyway = causes backup
	}
	

	public String degreeFormat(double n){
		String s = new String("");
		
		try{
			s = degreeFormatter.valueToString(n);
		}
		catch(ParseException e){
			s = new String("Display3D.string parse error");
		}
		return(s);
	
	}
	
	public String scientificNotationFormat(double n){
		String s = new String("");
		
		try{
			s = scientificNotationFormatter.valueToString(n);
		}
		catch(ParseException e){
			s = new String("string parse error");
		}
		return(s);
	
	}
	
	public void setFormat(int f){
		format = f;
	}
	
}