1

In my code I have GUI constructor which extends JDialog as below.

public OrdersGUI()
{
  //code for adding SWING components to panels and JDialog.

}

Now how do I overload the constructor with parameters such as (String referenceNo) which will produce the same JDialog as the default constructor without copy/pasting everything from default constructor?

Charlie
  • 3,113
  • 3
  • 38
  • 60
  • 1
    Put "_everything from default constructor_" in a method and call it from both places? Or store the code in the non default constructor and call that from the default one with a default parameter? – takendarkk Mar 26 '16 at 01:47
  • 1
    http://stackoverflow.com/questions/285177/how-do-i-call-one-constructor-from-another-in-java – Sarvadi Mar 26 '16 at 01:51
  • @Sarvadi that is exactly what I was looking for..I just didnt know how put the question that way when I searched for it. Thanks a lot – Charlie Mar 26 '16 at 01:57

0 Answers0