aspose file tools*
The moose likes Beginning Java and the fly likes Button question, hopefully an easy one... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Button question, hopefully an easy one..." Watch "Button question, hopefully an easy one..." New topic
Author

Button question, hopefully an easy one...

Allen DeSantes
Greenhorn

Joined: Mar 02, 2004
Posts: 3
Hi everyone. Just getting into Java and I have a question.
I have 2 Java programs, MenuFrame.java and BoxFrame.java.
My MenuFrame.java has two buttons in it, an "Exit" and "Open" button.
My BoxFrame.java just prints out a line of text.
My question is, how would I code the "Open" button so it creates an instance of the BoxFrame.java program in a new window?
my actionPerformed for my "Exit" button currently looks like this;
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The precise answer would depend on what sort of a class "BoxFrame" is. Is it a subclass of JFrame? Is it something that pritns to System.out?


[Jess in Action][AskingGoodQuestions]
Allen DeSantes
Greenhorn

Joined: Mar 02, 2004
Posts: 3
Prints to System.out.
I'm hoping to learn how to call other programs from other programs. Or is the right terminology, creating an instance of one program form another program?
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
Hi Allen.
I have 2 Java programs

I think the first thing is to start thinking in Java/object oriented terms. Rather than having 2 programs you have 2 Java classes. You can create objects from these classes at runtime, so you can create an instance of BoxFrame within Menuframe when the Open button is clicked...

hope this helps you along a little
[ March 02, 2004: Message edited by: Ben Wood ]
[ March 02, 2004: Message edited by: Ben Wood ]

SCJP 1.4, www.gsi3d.org.uk
Allen DeSantes
Greenhorn

Joined: Mar 02, 2004
Posts: 3
Thank you Ben!
That worked perfectly. I appreciate your help. I'm sure I'll be back with more questions as I progress.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Button question, hopefully an easy one...