eclipse - Launch two different JAVA projects from the same GUI -
i have 2 java projects. both runnable guis.
i add button in project1 when pressed opens project2 application window , closes project 1.
since using mvc both applications become cluttered copy paste code first project other one, why looking easier alternative.
i have built path between 2 projects, can't seem find way start second application on button press.
i made simple example of how close jframe after clicking button , open new one.it better if write code useing note: not using mvc here
package test; import java.awt.flowlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jframe; public class test { private jbutton btn; jframe frame = new jframe(); public test(){ btn = new jbutton("new window"); frame.setvisible(true); frame.setsize(500, 500); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.add(btn); frame.setlayout(new flowlayout()); btn.addactionlistener(new addbuttonwatcher()); } private class addbuttonwatcher implements actionlistener{ @override public void actionperformed(actionevent e) { jframe newwindow = new jframe(); newwindow.setvisible(true); newwindow.setsize(200,200); frame.dispose(); } } public static void main(string[] args) { test t = new test(); } }
Comments
Post a Comment