public ObserverPattern(CompositeParent r) { root = r; window = new JFrame(); width = 400; height = 400; if (root != null) { window = new JFrame(root.toString()); } else { window = new JFrame(); } // controllwin = new JFrame("Controll"); // controllwin.setLayout(new FlowLayout()); JButton b = new JButton("Értéket ad"); tf = new JTextField(); b.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // controlwindow.removeAll(); if (!ertad()) { tf.setText("Nem megfelelo parameter!!"); } } }); /*controllwin.add(tf); controllwin.add(b); controllwin.setVisible(true);*/ window.setLayout(new FlowLayout()); window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); window.setSize(width, height); window.setVisible(true); }