0

i m making a java swing application .

my issue is ,

i have a J frame class A , which has n number of swing components on it like buttons and tabbed-pane etc. i have written several functions too in that class to check that any of the fields to be entered by the user is not blank or in some cases the field entered is a numeric quantity etc.

now , i have an other J frame class B , which is invoked by a an action listener of a button in class A. i have extended class A to B ( CLASS B extends CLASS A) because i wanted to use those functions written in class A to check same things.

the problem is whenever i press the button on J frame A , it invokes n displays my J frame B too but MY J FRAME B is showing the contents of J frame too , is it because i have extended the class ?? :(

can anyone help me why ??

i cant directly post the images , as i need some reputation 10 so m putting a link which has images.

https://www.facebook.com/media/set/?set=a.10200703035086315.1073741826.1474538524&type=1&l=142b1f8d31

the link i have put shows images of the frames. 1st image shows the frame A second image shows the defected frame B and image 3 shows the original frame B i want. thanks in advance.

please help me.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Vinit Jain
  • 23
  • 4
  • Why don't you put the validation code elsewhere, maybe by writing a custom validation framework which registers components against validators, that way you can share most of the code? Or better yet, use an existing solution, that ought to exist I guess. Anyway extending Swing components (especially extending them multiple times) is probably not the right approach. – Thomas Sep 24 '13 at 08:14
  • i m sorry sir , i din get you , can u please explain again :( ?? – Vinit Jain Sep 24 '13 at 08:29
  • can u tell me why is it happening ?? – Vinit Jain Sep 24 '13 at 09:39
  • For better help sooner, post an [SSCCE](http://sscce.org/). – Andrew Thompson Sep 25 '13 at 02:06
  • See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556) – Andrew Thompson Sep 25 '13 at 02:06

0 Answers0