Loading and displaying other  form on click of a button using swing

hi,
i've just started with my first ever swing program. i want to load another UI form on click of a button . how can i do that.

Sorry for posting last message
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class MainCl extends JFrame
public MainCl()
this.setBounds(100,100,400,300);
btn = new JButton("Click me to show another fframe");
btn.setBounds(10, 20, 250, 30);
this.getContentPane().setLauout(null)
this.getContentPane().add(btn);
btn..addActionListener(new ActionListener()
JFrame frm2 = new SecondFrame();
frm2.setVisible(true);
public static void main(String [] args)
JFrame frm1 = new MainCl();
frm1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frm1.setVisible(true);
JButton btn;
class SecondFrame extends JFrame
public SecondFrame()
this.setBounds(200,200,200,100)
this.getContentPane().add(new JLabel("This is NEW FORM"));
}

Similar Messages

  • When I open firefox 4 beta the webpage does not load and i am unable to click on any buttons or access menus

    This has only started happening today. When I start firefox 4 beta it opens and begins to load my homepage (google.co.uk) but the page never fully loads and firefox freezes. I am unable to click on any buttons on the navigation bar or access menus. Keyboard shortcuts are also unresponsive.
    All that I am able to do on the browser is to use the three window buttons in the top right of the screen (minimise, maximise and close).
    After closing the window if I try to open it again I get a message saying that Firefox is already running, but not responding. Once going into task manager and stopping firefox under the processes tab and then restarting firefox the window again freezes as soon as it opens.
    I have tried restarting my computer and reinstalling the beta but with no success. I am still able to use firefox 3.6.13 as well as chrome with no problems.
    Any help would be much appreciated

    I had this too. Starting firefox in safe-mode and disabling all add-ons solved the problem. After re-enabling all add-ons did not bring back the problem.

  • How to load and display the external flv video files in dynamicly and the how to control the flv fil

    How to load and display the external flv video files in dynamicly using AS 3.0
    and  How to control the flv file  add the play paus button and add seekbar.
    I have using to load the flv file following code
    var flvPlaceHolder1:MovieClip = new MovieClip();
    var vid1:Video = new Video(734, 408);
    flvPlaceHolder1.addChild(vid1);
    addChild(flvPlaceHolder1);
    flvPlaceHolder1.x = 1059;
    flvPlaceHolder1.y = 152;
    var nc1:NetConnection = new NetConnection();
    nc1.connect(null);
    var ns1:NetStream = new NetStream(nc1);
    vid1.attachNetStream(ns1);
    var listener1:Object = new Object();
    listener1.onMetaData = function(evt:Object):void {};
    ns1.client = listener1;
    ns1.play("GV-1600 TURNING.flv");
    ns1.addEventListener(NetStatusEvent.NET_STATUS, statusChanged1);
    function statusChanged1(ns1:NetStatusEvent):void
             trace(ns1.info.code);
            if (ns1.info.code == 'NetStream.Buffer.Empty')
                 trace('the video has ended');
                 removeChild(flvPlaceHolder1);
                 //trace('removeChild');
                gotoAndPlay(1786);
    then how to add the play,paus ,full screen button    and   seekbar,volumebar.

    I have to Create the flash presentation for our company product
    In this presentation the left  side the text animation are displayed then right side the our product video is displayed.
    In this presentation i need the following option :
    1, The first product video and animation is finished then the next product is played
    2, then the video displayed  (size width and height 400x300) , I click this video to increase the size(ex:1000x700)
    3, then the playing video i control  it play, stop, paus button and volume bar, seek bar.
    4, then this presentation is displayed on 42 inches LCD TV so this full presentation is run full screen.
    I have finished first two steps 1 and 2
    the following are the screen short and code:-
    code :-
    var count=0;
    var flvPlaceHolder2:MovieClip = new MovieClip();   
    var vid2:Video = new Video(734, 408);
    flvPlaceHolder2.addChild(vid2);
    addChild(flvPlaceHolder2);
    flvPlaceHolder2.x = 1059;
    flvPlaceHolder2.y = 152;
    var nc2:NetConnection = new NetConnection();
    nc2.connect(null);
    var ns2:NetStream = new NetStream(nc2);
    vid2.attachNetStream(ns2);
    var listener2:Object = new Object();
    listener2.onMetaData = function(evt:Object):void {};
    ns2.client = listener2;
    ns2.play("GS-4000.flv");
    this.addEventListener(Event.ENTER_FRAME, BtnFadeIn2);
    function BtnFadeIn2(event:Event):void
        if (this.currentFrame == 387)
            /*flvPlaceHolder2.x = 30;
            flvPlaceHolder2.y = 140;
            vid2.width=1800;
            vid2.height=800;
            trace('Screen size is changed');*/
            if(count==0)
            flvPlaceHolder2.x = 30;
            flvPlaceHolder2.y = 140;
            vid2.width=1800;
            vid2.height=800;
            count++;
    ns2.addEventListener(NetStatusEvent.NET_STATUS, statusChanged2);
    function statusChanged2(ns2:NetStatusEvent):void
        trace(ns2.info.code);
        if (ns2.info.code == 'NetStream.Buffer.Empty')
                trace('the video has ended');
                 removeChild(flvPlaceHolder2);
                 //trace('removeChild');
                gotoAndPlay(433);
    flvPlaceHolder2.buttonMode=true;
    flvPlaceHolder2.addEventListener(MouseEvent.CLICK,home2);
    function home2(e:MouseEvent):void
        if(vid2.width==734 && vid2.height==408)
            flvPlaceHolder2.x = 30;
            flvPlaceHolder2.y = 140;
            vid2.width=1800;
            vid2.height=800;
        else
            flvPlaceHolder2.x = 1059;
            flvPlaceHolder2.y = 152;
            vid2.width=734;
            vid2.height=408;

  • Loading And Displaying image From MYSQL

    Hello, How can I load and display picture stored into a MYSQL database in a Swing GUI using for example JLable component.

    establish a connection to ur sql, n
    retireve the record with the images or image url in the db.
    and then load it to a Image icon and set it to a JLabel.

  • PDF addresses not longer load and display PDF in Firefox and solutions suggest to other users with problem DON'T WORK (work fine in Chrome and Safari)

    This is an ongoing problem with other users. When putting a PDF in address window of Firefox and clicking go to address FIREFOX WILL NOT LOAD AND DISPLAY THE PDF. This problem has come up in questions from other users on your site. NONE OF THE SUGGESTED SOLUTIONS WORK! (trying either the Firefox PDF viewer or the Acrobat viewer as default viewer)
    I am using Firefox 23.0.1 (as some of the other users with the same problem). This was not a problem in the past with Firefox. Safari and Chrome continue load and display PDFs just fine from their addresses. This is a big problem as I now have to inform people who want to view my PDFs NOT TO USE FIREFOX BUT TO USE SAFARI OR CHROME.

    It appears that a link to a PDF on an internet page will not download in Firefox either!
    I went to this page:
    http://www.nasa.gov/connect/ebooks/earth_art_detail.html#.UjYEzrwsU08
    and tried to download the PDF link at the bottom of the page (Download: PDF 11.3 MB) It didn't work! Nothing happens. Tried it in Safari and it worked flawlessly.
    I have a PDF file of my work in the public_html folder on my URL. I give the address generated by that file to people who want to view my work---this works perfectly in Safari and Chrome. As to your other question, can't bookmark it if I can't get to it in Firefox.

  • HT1600 I get the menu and can pick a movie but then it won't load and displays an error message

    I get the menu and can pick a movie but then it won't load and displays an error

    What version of iPhoto do you have installed?  Is if one of the versions shown as not compatible in this screenshot?
    If it is then go to the App Store and download iPhoto 9.5.  It will be free if you have an iPhoto 9 or later verson currently.
    OT

  • Load and display image using CDC

    Hi everyone,
    Please help. I'm new to java. I need a simple routine to load and display an image from the file system into a CDC app on windows mobile 5. I'm usin creme 4.1.
    Thanx in advance

    Use the following as a guide:
    1. Get the image (path below must be absolute):
    public static Image getImage(String filename) throws ScanException {
    Image img = null;
    // Read paths from properties file
    StringBuffer buf = new StringBuffer("\\");
    buf.append(ScanUtility.getPathImages());
    buf.append("\\");
    buf.append(filename);
    buf.append(".jpg");
    File dataFile = new File(buf.toString());
    if(!dataFile.exists())
    throw new ScanException("Cannot locate the file:\n" + dataFile.getAbsolutePath());
    img = Toolkit.getDefaultToolkit().createImage(buf.toString());
    return img;
    2. Create a class to display the image (pass in the image, above):
    ImagePanel class source:
    import java.awt.*;
    import java.awt.image.*;
    public class ImagePanel extends Panel {
    private Image image = null;
    private Image scaledImage = null;
    private boolean imageComplete = false;
    public ImagePanel(Image img) {
    image = img;
    scaledImage = image.getScaledInstance(200, -1, Image.SCALE_DEFAULT);
    prepareImage(scaledImage, this);
    // Override the paint method, to render the image
    public void paint(Graphics g) {
    if(imageComplete) {
    g.drawImage(scaledImage, 0, 0, this);
    // Override imageUpdate method, to prevent repaint() from trying
    // to do anything until the image is scaled
    public boolean imageUpdate(Image img, int infoFlags, int x, int y, int w, int h) {
    if(infoFlags == ImageObserver.ALLBITS) {
    imageComplete = true;
    repaint();
    return super.imageUpdate(img, infoFlags, x, y, w, h);
    public void flush() {
    image.flush();
    scaledImage.flush();
    image = null;
    scaledImage = null;
    }

  • Skype phone not loading and displaying contacts.

    Hi All,
    I have a Skype cordless phone that has the latest firmware installed. My proble is that it now no longer loads and displays any of my contacts. I can see my contacts using the PC client but not on the Skype phone. All the other Skype phone funstions continue to work. Can anyone please help.
    Thanks
    Pau,

    I have a similar issue with a new RTX4088 phone, as more than 20 online contacts show in my skype PC client, while only 3 or 5 of these show as online on the 4088 handset.
    The software version show as 0172 / 11.02.2014 / rtx4088 lp vo172...
    Has others noticed this issue?
    Ocean Shores, NSW, Australia

  • After upgrading to Mavericks on my MacBook, I'm not able to download third party applications like Dropbox and MyCleanMac 2.  After clicking the download button, the screen just turns dark and is frozen.  Any idea what is happening?

    After upgrading to Mavericks on my MacBook, I'm not able to download third party applications like Dropbox and MyCleanMac 2.  After clicking the download button, the screen just turns dark and is frozen.  Any idea what is happening?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Click the Clear Display icon in the toolbar. Then try the action that you're having trouble with again. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message (command-V).
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.

  • HT201359 The new (09/19/13) Apple terms and conditions require one to click the AGREE button in order to update the apps;  however, there is no such button to click on.  Therefore I cannot update the apps on my iPhone.  Any ideas?

    The new (09/19/13) Apple terms and conditions require one to click the AGREE button in order to update the apps;  however, there is no such button to click on.  Therefore I cannot update the apps on my iPhone.  Any ideas?

    I was having the same problem, I had to go into iTunes on my laptop and agree to the terms there, and now i can download apps on my iPhone.

  • HT1199 I have an Apple MacBook Pro 1,1 Mac OS X 10.6.8. I have tried to load Native Instruments Guitar Rig 4LE. It would not load and said the following. System extension cannot be used.

    I have an Apple MacBook Pro 1,1 Mac OS X 10.6.8. I have tried to load Native Instruments Guitar Rig 4LE.
    It would not load and said the following. System extension cannot be used.
    The system extension "/system/library/Extensions/AppleUSBthernetHost.text" was installed improperly and cannot be used.
    Please try reinstalling it, or contact the product vendor for an update.
    I do not have a copy of the OS X 10.6.8 software. It is second hand so I have no product vendor to contact.
    What can I do?

    You recently updated iTunes to v.11.4? This message has popped up on many a Mac screen when this version was first made available, because this kext was obviously faulty.
    You should try to download iTunes 11.4 again from Apple's website: the new version bears the same name, but this kernel extension has been updated, and the issues it was causing are now a thing of the past.
    Should solve your problem, too...

  • I don't understand.  I use Google Docs to write letters & other forms, then convert them to PDFs using Adobe Acrobat.  If Forms Central closes, will I still be able to do this?

    I don't understand.  I use Google Docs to write letters & other forms, then convert them to PDFs using Adobe Acrobat.  If Forms Central closes, will I still be able to do this?

    Adobe also has Acrobat.com and there is DropBox.com. Adobe has also announced Adobe Document Cloud.
    Forms central provide a subscription service for users with Reader to create simple forms. Apparently this did not meet a majority of users and with the minimal price difference for Acrobat and free web storage the users were better served without it. I expect cloud services will continue to emerge until providers better and more fully understand the user requirements.

  • How often syncs Firefox sync with the server were my bookmarks are storaged? Can I turn of the historical sync because one computer is at home and the other is at work. So I use totally different webpages and would like to have the history disabled.

    How often syncs Firefox sync with the server were my bookmarks are storaged? Can I turn of the historical sync because one computer is at home and the other is at work. So I use totally different webpages and would like to have the history disabled.

    OK, I found the part about history. It is just to unmark that.
    But still i wonder how often it sync? Instantly? Or when closing FF?

  • One of my sons has an ipad mini and the other a larger ipad.  The one using the mini needs a larger ipad for school, so they need to switch.  They want to do so without losing their individual app progress.  Can I simply switch the SIM cards?

    One of my sons has an ipad mini and the other a larger ipad.  The one using the mini needs a larger ipad for school, so they need to switch.  They want to do so without losing their individual app progress.  Can I simply switch the SIM cards?

    SIM card has nothing to do with your Apple ID or apps.
    IOS devices do not store anything on the SIM card.
    BAckup everything on the iPads.
    REstore tbe ipad from the backup of the other iPad.
    REpeat for the other one.

  • Store and display other language

    hi friends
    database - 11g
    apex - 4.1
    i have form based on table. i want to display and store language "gujarati" in database. How it possible??
    Thanks

    Hi,
    you should set your applications Application Primary Language to Gujarati(gu).
    When you open your application click on the button "Edit Application Properties" then click on the tab "Globalization" there you can select Gujarati(gu) as your Application Primary Language.
    regards,
    Erik-jan

Maybe you are looking for

  • My issues with iPhone 2.0 on Original iphone

    Here are some of the issues i am seeing with the 2.0 update on my iPhone 2g. Texting is sometimes slow, however, exiting the app, or rebooting fix's the issue. Even though Mail was properly configured, upon the first install of 2.0, mail would crash

  • I want to create a new email address,  i already have one

    I would like to create a new mail address for my new buisness

  • B4.1 to V1.0 Migration with possible corrupt DB?

    Hi, I'm using B4.1 OK on Mac, but it takes over 3 minutes to load - splash screen with a spinning beach ball mostly, then unresponsive for a further couple of minutes until library shows up. I also get an odd console message about the LR database, bu

  • No cd drive - How to re install OSX

    Hi My work has inherited 10 emacs running Tiger. I have to erase and install on all of them but it appears there is no cd drive on some of them. Can I use the emacs with the drives to connect with firewire to the emacs without and perform an erase an

  • Reort

    Hi Expert, Is there any report which shows service description with line item,  as the material code is showing in ME2N report. Regards Rajesh