Multi-window program

What I would like to do is have a program with a button that opens another window, that is independent of the window that opened it. I would also like to be able to , in some cases, close the previous window, so that the only part of the program running is the newly opened window.
Ive actually created a button, which creates a new frame, then adds a class (AWT GUI) to that frame, but when I close the new window down the new window also closes. Im I doing this right? The windows are not dialogue type boxes by the way, they are main windows containing many components. Any help appreciated.

Thankyou CrimsonKain for your post. I have now got the jist of it. I tried a more complex example with a java program I created ages ago, which has a paint() method. I assumed that because the class was extending the Frame class, I had to put a panel inside the frame to hold the components I needed. The only problem is that the paint methods aren't working, so perhaps someone could help me out with this. I have included the source files below:
---------ChangingFace.java-------------
import java.awt.*;
import java.awt.event.*;
class ChangingFace extends Frame implements ActionListener
    private boolean isHappy = true;
    private Button smileyFaceButton = new Button("Open SmileyFace");
    private Button happyButton = new Button("Smile");
    private Button sadButton = new Button("Frown");
    private Panel panel = new Panel();
    public ChangingFace()   
         super ("First Frame");
         panel.add(happyButton);
        panel.add(sadButton);
        panel.add(smileyFaceButton);
        this.add(panel);
        happyButton.addActionListener(this);
        sadButton.addActionListener(this);
        smileyFaceButton.addActionListener(this);
        setBounds(0,0,300,300);
        show();
        addWindowListener(new WindowAdapter()
             public void windowClosing(WindowEvent we)
                  dispose();
    } //end Constructor
    public void paint(Graphics g)   
         g.setColor(Color.red);
        g.drawOval(85,95,75,75);
        g.setColor(Color.blue);
        g.drawOval(100,115,10,10);
        g.drawOval(135,115,10,10);
        g.drawString("Changing Face", 80,205);
        if(isHappy == true)       
             g.drawArc(102,135,40,25,0,-180);
        else       
             g.drawArc(102,135,40,25,0,180);
        } // end if
    }// end paint
    public void actionPerformed(ActionEvent e)   
         if(e.getSource() == happyButton)    
              isHappy = true;
            repaint();
        }//end if
        if(e.getSource() == sadButton)    
             isHappy = false;
            repaint();
        } //end if
        if(e.getSource() == smileyFaceButton)
             SmileyFace myface = new SmileyFace();
    } // end actionPerfomed
    public static void main (String [] args)
         ChangingFace ch = new ChangingFace();
} //end class ChangingFace---------SmileyFace.java-------------
import java.awt.*;
import java.awt.event.*;
class SmileyFace extends Frame implements ActionListener
     private Button close = new Button("Dispose");
     public SmileyFace()
          super ("Second Frame");
         add(close);
        close.addActionListener(this);
        setBounds(300,0,300,300);
        show();
        addWindowListener(new WindowAdapter()
             public void windowClosing(WindowEvent we)
                  dispose();
   public void paint(Graphics g)
      g.setColor(Color.red);
      g.drawOval(85,45,75,75); // the face
      g.setColor(Color.blue);
      g.fillOval(100,65,10,10); // the right eye
      g.drawOval(135,65,10,10); // the left eye
      g.drawArc(102,85,40,25,-0,-180); // the mouth
      g.drawString("Smiley Face",90,155);
   public void actionPerformed(ActionEvent e)   
          if(e.getSource() == close)    
                 dispose();
      } //end if
   } // end actionPerfomed
}If someone culd just help me get all of the components in the source, especially the paint() method!

Similar Messages

  • How to open multi-windows to operate a remote compute using socket

    hi, please help me.
    I want to develop a program, it can open multi-windows to operate the remote comput at one time just like NetTerm. It use socket to setup connection with remote computer.
    Now I am using a Thread class to setup socket connection with computer, and use Thread's static varible to control all kinds of action of socket.But it can work only when openning one window,because all the thread instances share the same static variable.
    How to do it? Not using Thread? Then the frame will be frozen.
    All adivse are welcomed.Thank you.

    Maybe I don't say it clearly.The program need to show the output of the socket in the JTextArea and transfer the user input to the input of the socket to control the remote computer.

  • New firefox 10.0 wont let me open mult windows, only tabs

    new firefox 10.0 wont let me open mult windows, only tabs. I have looked at tools/options/tabs and the open new windows in tabs is not clicked. have rebooted computer with no better results

    That issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Parallels: transferring info from a Windows program to a Mac program

    I've been devoted to a Mac for a few years now, but I recently had to switch back to Windows because of its far superior voice recognition software. (I was recently disabled, and now rely on voice recognition to type.)
    If I were to buy a new Mac and use my Dragon NaturallySpeaking professional software (the Windows voice recognition program) via Parallels, does anyone know if I would be able to use that to type in a Macintosh program? I understand that I could stay within the virtual Windows platform or do separate tasks on the Mac platform, but I'm not sure if I would be able to transfer the information gathered by the Windows program into a Mac program.
    If I'm able to do this, it would mean I could finally switch back to a Mac. Thanks in advance!

    If I were to buy a new Mac and use my Dragon
    NaturallySpeaking professional software (the Windows
    voice recognition program) via Parallels, does anyone
    know if I would be able to use that to type in a
    Macintosh program?
    No
    iFelix

  • Running a Java Multi Thread Program in database

    I have created a multi threaded program in Java and it runs successfully from the command prompt. I want to create a DBMS Job which will wake up at regular intervals and runs the java program(Java stored procedure). Is this possible in 9.2/10G ?? If Yes, will there be any impact on the DB performance/increase memory etc.,
    The database (9.2...) resides on a RH 2.3 AS box.
    Any ideas...
    Thanks,
    Purush

    Purush,
    Java stored procedures cannot be multi-threaded. Well, they can, but the threads will not run in parallel. You may be able to find some more information in the Oracle documentation, which is available from:
    http://tahiti.oracle.com
    Good Luck,
    Avi.

  • HT5639 if i use boot camp to establish windows on my Macbook pro can i then install a windows program and run it without another software ie parallels?

    Can I use a windows program such as QuickBooks on my macbook pro 15inch with only using boot camp or do i need to have another program?

    Boot Camp is everything you need to run a Windows application.
    Boot Camp allows you to install Windows in a second volume, so you can start up there and run all your Windows apps without needing any Mac OS X app. It's true that OS X apps like Parallels or VMware Fusion allow you to use your Boot Camp partition in Mac OS X, but it looks like you don't want that

  • Windows programs on a PowerPC Machine

    Hello, everybody, I have an upgraded Power Mac G4 sawtooth which has seen it's years of use, and never gave up and never will. Although I have intel macs that can do this job, I was wondering if there was a was I can possibly run windows programs right on the desktop's screen seamlessly as if it was running natively. If I remember correctly, Microsoft Virtual PC 6 and 7 for Mac could do this, but it's ancientware, and I can't find anything for it. My G4 sawtooth is more than enough to handle emulation and virtualization, I have done it before using Q, but I, for some reason can't run the windows programs on the desktop as if it was seamlessly running with the system. Any help would be appreciated, thanks.
    System Specs:
    Power Mac G4 Sawtooth A.K.A (PowerMac3,1)
    PowerPC 7447a Sonnet Encore ST 1.6Ghz G4
    2GB PC-100 SDRAM
    Flashed ATI Radeon 9800 Pro 128MB AGP
    1.67TB HDD space
    23" Dell monitor (Left)
    65" Toshiba (Main)
    23" Dell monitor (right)
    Mac OS X 10.5.8
    Firmware version: 4.2.8f1
    Serial: XB*LA
    Note: The serial number is from the logic board of a completely different G4 sawtooth since I had to get it replaced as the AGP slot failed to work one day.
    <Edited by Host>

    Welcome to Apple Discussions!
    Q, VirtualPC, Wintel, Open Darwin for PowerPC, Lismore Systems GuestPC, iEmulator are all the solutions I know that work for PowerPC.

  • I need to use a Windows program

    First time Macbook owner and I have been using Microsft Windows Picture viewer to crop and adjust my photos for the last 8+ years.  Its gonna take sometime to get use to iPhoto as it is more complex than what I am use to working with.  Is there anyway to get this small program onto my Mac without doing Boot Camp and buying a Windows program?  Is it possible to use a thumb drive?  Any help would be great.  I do like iPhoto but its gonna take me months to work at the same speed that I am able to crop and adjust with Windows.  Perhaps another app or Mac program thats simple and easy to use.  Thank you all for the help.

    You have to have Windows installed to run a  "PC" program.
    iPhoto, believe it or not, is easy to use. Like anything else, hands on use is necessary. Although iPhoto has many features, one dies not need to understand or use them all.
    Barry

  • Will Mac allow you to boot from an external drive...specifically for windows programs?

    Will a new Mac allow you to boot from an external drive...specifically for windows programs?

    ps...I've read the threads on Bootcamp.

  • How do I run Windows programs on my iMac and my MiniMac?

    I have a new iMac and a new MiniMac at the office. Can I run Windows programs on these computers, such as QuickBooks? If so, how do I do it?

    If you want to run MS Windows applications on your iMac and Mac Mini you need a license of MS Windows at a minimum. Then you need to decide how you want to run the apps, you can use Boot Camp which allows you to install MS Windows on your computer and then boot your computer as either a MS Windows machine or OS X machine. The advantage of this is there is no cost (except for MS Windows) as Boot Camp comes with every Mac. You will find Boot Camp Setup Assistant in (Applications - Utilities - Boot Camp Setup Assistant). The other solution is virtualization software such as Parallels or VM Ware Fusion. The advantage of virtualization software is you can run MS Windows and OS X simultaneously. This is ideal if you are not doing graphics intensive applications such as 3D gaming, CAD/CAM or 3D renderings. For applications like QuickBooks it would be great.
    The downside of running MS Windows on your Mac is that portion of the computer will be susceptible to all the problems PC's have such as Virus's and other malware. So whatever solution you get you need to also get anti-virus software and other anti-malware. The upside is if Windows becomes diseased this in no way affects OS X.
    Finally your best solution is to look for OS X versions of your applications. I know there is a OS X version of QuickBooks however I have no idea how Intuit's licensing works, you would need to contact Intuit to ask that question.
    Roger

  • How do i run windows programs on mac

    How do i run a windows program on my mac? Is there a particular application for it? or do i need to download and install a virtual windows software? - if so, can anyone suggest any names for software. I've heard about virtual box.

    Why ask here instead of the ones for Macbook series, or for Windows on Mac, aka Boot Camp.
    VirtualBos is just the VM free for running Windows as guest OS under Mac OS, and then why exclude what or type program? Maybe game that needs to run natively, or that your notebook would have troubke with disk spa e, RAM, or your processor.
    Windows runs hotter, too, so that is another concern.
    Mire Q's than answers.

  • I want to use Boot Camp to run a tax program that will only use explorer. Whick windows program do I need to install in Boot Camp

    I want to use Boot Camp and windows 7 or 8, preferrably 7 to run a tax program that will only let me use explorer.  I am using a Mac Book Pro with OSX Maverick 10.9.  There are so many windows programs out there it is confusing which one I need.  I don't think that I will need Office.

    http://www.apple.com/support/bootcamp/
    I would use Windows 7 any full version except the trial, or a branded Dell, HP, etc. versions

  • I partitioned a small drive for a windows program, and now the computer only wants to boot to Windows.  How do I get back to Mac so I can have a choice of drives?

      I partitioned a small drive for a windows program, and now the computer only wants to boot to Windows.  How do I get back to Mac so I can have a choice of drives?

    That doesn't sound good. It sounds like the power outage might have corrupted the partition for OS X. I would suggest booting from the Install DVD that came with your Mac while holding down the C key. Once you have selected the language start up Disk Utility from the pull down menu and repair the disk. Once you have done that then repair permissions also.
    Allan

  • Windows 8.1 and VS2012 SDK get error "Windows Program Compatibility mode is on. Turn it off and then try Setup again."

    When trying to install VS2012 SDK on Windows 8.1 get the error "Windows Program Compatibility mode is on. Turn it off and then try Setup again."
    See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.

    Rick, Have you had any success with this? I'm also trying to run the tfs_VssUpgrade.exe tool on my Windows 8.1 machine and getting the same exception. Greatly appreciate any insight if you were able to get past this issue! Thanks, Steve
    Same issue here.
    This MS connect thread
    is interesting however.
    Posted by Microsoft  on 9/19/2013 at 2:54 PM                                            
    Hello Alxandr,
    Thank you for taking the time to submit this issue to Connect. This is a known issue with Windows 8.1 RTM and it will be addressed in a future update of Windows 8.1. In the meantime, you can typically rename the EXE to get it to work correctly.

  • I can't uninstall Thunderbird from my Windows Programs "uninstall list"; why does it not uninstall and be removed from this list?

    Very frustrating...under the Windows "Programs/Uninstall a program" list, Mozilla Thunderbird is still listed AFTER I have removed it completely (I thought) from my computer. I have clicked on "uninstall" several times and nothing happens. I resent the fact that Mozilla has set this up so that it apparently can't be removed from that list.. What's that all about? I have tried to research the problem, even using your website to no avail. All I want to do is get it out of my uninstall/change list. I have not used that program AND won't use it. I don't want that program on my computer/list period. I would appreciate your help.

    This is a fault with Windows application management. Mozilla does nothing to interfere with the install/uninstall process.
    You could re-install Thunderbird to re-synch the applications list and then un-install it again, or you could use a utility to remove it from the list.
    A search for ''thunderbird.exe'' will confirm whether or not it has been truly removed, though you may need to disable all the idiot-proofing that Microsoft implement to stop us seeing the true state of the file system; set it to show hidden files and file extensions for starters.
    Thunderbird is pretty much self-contained. You are free to manually remove the folder the application lives in if Windows is unable to uninstall it for you, though that won't fix the incorrect appearance of thunderbird in the list of installed applications.

Maybe you are looking for

  • 10g R2 Grid Control Installation

    Hi, I want to go for 10g R2 Grid Control Installation... I have setup like this Software: Oracle 10g R2 Grid Controller Oracle 10g R3 patchset Hardware: Small PC with 2 GB RAM and 80 GB HDD Target Nodes: Oracle Applications Database Tier Node with 10

  • MY SCREEN IS NOT WORKING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Okay ill start by saying that my ipod has been twice already, but when it does come back, the screen is slightly open so that i could see inside. Now when i try to slide the screen across or select an app, the ipod chooses to either select completely

  • Importing stereo tracks, simple and silly

    So I've stepped away from the sound portion of my work and am now getting back to the grind. I have FCP suite 5. When I export from FCP to STP as a multitrack project I unlink the stereo pair of my field recordings, and they appear as separate tracks

  • How to connect with business connector

    Dear Gurus, I am new to business connector. Could you please give the procedure that how we can transfer the IDOC from R/3 to business connector. Please help me. Regards,

  • MATERIAL MASTER STRUCTURE FOR FLATFILE CONSTRUCTION

    HI FOLKS PLEASE PROVIDE THE STRUCTURE MM FOR CONSTRUCTING FLAT FILE VERY URGENT PLZZ