Netbeans and Multiple jFrames

Hey,
Does anyone know how to make an application have multiple windows/jFrames with Netbeans 5.5's GUI builder?
I created another jFrame in my application by right-clicking on my source package in the Projects window and selecting New... --> jFrame Form...
How do you make the new jFrame form I created become visible from the first jFrame form I have?
Once I have that new form visible, how do I make it do stuff to the first jFrame form?

Here's a little example:
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
class Frame1 extends JFrame {
     private JButton button;
     public Frame1() {
          initComponents();
     private void initComponents() {
          button = new JButton("New Frame");
          button.setSize(100, 20);
          button.setLocation(5, 5);
          this.getContentPane().setLayout(null);
          this.getContentPane().add(button);
          this.pack();
          this.setSize(400, 400);
          this.setLocationRelativeTo(null);
          this.setDefaultCloseOperation(EXIT_ON_CLOSE);
          this.setTitle("Demo");
          button.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent evt) {
                    new Frame2().setVisible(true);
     public static void main(String[] argv) {
          new Frame1().setVisible(true);
class Frame2 extends JFrame {
     private JMenuBar jmb;
     private JMenu menu;
     private JMenuItem exitItem;
     public Frame2() {
          initComponents();
     private void initComponents() {
          jmb = new JMenuBar();
          menu = new JMenu("File");
          menu.setMnemonic((int)'F');
          exitItem = new JMenuItem("Exit");
          exitItem.setMnemonic((int)'X');
          jmb.add(menu);
          menu.add(exitItem);
          this.setJMenuBar(jmb);
          this.pack();
          this.setSize(100, 100);
          this.setTitle("Demo 2");
          this.setDefaultCloseOperation(EXIT_ON_CLOSE);
          this.setResizable(false);
          this.setLocationRelativeTo(null);
          exitItem.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent evt) {
                    System.exit(0);
}

Similar Messages

  • Apple.laf.useScreenMenuBar and multiple JFrames

    Hi,
    I've a small problem with trying to get a Swing application go Native on Mac OSX. Setting the apple.laf.useScreenMenuBar value to true, does get the initial JFrame's JMenuBar up on top, however, the second the program opens a new JFrame, the MenuBar goes blank (since that new JFrame has no MenuBar).
    In trying to provide Mac users with a native experience, that first menu bar should be the one to stay up top at all times. Is there a solution to this problem, short of adding the same menu bar to all jframes?
    Thanks!
    Alex

    Controller.getMenuBar()I've tried this approach - strangely enough, the bars actually replicate! ex in the controller I have two menus A B, when a child JFrame uses:
    setJMenuBar( (JMenuBar)Controller.getMenu() );
    Its frame becomes:
    A B A B
    And the original frame disappears. Do I need to create an actual separate instance at each reprise - ex clone it?

  • Multiple JFrames

    Hi. I have a situation where I need to display multiple JFrames. I have an application with a control panel that has the ability to launch another application (via a JButton). The only problem is, the only handle I have to that other application is another JButton, so I end up with something that looks like:
    JButton launchButton = new JButton();
    launchButton.setAction(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            //SomeOtherApp extends JFrame
            SomeOtherApp app = new SomeOtherApp();
            app.setVisible(true); 
    });This works, but I run into all sorts of repainting problems. Since SomeOtherApp is so large, it seems to be hogging the Event-Dispatching Thread, and the app never repaints my control panel JFrame correctly. Any thoughts on how to improve this performance?
    Thanks,
    Jeff

    Only one frame ever has focus at a time and therefore only one frame ever responds to events at a time. So neither frame should be affecting the other.

  • Creating multiple JFrames in one program

    What kind of trouble should I look for when creating multiple JFrames in one application. These JFrames will talk to each other via drag and drop. Is this ok?

    What kind of trouble would you like? I'm sure you can engineer all kinds. As long as you have a place to hold the frame references, you should be okay. If you need them.
    You can do drag and drop between components in different frames, no problem. Better read up on drag and drop first though.

  • Multiple jFrames in Application

    Hello,
    I am having problems finding documentation or an example on how to make multiple jFrames work.
    In my application I have my main jFrame and would like something very simple to where the user can open a second jFrame while the main jFrame is still visible (the second jFrame would have focus) the user can use the functionality of the second jFrame and then close it returning the focus back to the main jFrame.
    Can you point me into the right direction for doing this?
    Thanks,
    Tim

    Your question is too general. There are many ways to do this. First, what action do you want the user to take to open the second JFrame. Select a menu item? Click a button? Enter a value into a text input field? <continueAdNauseum/>
    Secondly, does the second JFrame prevent your user from continuing to work in the first JFrame. Then, Encephalopathic is correct ... JDialog is a top level container that can block input from other top level containers and their contents (using the [Modality API|http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/modality/]). A JFrame is another top level container, and you can open as many as you like.
    It's always good to start with the [Java Tutorial|http://java.sun.com/docs/books/tutorial/]. Pay special attention to the [Swing Tutorial|http://java.sun.com/docs/books/tutorial/ui/index.html] . It may seem like a lot to wade through, but you will learn alot. Then, as specific questions come up. you can ask them here.
    ¦ {Þ                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • I have one apple ID and multiple family members share this with their devices.  How do we keep pics and messages separate?

    I have one apple ID and multiple family members share this with their individual devices.  How do we keep pics and messages separate for each device?

    For messages
    MacMost Now 653: Setting Up Multiple iOS Devices For Messages and FaceTime
    For other issue:
    How to use multiple iPods, iPads, or iPhones with one computer
    What is the best way to manage multiple...: Apple Support Communities

  • Communication problem between NetBeans and Tomcat

    hi!
    i got a quite mysterious problem. here is what happens:
    - i start NetBeans 5.5.1 (the first time)
    - i want to debug my JSF-Project, the Debugger starts
    - After a few seconds the debugger waits for tomcat (it sais: "Waiting for Tomcat...") and tomcat starts
    - Again after a few seconds the tomcat-debugger-output sais "Tomcat startet in 3333 ms".
    okay.
    when i enter http://localhost:8084/ in my browser i get the tomcat homepage, so the server has definitely started! But nothing happens in NetBeans and nothing happens with my project....
    In the lower-right corner i see this blue working-bar that sais "deploying project" but nothing happens. The Project-Debugger-Output still sais "Waiting for Tomcat..." but nothing happens...
    And after something around 3 minutes (i guess it's a timeout) i get the error "Starting of Tomcat failed." But is HAS started, i can login to the Administration-Area in my browser!
    so i guess there is a communication problem between netbeans an tomcat. Netbeans waits for a message from tomcat but tomcat doesn't send it..or netbeans doesn't understand it.
    But the story goes on:
    When i press the debug-button a second time it takes only a few seconds till i get the message: "Tomcat server port 8084 already in use". OF COURSE! Because Tomcat has already startet and can't be stoped by NetBeans.
    i'm trying to solve this problem for 4 days now, so i would be very happy if anyone has an idea where to start/continue the search...
    thanks,
    flo.
    some system-info:
    - windows vista business 32-bit
    - no firewall is running
    - AntiVir Personal Edition IS running
    - Yahoo Widgets Engine IS running
    - no other software is running
    and finally the tomcat-log:
    Using CATALINA_BASE: C:\Users\Administrator\.netbeans\5.5.1\apache-tomcat-5.5.17_base
    Using CATALINA_HOME: C:\Program Files\NetBeans\enterprise3\apache-tomcat-5.5.17
    Using CATALINA_TMPDIR: C:\Users\Administrator\.netbeans\5.5.1\apache-tomcat-5.5.17_base\temp
    Using JRE_HOME: C:\Program Files\Java\jdk1.5.0_12
    Listening for transport dt_shmem at address: tomcat_shared_memory_id
    21.09.2007 18:27:50 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
    INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.5.0_12\bin;.;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\ThinkPad\ConnectUtilities;C:\Program Files\Common Files\Teleca Shared;C:\Program Files\Common Files\Adobe\AGL;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\cvsnt;
    21.09.2007 18:27:50 org.apache.coyote.http11.Http11BaseProtocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8084
    21.09.2007 18:27:50 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 1862 ms
    21.09.2007 18:27:50 org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    21.09.2007 18:27:50 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.5.17
    21.09.2007 18:27:50 org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    21.09.2007 18:27:53 org.apache.coyote.http11.Http11BaseProtocol start
    INFO: Starting Coyote HTTP/1.1 on http-8084
    21.09.2007 18:27:54 org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    21.09.2007 18:27:54 org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/31 config=null
    21.09.2007 18:27:54 org.apache.catalina.storeconfig.StoreLoader load
    INFO: Find registry server-registry.xml at classpath resource
    21.09.2007 18:27:54 org.apache.catalina.startup.Catalina start
    INFO: Server startup in 3626 ms

    As i wrote before, the same problem occured for me. I have found a solution which is : Go to tools menu and then select options . In the proxy info, select No Proxy.
    I hope this help you

  • New 13" Macbook Pro trying to connect to a Panasonic VIERA TC-L42U30 as second monitor. I've used multiple hdmi-thunderbolt/mini displayport adapters and multiple hdmi cables and still no success. The Macbook does not sense the second monitor (TV). Help?!

    I've been a Mac since 2008, so I know my way around the system pretty well. This issue, however, has me stumped. I had an iMac until now and only now am I experiencing some difficulty with my new MacBook Pro. The model I have is the newest 13" Macbook Pro model and I'm trying to connect a Panasonic VIERA TC-L42U30 42" HDTV as a second monitor via the Thunderbolt port.
    It worked the first two times and hasn't worked since, after 10-15 attempts with different configurations, turning things on n off, restarting the mac, unplugging the cables, adapters, TV, resetting the P RAM, etc... I've used multiple hdmi-thunderbolt/mini displayport adapters and multiple hdmi cables and still no success. No matter what I do, the Macbook does not sense the TV as a second monitor anymore.
    I took the MacBook Pro to the Apple Store, and their "genius" there had it working fine with a DVI connection to a regular monitor. The Panasonic TV I have has HDMI connections and one VGA connection which does not support HD, but no DVI option. I want an HD connection to mirror or extend my MacBook Pro screen. At the Apple Store, they didn't have a Thunderbolt/Mini DisplayPort to HDMI adapter, so he could not try that out for me.
    Anyone else have this configuration or another similar one with a Panasonic HDTV?
    Ideas? Suggestions? Anything?! Help!!
    P.S. I'm running Mountain Lion, if that wasn't already obvious. Everything is up to date in my App Store as well.
    Thanks!

    Hi There,
    I have had the exact same issue but with a projector.
    The issue lies with Mountian Lion 10.8.2.
    I tried many a combination with no luck to get HDMI working.
    Took my mac into the apple store and came to the conclusion it was the software, so I asked them to install 10.8 onto it (this is destructive so a backup is a must)
    Bought my macbook home and voila, now displaying through my projector.
    There is a small graphics update after 10.8.1 which seems to be the cause.
    Hope this helps.
    Thanks.

  • Hello,  I have iMac from Oct, 2010 and have OS 10.6.7 and multiple users.  Mail icon was accidently removed along with program.  Mail 4.4 is on other users but when I reloaded software my user got Mail 4.3. Mail 4.3 did not work with latest OS. Ideas?Matt

    Hello,  I have iMac Itel i3, from Oct, 2010 and have OS 10.6.7 and multiple users. 
    About 3-4 days ago the Mail icon in dock had question mark and was accidently removed, along with program on my user.  Oops.
    1. Mail 4.4 is on other users and works fine, but for me it does not work and tells me V4.3 does not work with latest OS X. 
    2. I reloaded software from my user with original disks  (Oct, 2010) and got Mail 4.3 again. Mail 4.3 did not work with latest OS.  I am unable to load Mail.  Gives Yellow error message.    
    "  You have Mail version 4.3 (1081/1084). It can’t be used on Mac OS X Version 10.6.7 (Build 10J869). For more information, click the Help button."
    3. Tried to update software and look for update for mail 4.3 on Apple site to no success.
    Hate to go to MS-Entorage ( I may need to learn something new and alien) mail program since contracts are in Mail/Address Book.
    Ideas?
    MattDeeds

    Matt,
    I would download and run the 10.6.7 combo update.
    http://support.apple.com/kb/DL1361
    Regards,
    Captfred

  • Can I use one itunes account for multiple users and multiple devices

    Can I use one itunes account for multiple users and multiple devices?

    The iTunes EULA, as I understand it (I'm not an attorney )for Apps is basically that one person can use an App multiple devices, or multiple people can use an App one device..so one to many or many to one, but not many to many....

  • How to bundle a .FLA and multiple .SWF files in one .EXE?

    Hi,
    I have a .FLA file which uses loadMovieNum() to load various
    .SWF files when each one is called by the user clicking on a
    button. Each .SWF file also uses loadMovieNum() to call a second
    .SWF file. When I publish the .FLA file as a .SWF file it all works
    beautifully.
    Now I need to package the entire project into a Windows
    projector .EXE file for offline use on a computer without the Flash
    Player. When I publish the main .FLA file as a .EXE file, the .SWF
    files still load, although they blink before fully loading and
    displaying steadily.
    What I would really like to do is to bundle all the .SWF
    files into the .EXE file so when I send the finished project to the
    end user, they only have to deal with one file, rather than a
    folder with the .EXE file and multiple .SWF files.
    Is there a way to do this?
    I am using Flash 8 Professional.
    Thanks,
    Cam

    Since this isn't going to be web-based, why not include all
    the external swf files into the same Flash file and then use
    attachMovie?
    This will allow you to create one .exe file that would
    contain EVERYTHING. Since you aren't worried about loading speeds,
    you don't have to load the movie clips, but can simply create one
    large Flash file.

  • One premium account and multiple Skype HD devices

    Will one Premium account and multiple non premium HD accounts work for video calling? Basically the idea is 10 HD skype devices, the set top boxes connected to tvs will dial into one Premium Mac or PC account for multiple video conferencing.

    Yes, one user needs to have a Group Video Calling subscription.
    Unfortunately, not all devices support Group Video calling (TV's for example, do not).
    Please see our website for more information: http://www.skype.com/en/features/group-video-chat/.

  • HT4137 iCloud setup with one Apple ID and multiple devices

    iCloud setup with one Apple ID and multiple devices

    What, exactly, are you trying to do? You can use the same iCloud account on as many devices as you want, as long as you don't turn on iTunes Match. Once you turn on Match, you're limited to 10 devices total.
    Is this what you want to do...same iCloud account, but different iTunes/App store accounts on each device? If so, you can do that also.

  • I have two macs at my house, and multiple iPhones. I want to keep the same apple id as everyone else, but i want to put my own music only on my iPhone. I want to do this with my laptop which is not the family's main iTune's computer.

    I have two macs at my house, and multiple iPhones. I want to keep the same apple id as everyone else, but i want to put my own music only on my iPhone. I want to do this with my laptop which is not the family's main iTune's computer.

    If you use the same Apple ID for iCloud on each device, yes. However, you can use the same Apple ID for iTunes content on each device, but different Apple ID's for iCloud, iMessage, FaceTime, etc., on each device. That way, you can have whatever iTunes content you want on each phone, but keep all of the other data separate. You can create another Apple ID here:
    https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/wa/createAppleId?loca lang=en_US
    Must be a verified email address.

  • Totally confused with iCloud and multiple devices

    Ok, So we have two each of the iPods, iPads and now iPhones.  Do we all share the same iCloud? Can we share apps through the cloud? How do I switch my iPad to the new one I got to give this one to my son. I am so new to all this apple stuff. Only been a few months and I'm still really confused.  What all goes to the iCloud? How do we see what's in the iCloud?  I really the the idiots instructions I think to figure this all out?  Can anyone help me?  How can I print from the iPad?  Everything I see says iOS 10 something?  I believe I only have 6 something? 

    Do we all share the same iCloud?
    icloud is designed so that only one user uses it to keep his/her devices in sync.  When multiple users use the same icloud account, they will then be sharing the same email address, contacts, calendars, notes, etc.  Usually that is not what two people want to do.
    Can we share apps through the cloud?
    You buy apps from the itunes store, that's different than icloud, and multiple users can use the same itunes account so that they can share apps, music, etc.  For a family, everyone usually uses the same Apple ID for an itunes account and individual Apple IDs for their icloud accounts.
    How do I switch my iPad to the new one I got to give this one to my son.
    What do you mean by "switch.. ipad to the new one"?
    What all goes to the iCloud?
    Backups of iOS devices, Apple services that you turn on to share data (settings>icloud; on an iOS device), third party apps that use icloud to sync their data between devices, email, photo stream, and more.
    How do we see what's in the iCloud? 
    Icloud is designed primarily for syncing data between the devices of the user - like getting all computers and devices to have the same contacts or calendars.  When you set up syncing (settings>icloud, turn on the services you want synced between your devices), some of that data will also be available to a computer's browser when you log into icloud.com.  Otherwise you view the data using the associated app, like the Calendar app to see events.  Other things that may be on icloud, like backups cannot be seen.  Also iCloud does not provide a photo gallary that others can view in a browser.
    How can I print from the iPad? 
    For that you need an "airprint" compatible printer. See,
    http://support.apple.com/kb/ht4356
    You can also print to a printer that's connected to a computer, but that computer needs special software, like Printopia for macs.
    Everything I see says iOS 10 something?  I believe I only have 6 something?
    There is no "10", version 6 is the current one.  You are probably thinking of OSX, whose versions are 10.x.y.  That's for macs, not iOS devices.

Maybe you are looking for

  • 2nd video card does not work

    I have a spare Mac Pro here so I decided to remove the video card and put it in the one I'm using. Both machines were purchased in '09 and use the same video card (ATI Radeon HD 2600). The two monitors I have hooked into the original video card work

  • A report layout  for address labels using Word's label-table

    Hello, I sent the following question to the BIPublisher forum, but didn't get any answers. Maybe it wasn't the right forum. I'm a little desperate with this problem, because I have spent days trying to solve this. Could somebody please help with this

  • Web service via integration engine - integration directory tasks

    Hello, I am new to PI and need help concerning the configuration of web service communication. A new enterprise service shall be exposed to the web. So, service provider is an ABAP AS, consumer is a unknown 3rd party system. Communication should be v

  • BSP with LDAP Authetication

    Hi, In our BSP application the user needs to be authenticated by a LDAp directory. (Lets say ADS). This because this directory contains all users and there actual passwords. The user-accounts in the LDAP Directory are the same as in the Web AS. (This

  • Router to Router VPN error

    Hi Everyone, I have a lab with (3) 2500series routers IOS 12.2. Have setup an ipsec vpn between the far side routers, but the ipsec sa is not establishing. After debugging isakmp to see if they establish phase 1, I get the following error: 03:52:45: