How to pass and get values to TreeMap on another class?
<p>I am trying to simulate a production system and now I am having trouble getting and passing values to a TreeMap located on a different class.</p>

<p>To explain what I intend to do briefly, I will to create a Panel where I will have some textpanels to save values (for the number of parts to be added to the system) and a table where the number and parameters of the work stations on the system will be set. When I run it, those values should be stored for further processing.</p>

<p>On a previous question I was recommended using TreeMaps to store those values, something like:</p>

<pre><code>Station[num][type][avg_time][posx][posy][state]
Part[num][type][state]
</code></pre>

<p>This is what I've coded so far:</p>

<p>L.java</p>

<pre><code>import java.awt.*;
import javax.swing.*;    

public class L extends JFrame {

    public static void main(String[] args) {


      SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            L l = new L();

            TMap t = new TMap();
            t.Station("num", 127);
            t.Station("type", 3);
            //System.out.println("Entryset: " + t.keySet());
            //System.out.println("Entryset: " + t.Station() + "\n");
         }
      });

    }

 } 
</code></pre>

<p>TMap.java</p>

<pre><code>import java.util.*;

public class TMap {
    //public TreeMap &lt;String, Integer&gt;St = new TreeMap&lt;String, Integer&gt;();
    public int num_atrib = 6;
    public static TreeMap&lt;String, Integer&gt; Station(String s,int i) {
        TreeMap &lt;String, Integer&gt;St = new TreeMap&lt;String, Integer&gt;();
        St.put(s,i);
        System.out.println("Now the tree map Keys: " + St.keySet());
        System.out.println("Now the tree map contain: " + St.values());
        return St;
    }
} 
</code></pre>

<p>This is outputing:</p>

<pre><code>Now the tree map Keys: [num]
Now the tree map contain: [127]
Now the tree map Keys: [type]
Now the tree map contain: [3]
</code></pre>

<p>I have two problems, first, is this the right way to do it, because for what I see the map outputed should be [num, type] and the keys [127, 3] right?</p>

<p>And secondly, how can I later on get parameters from TMap on the L class, since t.keySet() for instance won't retrieve anything so far!</p>

<p>Hope I made myself clear, thanks in advance for your help.</p>
