How to handle TreeMaps? Can I use only one TreeMap to store values for several items?
===

I am trying to simulate a production system. To explain what I intend to do briefly, I will to create a Panel where I will have some tables to save values (for the proprieties of the several working stations and the job types (see pic. below)). When I run it, those values should be stored for further processing.

On a previous question I was recommended using TreeMaps to store those values, so I created something like:

    Station[num][type][avg_time][posx][posy][state]
    Part[num][type][state]

Heres is my code so far:

L.java


    import java.awt.*;
    import javax.swing.*;


    public class L extends JFrame {
    
         public static final int ww = 1000;
         public static final int wh = 600;
         public static final int bgw = (ww - 30);
         public static final int bgh = (wh - 80);
         public static final String wt = "Teste";
        Color new_piece = new Color(255,0,0);
        Color progress_piece = new Color(255,215,0);
        Color ready_piece = new Color(173,255,47);
        Container pane = getContentPane();
        Dimension appletSize = pane.getSize();
        int wHeight = appletSize.height;
        int wWidth = appletSize.width; 
        DrawRectangle rectangle = new DrawRectangle();
        public TMap t;
    
        public L() {
            setSize(ww,wh);
            this.setTitle(wt);
    //        Sim(int nparts);
            JButton startButton = new JButton("Start");        
            JButton stopButton  = new JButton("Stop");
            
            //... Add Listeners
           // startButton.addActionListener(new StartAction());
            //stopButton.addActionListener(new StopAction());
            
            //... Layout inner panel with two buttons horizontally
            JPanel buttonPanel = new JPanel();
            buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT,10,10));
            buttonPanel.add(startButton);
            buttonPanel.add(stopButton);
            this.setLayout(new BoxLayout(pane,BoxLayout.Y_AXIS));
            this.add(rectangle);
            this.add(buttonPanel);
            
            //Sim();
            t = new TMap();
            test();
            //pane.add(rectangle);
            
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setResizable(false);
            setLocationRelativeTo(null);
            setVisible(true);
        }
        
        public void addRectangle(int px, int py, int pw, int ph, Color pc, String state) {
            this.rectangle.addRectangle( px, py, pw, ph, pc, state);
        }
        
        public void Sim() {
            addRectangle(20,20,10,10,Color.green,"new");
            /*for (int i=0;i<=nparts;i++) {
                addRectangle(200,200,50,Color.green);
            }*/
        }
        
        public void test() {
            // First Station Proprieties
            t.put("num",1);
            t.put("type",1);
            t.put("avg_time",5);
            t.put("posx",100);
            t.put("posy",20);
            t.put("state",0);
            // Second Station Proprieties
            t.put("num",2);
            t.put("type",2);
            t.put("avg_time",7);
            t.put("posx",200);
            t.put("posy",20);
            t.put("state",0);
            /*System.out.println("Now the tree map Keys: " + t.St.keySet());
            System.out.println("Now the tree map contain: " + t.St.values());*/
        }
    
        public static void main(String[] args) {
        
            try {
                    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            } catch (UnsupportedLookAndFeelException ex) {
                ex.printStackTrace();
            } catch (IllegalAccessException ex) {
                ex.printStackTrace();
            } catch (InstantiationException ex) {
                ex.printStackTrace();
            } catch (ClassNotFoundException ex) {
                ex.printStackTrace();
            }
        
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    L l = new L();
                    //System.out.println("Entryset: " + t.keySet());
                    //System.out.println("Entryset: " + t.Station() + "\n");
                }
            });
    
        }

    }  

DrawRectangle.java

     import java.awt.*;
     import java.awt.event.ActionEvent;
     import java.awt.event.ActionListener;
     import java.awt.geom.*;
     import java.util.ArrayList;
     import java.util.concurrent.TimeUnit;
     import java.util.logging.Level;
     import java.util.logging.Logger;
     import javax.swing.*;

     public class DrawRectangle extends JPanel implements ActionListener {
    
    private java.util.List<Rectangle2D> squares;
    private java.util.List<Color> colors;
    private long seconds = 1;
    private int anim_interval = (int) TimeUnit.SECONDS.toMillis(seconds);
    private Timer sim_timer;
    private Timer idle_timer;
    int px = 10, velx = 2;
    String state;
    Color pc;

    
    public DrawRectangle(){
        //this.setBounds(10, 10, 10, 10);
        this.setMinimumSize(new Dimension(100,100));
        this.setPreferredSize(new Dimension(100,L.bgh));
        this.setMinimumSize(new Dimension(500,L.bgh));
        setBackground(Color.gray);
        setDoubleBuffered(true);
        setBorder(BorderFactory.createLineBorder(Color.black, 1));
        squares = new ArrayList<Rectangle2D>();
        colors = new ArrayList<Color>();
        sim_timer = new Timer(anim_interval,this);        
        sim_timer.start();
    }

    public void addRectangle(int px, int py, int pw, int ph, Color pc, String state)  { // square
        squares.add( new Rectangle2D.Double(px, py, pw, ph) ) ;
        pc = pc;
        //System.out.println(state);
        //this.a = a;
        //this.startX = startX;
        //this.startY = startY;
    }
    
    public void actionPerformed(ActionEvent e) {
        /*if (px < 0 || px > 990) {
            velx = -velx;
        }*/
        //System.out.println(px);
        if (px == 20) { 
            sim_timer.stop();
            state = "idle";
            try {
                Thread.sleep(5000);
            } catch (InterruptedException ex) {
                Logger.getLogger(DrawRectangle.class.getName()).log(Level.SEVERE, null, ex);
            }
            sim_timer.start();
            state = "going";
        } 
        else if (px == 50) {
            sim_timer.stop();
            state = "done";
            seconds = 2;
        }
        //if (state != "idle") {
            px = px + velx;
            repaint();
        //}
    }
    
    private void idlestate() throws InterruptedException {
        Thread.sleep(5000);
        state = "idle";
    }
    private void goingstate() {
        state = "going";
    }
    private void donestate() {
        state = "done";
    }
    
    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g1 = (Graphics2D) g.create();
        Graphics2D g2 = (Graphics2D) g.create();
        //System.out.println("D1");
        /*for( Rectangle2D rect : squares ) {
            System.out.println(colors);
            //g1.setPaint(colors);
            g1.fill(rect);
        }*/
        //for(int i=0;i<squares.size();i++) {
            //System.out.println("D2");
            //g1.setColor(colors.get(i));
            if (state == "going") { g1.setColor(Color.orange); }
            else if (state == "idle") { g1.setColor(Color.yellow); }
            else if (state == "done") { g1.setColor(Color.green); }
            else { g1.setColor(Color.red); }
            //g1.fill(squares.get(i));
            g1.fillRect(px, 10, 10, 10);
            g2.setColor(Color.blue);
            g2.fillRect(px,40,10,10);
            //g1.dispose();
        //}
    }
     public void setColor(Color newColor) {
      pc = newColor;
          }

     }

TMap.java

    import java.util.*;

    public class TMap {
    public TreeMap <String, Integer> St;
    public int num_atrib = 6;
    
    public TMap () {
        St = new TreeMap <>();
    }
    public Set<String> getKeySet() {
        return St.keySet();
    }

    public Integer get(String s) {
        return St.get(s);
    }
    
    public void put (String s, int i) {
        St.put(s,i);
        System.out.println("Now the tree map Keys: " + St.keySet());
        System.out.println("Now the tree map contain: " + St.values());
    }
    
    public TreeMap<String, Integer> Station(String s,int i) {
     }
     }


The DrawRectangle.java code is here just for those who may want to compile the code but has nothing to do with the actual problem so far. The TMap.java is where I create the map, and have the methods to deal with the data. Everything is working fine, my problems is the following:

Most likely, when simulating, I will have more than one station, so I would need to store info in such a matter:

     Station[num][type][avg_time][posx][posy][state]
     Station[1][1][5][100][20][0]
     Station[2][2][7][200][20][0]
     Station[3][3][4][300][20][0]

Thing is, when I put new data to the treemap, it will overwrite the previous data stored so if I add info twice, the output will come as:

     Now the tree map Keys: [avg_time, num, posx, posy, type]
     Now the tree map contain: [5, 1, 100, 20, 1]
     Now the tree map Keys: [avg_time, num, posx, posy, state, type]
     Now the tree map contain: [7, 2, 200, 20, 0, 2]


The simulation will be limited to 6 working stations, so my question is, what's the best practice to deal with this? The only thing I could come up with is creating 6 TreeMaps and only use those that'll be needed, but i'm pretty sure there has got to be an easier and more efficient way to store the data.

Thanks in advance for your help!