This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to run multiple frames in BlueJ?

 
Ian Miller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've been doing a course with a heavy focus on applets and AWT using BlueJ. I've branched out and learn to convert my applets to applications. I can successfully use frames to do similar things to applets (in BlueJ's applet viewer) but I can not seem to run more than application at a time (unlike applets where I could run several at the same time). Below is a simple Hello World program I wrote. When I re-run main() it closes the original and starts again. Any help on how I can run multiple pieces of code would be appreciated. (I'm aiming to explore the java.net.* libraries and for testing would like to use more than one frame at a time which can communicate to each over via sockets).
Cheers,
Ian
 
Campbell Ritchie
Marshal
Posts: 52664
122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch and well done finding the code button.

I don't like BlueJ myself, but there is a simple answer to multiple frames. You don't. You use one frame and one only per application. If you need secondary windows, you use a dialogue window. You can read about them in the Java Tutorials.
Where did you find a course which is heavy on applets and AWT? AWT was superseded by Swing about 15 years ago, and most of us consider applets to be obsolete.
 
Ian Miller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the welcome. I agree its very outdated I'm not sure why the education system here hasn't moved on. For demonstrating the basics such as loops, conditionals, etc applets/AWT works fine but to try and make anything half real its fiddly. I could go on but I won't.

So if I can't run two applications at the same time and I want to learn/test out some code using networking I basically need two computers? Or I need two different IDEs?

Cheers,
Ian
 
Campbell Ritchie
Marshal
Posts: 52664
122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can run two instances of the same application simultaneously; the simplest way is to open two command lines or shells and run the same app from each. You can of course put networking across the same computer with Sockets.
 
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!