package example; public class Window extends javax.swing.JFrame { public static int citac = 0; public String id = ""; public Window above = null; public Window [] below = new Window [] { }; public Window (Window from) { this (); // super (1, 2); above = from; } /** Creates new form Window */ public Window() { initComponents(); citac ++; // ++ citac; // citac += 1; // citac = citac + 1; id = "Okno " + citac; update (); } private void buttonActionPerformed(java.awt.event.ActionEvent evt) { Window w = new Window (this); w.setVisible (true); Window [] a = new Window [below.length + 1]; for (int i = 0 ; i < below.length ; i ++) a[i] = below [i]; a[a.length-1] = w; below = a; } private void poleActionPerformed(java.awt.event.ActionEvent evt) { id = pole.getText (); update (); } private String description () { String result = id; if (above != null) result = above.description() + "/" + result; return result; } private String description2 () { String result = id; Window p = above; while (p != null) { result = p.id + "/" + result; p = p.above; } return result; } private void update () { String s = description(); setTitle (s); title.setText (s); pole.setText (id); if (above != null) above.update (); }