Ooooops Sorry.
Forget this post, I just noticed that you did have setVisible( true )
in your code.
Time to crawl under a stone !!!
--Jools
>From: jools enticknap <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED], [EMAIL PROTECTED]
>Subject: Re: Java3D and 'main()'
>Date: Wed, 07 Jul 1999 08:28:02 PDT
>
>
>Hi Rob
>
>I would suggest that you add win.setVisible( true ) after initialization in
>order to get AWT to manage the window.
>
>Regards
>
>--Jools
>
>
>
>>From: Rob Nugent <[EMAIL PROTECTED]>
>>To: [EMAIL PROTECTED]
>>Subject: Java3D and 'main()'
>>Date: Wed, 07 Jul 1999 15:57:05 +0100
>>
>>I am sure that the following is a User Error on my part, but if anyone can
>>explain what I am doing wrong
>>I'd appreciate it:
>>
>>I have a Java3D program that runs just fine on WinNT. All my
>>geometry/behaviours etc are created
>>in a function called init() which is called from the 'main' of my first
>>class.
>>
>>Now on WinNT, the renderer runs fine for ever, however under Linux, the
>>program terminates when
>>main() exits. I have put a sleep() into the end of the init function to
>>prove this, and with the sleep at 10
>>seconds, my window evaporates after 10 seconds, but on Linux only, not on
>>NT.
>>
>>If anyone can help or explain, I'd appreciate it.
>>
>>Rob
>>
>>Start class code follows:
>>
>>----snip----
>>package rob.ref;
>>
>>import java.awt.BorderLayout;
>>import java.awt.Dimension;
>>import java.awt.Graphics;
>>import java.awt.Toolkit;
>>
>>import java.awt.event.WindowEvent;
>>import java.awt.event.WindowListener;
>>
>>import javax.media.j3d.BranchGroup;
>>import javax.media.j3d.TransformGroup;
>>import javax.media.j3d.VirtualUniverse;
>>import javax.media.j3d.Locale;
>>
>>import javax.swing.JPanel;
>>import javax.swing.JFrame;
>>
>>
>>
>>public class Start implements WindowListener
>>{
>> private VirtualUniverse u;
>> private Locale l;
>> private Camera cam;
>> private static boolean fullScreen = false;
>>
>> private JPanel pan;
>> private JFrame win;
>>
>> public void init()
>> {
>> u = new VirtualUniverse();
>> l = new Locale(u);
>> cam = new Camera();
>>
>> pan = new JPanel()
>> {
>> public Dimension getPreferredSize()
>> {
>> if (fullScreen)
>> {
>> return Toolkit.getDefaultToolkit().getScreenSize();
>> }
>>
>> return new Dimension(640,400);
>> }
>> };
>>
>> win = new JFrame()
>> {
>> public void update(Graphics g)
>> {
>> paint(g);
>> }
>> };
>> pan.setLayout(new BorderLayout(0,0));
>> pan.add(BorderLayout.CENTER,cam.getCanvas3D());
>> win.getContentPane().setLayout(new BorderLayout(0,0));
>> win.getContentPane().add(BorderLayout.CENTER,pan);
>> win.pack();
>> win.setVisible(true);
>> win.pack();
>> win.setLocation(0,0);
>>
>> MaterialManager.init();
>> TextureManager.init(win);
>> AppearanceManager.init();
>>
>> l.addBranchGraph(cam.getBranchGroup());
>>
>> Snake s = new Snake();
>> l.addBranchGraph(s.getBranchGroup());
>>
>> BackgroundLight bl = new BackgroundLight();
>> l.addBranchGraph(bl.getBranchGroup());
>>
>> PositionalLamp pl = new PositionalLamp();
>> l.addBranchGraph(pl.getBranchGroup());
>>
>> win.addWindowListener(this);
>>
>> for (int i = 0; i < 1; i++)
>> {
>> try
>> {
>> Thread.sleep(10000);
>> }
>> catch(InterruptedException e)
>> {
>> }
>> }
>>
>> }
>>
>> public static void main(String[] args)
>> {
>> if ((args.length > 0) && (args[0].equals("-f")))
>> {
>> System.out.println("Full Screen");
>> fullScreen = true;
>> }
>>
>> Start s = new Start();
>> s.init();
>> }
>>
>> public void windowActivated(WindowEvent e)
>> {
>> }
>> public void windowDeactivated(WindowEvent e)
>> {
>> }
>> public void windowOpened(WindowEvent e)
>> {
>> }
>> public void windowClosed(WindowEvent e)
>> {
>> }
>> public void windowClosing(WindowEvent e)
>> {
>> }
>> public void windowIconified(WindowEvent e)
>> {
>> }
>> public void windowDeiconified(WindowEvent e)
>> {
>> }
>>}
>>----snip----
>>
>>
>>
>>--
>>
>>
>>Rob Nugent
>>Development Manager
>>UniKix Technologies Europe
>>[EMAIL PROTECTED]
>>http://www.unikix.com
>>Tel: +44 (0) 1489 585503
>>Fax: +44 (0) 1489 881363
>>
>>
>>
>>----------------------------------------------------------------------
>>To UNSUBSCRIBE, email to [EMAIL PROTECTED]
>>with a subject of "unsubscribe". Trouble? Contact
>>[EMAIL PROTECTED]
>>
>
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>
>
>----------------------------------------------------------------------
>To UNSUBSCRIBE, email to [EMAIL PROTECTED]
>with a subject of "unsubscribe". Trouble? Contact
>[EMAIL PROTECTED]
>
>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]