0

I have 2 JFrame : A and B from Screen A : call B as:

B b=new B();
b.setName("B1");
b.show();

and

 B b=new B();
    b.setName("B2");
    b.show();

The result: show 2 screen B is: B1 and B2 If from Screen A: i want set value for control of B1 or B2. How code? Thanks?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
mum
  • 1,637
  • 11
  • 34
  • 58
  • 3
    no idea question in this form isn't answerable, for better help sooner post an [SSCCE](http://sscce.org/) – mKorbel Nov 27 '12 at 09:30
  • 1) See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556) 2) I don't really understand the requirements. 3) For better help sooner, post an [SSCCE](http://sscce.org/). (And for everybody's sakes, choose more descriptive frame titles than `B1` & `B2` - they sound like characters for a children's show.) – Andrew Thompson Nov 27 '12 at 09:31

1 Answers1

2
  • use CardLayout instead of creating two or more JFrames

  • use JDialog with patent to JFrame in the case that you have got real and important reasons to use another popup window, and/or with modality for mouse and key events

mKorbel
  • 109,525
  • 20
  • 134
  • 319
  • Can i get init of JFrame with Name of Screen? – mum Nov 27 '12 at 09:41
  • right is possible, no issue, [but JFrame must be setVisible(true) and started on InitialThread (wraped in invokeLater)](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html), post an SSCCE – mKorbel Nov 27 '12 at 09:45