Search Results

Search found 1 results on 1 pages for 'sriku'.

Page 1/1 | 1 

  • How to display panel which is of Singleton class in two different frames at a time?

    - by Sriku
    I am trying to display a singleton obj on two different Jframe, but it is displayed only in the Jframe in which the object is added at last ( in example Frame2). Other Jframe is empty. This Singleton class is inherited from Panel and contains a label in it. Can anybody please tell me how can i display this singleton object in two different frame ? public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { NewJFrame inst = new NewJFrame(); inst.setTitle("Frame1"); inst.setSize(300, 300); inst.setLocationRelativeTo(null); inst.setVisible(true); singltonpanel _sin = singltonpanel.instance(); inst.add(_sin); inst.repaint(); JFrame frame = new JFrame("Frame2"); frame.setSize(300, 300); frame.setVisible(true); singltonpanel _sin1 = singltonpanel.instance(); frame.add(_sin1); frame.repaint(); } });

    Read the article

1