0

i have class Map in this class I have this method

public void vykresliGraf(Graphics g){

    Set set = graf.getUzly().entrySet();
    g.setColor(Color.BLUE);

    Iterator it = set.iterator();
    while(it.hasNext()){
        Map.Entry entry = (Map.Entry) it.next();
        Uzel u = (Uzel)entry.getValue();
        Obec o = (Obec)u.getValue();
        g.drawOval(o.getSouradnice().x - 3, o.getSouradnice().y - 3, 6, 6);
        g.fillOval(o.getSouradnice().x - 3, o.getSouradnice().y - 3, 6, 6);
    }
    it = set.iterator();
    List<Hrana> pomList = new ArrayList<>();
    while(it.hasNext()){
        Map.Entry entry = (Map.Entry) it.next();
        Uzel u = (Uzel)entry.getValue();
        for (int i = 0; i < u.getHranyUzlu().size(); i++) {
            Hrana h = (Hrana)u.getHranyUzlu().get(i);

            if(!pomList.contains(h)){

                pomList.add(h); 
                Obec o1 = (Obec)h.getZdroj().getValue();
                Obec o2 = (Obec)h.getCil().getValue();
                g.drawLine(o1.getSouradnice().x, o1.getSouradnice().y, o2.getSouradnice().x, o2.getSouradnice().y);
            }

        }
    }
}

and in my MainFrame class i have method on buttonClick map.vykresliGraf(jPanel1.getGraphics()); and its paint my map on jPanel but when remove some vertex (button click) and call the same map.vykresliGraf(jPanel1.getGraphics()); nothing happened i try repaint(); and still nothing some can help me with this?

Lizardor
  • 15
  • 7
  • possible duplicate of [How to repaint a JPanel after have drawn on it?](http://stackoverflow.com/questions/4392722/how-to-repaint-a-jpanel-after-have-drawn-on-it) – NESPowerGlove Mar 04 '15 at 16:30
  • nope it not works, but when i call panel.repaint(); its clear panel – Lizardor Mar 04 '15 at 16:35

0 Answers0