This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to run other java program with Jbuttons  RSS feed

 
John Tyron Murillo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have 2 java program the first java program is main menu of my program. the 2nd is Calculator.

#1 Program: Main Menu



#2 program: Calculator



in the main menu there is a Jbuttons. is there a way to run the #2 program: Calculator when the 1st Jbutton(Calculator button) clicked ?
 
Tony Docherty
Bartender
Posts: 3264
81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you create an instance of Calculator and call it's launchFrame method. BTW why is your first program Swing based and the second AWT, it's generally not a good idea to mix the two together.
Another thing is I'd rewrite the Calculator class so that it extends JPanel and doesn't create a frame in the constructor. Then whoever constructs the class has the choice of whether to display the Calculator in a frame, a dialog or embed it in their own GUI.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!