Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JButton that runs another Java program  RSS feed

 
Jack Joneson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all.

I am currently working on a Java project that is due to be completed soon (so I may have a few questions at a later date). Admitedly, I'm not very good at programming and much of my code so far is a bit of a mish mash of stuff that I have found by searching the net.

I have a program that runs correctly in DOS with a few changes I need to make at a later date.

I also currently have a GUI that displays as I would like it to. However, I am at the stage of adding Action Events and cannot find too much help elsewhere.

I have my jbuttons and one of these, when clicked on, I want it to run the other program I have created. The output of this program is a text file and I would like it to be possible to open this text file when a 2nd jbutton is clicked on.

Is this possible and any pointers?

Thanks

 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to know what to advise you as I can't guess the structure of any of your programs. Your best bet may be to study about JButtons and creating ActionListeners at the Sun Swing tutorial site here:
Writing an Action Listener
How to use Buttons
The Really Big Index


Also, is the program that you want to "run" a true class with a constructor and non-static methods, or is it mainly a static main method-type program. I think that if you supply us with more information you'll likely get more specific help.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!