473,387 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to run another sub-Main() in an application?

Hi,
I am trying to open multiple Java3D windows from my application.
I want to open each window when I select a checkboxmenu.
Follwoing code doesn't show me the Java3D windows, so how can I make it works?
Thanks for your help.
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();

while(openGLItem2.isSelected()) {
j3dWindow.createAndShowGUI();
}
}
});
}
Jul 17 '05 #1
1 2489

"maya2000" <me*******@hotmail.com> wrote in message
news:29**************************@posting.google.c om...
Hi,
I am trying to open multiple Java3D windows from my application.
I want to open each window when I select a checkboxmenu.
Follwoing code doesn't show me the Java3D windows, so how can I make it works? Thanks for your help.
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();

while(openGLItem2.isSelected()) {
j3dWindow.createAndShowGUI();
}
}
});
}


Maya,

It seems you have not yet grasped the idea of event-based programming. The
createAndShowGUI() call probably creates the window and that is fine. You
should not add the loop after the creation. That is not how event-based
programs work. After creating the main window the main function has done its
task. The created window (and its subwindows, menus etc) should be decorated
with all kinds of listeners that tie application code to some event that is
caused by the user doing something with the gui. These listeners could
create new windows or do anything you like.

In that respect event-based programs are not like terminal applications
where you typically program one continuous flow that contains all the
programs behaviour. Think of event-based programs as a big state machine
where each ui action can result in a state-change.

Regards,

Silvio Bierman
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: tshad | last post by:
I have an example I copied from "programming asp.net" (o'reilly) and can't seem to get the Sub (writefile) to execute. It displays all the response.write lines that are called directly, but not...
9
by: tshad | last post by:
I have an example I copied from "programming asp.net" (o'reilly) and can't seem to get the Sub (writefile) to execute. It displays all the response.write lines that are called directly, but not...
10
by: bienwell | last post by:
Hi, I have a question about file included in ASP.NET. I have a file that includes all the Sub functions (e.g FileFunct.vb). One of the functions in this file is : Sub TestFunct(ByVal...
7
by: Doug | last post by:
An ASP.NET session cookie set on "www.mydomain.com" can not be accessed on "search.mydomain.com"; hence, a new session and cookie are being created on every sub-domain. This is occuring because...
10
by: Gary | last post by:
I'm trying to find a way to determin which window Within-Another-Program currently has the focus. THE SITUATION: (Skip down to "My Question" if you don't want the background...) * This is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.