开发者

java: how to launch two applications from one launcher

I have 2 classes, and each one of them has a launcher for a form that utilizes them:

DateTester uses DateTest class and is launched by dateLauncher CylinderTest uses Cylinder class and is launched by cylLauncher

each launcher开发者_StackOverflow中文版 is simply comprised of

Cylinder program = new Cylinder();

respectively. They both launched fine by themselves. What I would like to do is create a launcher window (just a pane with two buttons) that will launch either program when their buttons is clicked. I just moved everything into the same package (although im thinking that I shouldnt have done that now), and now neither will launch from their respective launcher. I was trying to launch them with something like:

public void actionPerformed(ActionEvent ev)
{
     if(ev.getSource() == btnCylinder)
     {
          Cylinder prgCylinder = new Cylinder();
     }
     else if (ev.getSource() == btnDate)
     {
          DateTester prgDate = new DateTester();
     }
     else{}
}

but it doesnt do anything. I also tried threading them, and that didnt work either. Any suggestions? Or is this actually a lot more complicated than it seems?


turns out it was just the action listener not added for the buttons. paulo answered this in a comment, but i need to close this as answered. thanks paulo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜