Close/Remove a frame and display another

I have a frame with a JButton.
when the JButton is clicked i am displaying a new frame (By calling the instance of a GUI class).
Now i want to close/remove the old frame, once the new frame is displayed.
Can anybody help me out?
-Achyuth B

both are entirely different frames.
this is the first time i am doing Swings program. And I am not sure whether the way i am doing is correct or not.
Do tell me if there is a better approach.
this is my login screen class.
public class LoginScreen
     public static Container container; //i made this static so that i can call this from other class with out creating the object of class
     protected static JTextField txtLoginId, txtPassword; // made staic as i can access easly from other class
     public void createGUI()
          JFrame frame = new JFrame();
          container = frame.getContentPane();
          container.setLayout(new GridBagLayout());
          GridBagConstraints c = new GridBagConstraints();
          JPanel panel = new JPanel();
          panel =  createLogin();     //this panel displays a login id and password TextBoxs.
          c.gridx = 5;
          c.gridy = 6;
          c.anchor = GridBagConstraints.CENTER;
          container.add(panel, c);
          panel =  createdButtons(); //the submit button
          c.gridx = 5;
          c.gridy = 7;
          c.anchor = GridBagConstraints.PAGE_END;
          container.add(panel, c);
          frame.pack();
          frame.setLocation(190, 120);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.show();
     private JPanel createLogin()
          //create & return panel
     //other functions
}

Similar Messages

  • What do I do to close eform on screen and display response of web service in another screen.?

    Hi,
    I am trying to build following functionality.
    I want to submit form to a web service through SOAP request on click of a button.
    I want to display response of web service like “form has been submitted successfully” on screen.
    What has been achieved.
    I am able to submit form to an adobe web service passing base64 string to adobe process.(see the script in image#1).
    When I receive base64 string in adobe process, I am able to re-generate document (using getDocFromBase64(/process_data/@inputStr) ).
    After that I am returning a message string to as response “Form submitted successfully”.
    When I get the response I populate response to a text field variable (Out Str). See image#2
    Problem/Desirable functionality.
    I want to close this eform and display the message “form has been submitted successfully” on another page in browser so that it depicts to end user that form has been submitted successfully with confirmation.
    What do I do to close eform on screen and display response of web service in another screen.?
    Image#1
    Image#2

    Method1: This method only works in same PDF window.
    On the click of the submit button, based on the webservice result we can close the PDF. As you already having in the "Out Str", this variable having detailed message kind of thing, so it would be easier if you have one more output variable to know if this submission is success or failure or can use the "Out Str", it self to compare and close the PDF.
    Here i am using "strResult" to hold webservice success or failure using true/ false values.
    Get the "strResult" value from binded field of webservice response and compare and close or display messages based on requirement.
    var strResult = YourFieldname.rawValue;
                        if(strResult != "" && strResult != null){
                                  if(strResult.toUpperCase() == "TRUE"){
                                            xfa.host.messageBox("Successfully Saved the Data.", "Submit Confirmation", 3,0);
                                            //Close the PDF
                                            app.execMenuItem("Close");
                        else{
                                  xfa.host.messageBox("Failed to Save the Data.", "Submit Confirmation", 3,0);
    If the result need to show in separate window and having LiveCycle process connected to PDF via. webservice or REST:
    Method2. If the PDF inside the browser
    Type1 - You can set the process output is document variable, this PDF may contain your static/dynamic message and this PDF. But with this method result PDF opens in same window, host pdf will be disappeared.
    Type2 - You can set the process output is string variable, this STRING may contain your static/dynamic message. In this method the string will be appered in the same PDF window, host pdf will be disappeared.
    Method3. If the PDF is stand alone (not opend in any browser)
    Type1 - You can set the process output is document variable, this PDF may contain your static/dynamic message and this PDF. But with this method result PDF opens in new window, host pdf will be also stayed and may make readonly after submission success.
    Type2 - If the process output is string, it cannot handle this situation, may get the content type exception while receiving the result string, because.
    Used all of the above methods in various situations and it worked without any issues.
    -Raghu.

  • Close the current UI and open another one

    Hello everyone,
    I've got the following code and I want to close the current window and open another one. When i use "System.exit(1);" it closes everything when I use "this.dispose()" it doesn't close anything what could I try to get this to work? any suggestions?
    the code is:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    //public class Equip_or_Job implements ActionListener {
    public class Equip_or_Job extends Frame implements ActionListener {
        JFrame dFrame;
        JPanel jePanel;
        JButton choice;
        JComboBox jeqid = new JComboBox();
        public Equip_or_Job() {
            //Create and set up the window.
            dFrame = new JFrame("Work with Jobid or Equipid");
            dFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the panel.
            jePanel = new JPanel(new GridLayout(2, 1));
            dFrame.getContentPane().setLayout(new BorderLayout());
            //Add the widgets.
            addWidgets();
            //Set the default button.
            dFrame.getRootPane().setDefaultButton(choice);
            //Add the panel to the window.
            dFrame.getContentPane().add(jePanel, BorderLayout.CENTER);
            //Display the window.
            dFrame.pack();
            dFrame.setVisible(true);
    Create and add the widgets.
        private void addWidgets() {
             //Create widgets.
              jeqid.addItem("Chose by Job");
              jeqid.addItem("Chose by Equipment");
              choice = new JButton("Chose");
                //Listen to events from the Convert button.
                choice.addActionListener(this);
              jePanel.add(jeqid);
              jePanel.add(choice);
        public void actionPerformed(ActionEvent event) {
              String sel = (String) jeqid.getSelectedItem();
            if("Chose by Job".equals(sel)){
                   InsertNewDates inj = new InsertNewDates();
                   //System.exit(1);
                   dispose();
              else if("Chose by Equipment".equals(sel)){
                   InsertNewDates ineq = new InsertNewDates();
                   //System.exit(1);
                   dispose();
    Create the GUI and show it.  For thread safety,
    this method should be invoked from the
    event-dispatching thread.
        private static void createAndShowGUI() {
            //Make sure we have nice window decorations.
            try {
                   UIManager.setLookAndFeel(
                        UIManager.getCrossPlatformLookAndFeelClassName());
              catch (Exception e) { }
            Equip_or_Job eorj = new Equip_or_Job();
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    thanks in advance :o)

    I'm not exactly sure what you want to do, but...:
    dFrame.setVisible(false) hides the current Frame and the application is still running
    Best reagrds, Marco

  • Two days before my iphone 5 battery was expand and display screen came out and now there has some gap between frame and display.so how it will happen and i already got before months.now i need to backup all the data to icloud before through out.

    two days before my iphone 5 battery was expand and display screen came out and now there has some gap between frame and display.so how it will happen and i already got before months.now i need to backup all the data to icloud before through out.
    https://www.dropbox.com/home/iphone
    https://www.dropbox.com/home/iphonehttps://www.dropbox.com/home/iphone

    Make an appointment at the genius bar of your local Apple Store. The phone has a 1 year warranty. If it's no longer under warranty, a replacement is $269.

  • How to take input in one frame and display it in other frame of  same page?

    I need to take input (text) for the comment field in one of the frames and when submit button is pressed it should be displayed in the other frame on the same page.
    I am able to get the input from the user but its not reflected in the other frame which basically is a table...............so let me know if you guys have any suggestions
    I used following code
    <form name="input" action="<%= base_url %>/index.jsp?yr=<%= y %>&mon=<%= m %>&day=<%= d %>" method="post">
    Comment:
    <input type="text" name="comment" size="20"/>

    The trick is to define paintComponent to all applicable panels and pass the Graphics parameter to a separate method which does the drawing for you.
    class Component1 extends JPanel
       //blah blah blah - put your code here
       public void paintComponent(Graphics g)
          //insert setup functions here
          paintStuff(g);
       //more arbitary code
       public void paintStuff(Graphics g)
          //do your drawing here
    }And you would usually want to separate your UI components from the drawing so it doesn't intefere with the client's perception of the program. In other words, don't draw on the content pane, draw on a custom panel and add it to an appropriate part of the content pane.
    Stephen

  • How do you remove error 0X00000709 from your computer? I just removed one printer and added another!

         I have a HP Pavilion Elite HPE computer and had an HP 6500 printer as my default.  I purchased a LaserJet Pro CM1415 and loaded it into my computer and removed (I thought) was the software for the HP 6500. 
          However when I try to make the CM1415 my default it gives me an error 0X00000709 and tells me I can not do it.  I no longer have any other printer listed, however I noticed some programs (Adobe for instance) don't even recognize the new printer, just the 6500 which got removed.  I have already removed the drivers (software) for the new printer and reloaded it. Also I checked the registry and the 6500 is listed there.  I did nothing with the registry at this time.
         I would like to know how I can remove this error and make my new printer the default (only one listed) one?  Thanks in advance for any and all answers

    Hello Porgeman,
    You may want to try the solution that is mentioned on this Microsoft Answers thread.
    http://goo.gl/y3mtw
    Method: Try to change the default printer value in registry key and check if it helps.
    Registry Disclaimer: Important this section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base: 322756 .
    How to back up and restore the registry in Windowshttp://goo.gl/UPP7r)
    a) Click on Start.
    b) Type regedit in the start search and click Enter.
    c) Move to the location mentioned below.
    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
    d) In the right column, you will find key Device, change the value to your Printer name.
    e) It is of the format for example: "HP LaserJet 4250 PCL6,winspool,Ne03:".
    f) Right click on the value and click on Rename, change it to your printer name.
    If I have helped you in any way click the Kudos button to say Thanks.
    The community works together, click Accept as Solution on the post that solves your issue for other members of the community to benefit from the solution.
    - Friendship is magical.

  • How to split a html page without frames and display random questions

    1) In my online examination application i need to display timer at the top of the page. even if the user
    scrolls down the timer should be visible. is there any way to do this without frames.
    2) questions are displayed randomly for each user. iam using rand() function to retrieve the questions from mysql database. now the problem is if the user refresh the page another set of questions are displayed. how to avoid this.
    thanks

    Hi Thanuja,
    Can you try it with the one below..... and checkout whether tht works or not
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
      </head>
    <script language="javascript">
    var i=0
    function showDate()
    i=i+1
    document.getElementById("staticcontent").innerHTML= "<center><b>Time :  " + i +" secs</b></center>"
    setTimeout("showDate()",1000)
    </script>
    <body onload="showDate()"> 
    <div id="staticcontent" style="position:absolute; border:1px solid black; background-color: lightyellow; width: 135px;">
    </div>
    <script type="text/javascript">
    //define universal reference to "staticcontent"
    var crossobj=document.all? document.all.staticcontent : document.getElementById("staticcontent")
    //define reference to the body object in IE
    var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
    function positionit(){
    //define universal dsoc left point
    var dsocleft=document.all? iebody.scrollLeft : pageXOffset
    //define universal dsoc top point
    var dsoctop=document.all? iebody.scrollTop : pageYOffset
    //if the user is using IE 4+ or Firefox/ NS6+
    if (document.all||document.getElementById){
    crossobj.style.left=parseInt(dsocleft)+5+"px"
    crossobj.style.top=dsoctop+5+"px"
    setInterval("positionit()",100)
    </script>
    <%
    /* JSP LOGIC*/
    %>
    <!-- Customized HTML content -->
    </body>
    </html>REGARDS,
    RaHuL

  • Help,how close pop-up window ,and open another view

    Hello,
    How click the pop-up window button ,then close the pop-up window .
    At the same time open another VIEW,and  transfer PO number to the VIEW.
    thanks

    Hi,
    First step is set the SCREEN TYPE as "Modal Dialog Box" in screen property tab.
    Then in PBO of the popup screen take a new GUI status and select DIALOG BOX as status type.
    Then assign some function code in 'X' button say 'CANCEL'.
    the put ur logic like below :
    PBO
    module gui_status.
    PAI.
    module user_command.
    module gui_status.
       set pf-status 'ZPOPUP'.
    endmodule.
    module user_command.
      if ok_popup = 'CANCEL'. " Where ok_popup is the ok_code variable in ur popup screen , also define it in TOP include
        leave to screen 0.
    endif.
    endmodule.
    Hope this will solve your problem and help you to put your logic.
    Thanks

  • Who came up with the ridiculous idea of removing disable images and javasceipt checkboxes in options? Please bring it back or it's bye bye firefox for me.

    My browser recently updated to firefox 23 and I was so shocked to see the core functions - disable images and javascript missing. I spent a good while going through every single menu and sub-menu because the idea that firefox could make such a laughable and stupid decision to remove it didn't even occur to me. I've been using firefox for YEARS, and in all the 20+ releases I've lived through, this by far wins the cake of WTF. I use these features on daily basis and I seriously have no idea what made firefox developers think that they won't make users flip the tables by removing such useful basic functionality. So if this isn't fixed in next update, I'm giving up firefox. It sucks to have to part with it after so long, but you're giving users no choice. A browser that is so severely handicapped isn't worth wasting my time on. I'll go back to firefox 22 until I see if this is addressed in near future, else I need to go for google chrome.
    Honestly, VERY very disappointing update from firefox.

    Agreed with the first poster. I just had to spend more time than I thought necessary trying to deal with this just to simply do something that was always so simple before in FireFox.
    Thanks to that complicated QuickJava plugin suggested as an alternative, I clicked its button to see what would happen... and WHOOPS! There goes Javascript. Clicking it back doesn't re-enable it. Thanks. This is just what I needed when I wanted to ONLY DISABLE IMAGES.
    Instead of playing around with its settings I decided to just remove it asap and try another avenue instead of screwing up my settings any more being new to the add-on. Removing the plugin left my browser without Javascript... great. That was a fun experiment. I guess that's my "thank you for trying!".
    Congratulations, OP, for making it clear how ridiculous this dumb decision was. I'm going to follow your suggestion and actually say "bye bye" to Firefox. I've been using it since the days when it used to be called Firebird. Yeah, long time ago. And this day marks the end. It seems the policy these days is to appeal to newcomers to computers, instead of the actual computer users who made this program popular in the first place. This seems to be the death kiss for any good piece of software that gets too popular.
    </rant>

  • Reading from a text file and displaying the contents with in a frame

    Hi All,
    I am trying to read some data from a text file and display it on a AWT Frame. The contents of the text file are as follows:
    pcode1,pname1,price1,sname1,
    pcode2,pname2,price2,sname1,
    I am writing a method to read the contents from a text file and store them into a string by using FileInputStream and InputStreamReader.
    Now I am dividing the string(which has the contents of the text file) into tokens using the StringTokenizer class. The method is as show below
    void ReadTextFile()
                        FileInputStream fis=new FileInputStream(new File("nieman.txt"));
                         InputStreamReader isr=new InputStreamReader(fis);
                         char[] buf=new char[1024];
                         isr.read(buf,0,1024);
                         fstr=new String(buf);
                         String Tokenizer st=new StringTokenizer(fstr,",");
                         while(st.hasMoreTokens())
                                          pcode1=st.nextToken();
                               pname1=st.nextToken();
              price1=st.nextToken();
                              sname1=st.nextToken();
         } //close of while loop
                    } //close of methodHere goes my problem: I am unable to display the values of pcode1,pname1,price1,sname1 when I am trying to access them from outside the ReadTextFile method as they are storing "null" values . I want to create a persistent string variable so that I can access the contents of the string variable from anywhere with in the java file. Please provide your comments for this problem as early as possible.
    Thanks in advance.

    If pcode1,pname1,price1,sname1 are global variables, which I assume they are, then simply put the word static in front of them. That way, any class in your file can access those values by simply using this notation:
    MyClassName.pcode1;
    MyClassName.pname1;
    MyClassName.price1;
    MyClassName.sname1

  • Remove attached clip and go to a frame on a main movie

    I am attaching a Movie Clip on a Main movie wthi sthis:
    exit_btn.addEventListener(MouseEvent.CLICK, fexit, false, 0, true);
    function fexit(e:MouseEvent):void{
        var mc:alert_mc=new alert_mc();
        mc.x=320;
        mc.y=210;
        addChild(mc);
    I need to make the Main movie go to frame 6 and remove the attached clip when I click on yep_btn button. The code on the attached clip is:
    nope_btn.addEventListener(MouseEvent.CLICK, cancelunloadexitb);
    yep_btn.addEventListener(MouseEvent.CLICK, unloadexitb);
    function cancelunloadexitb(e:MouseEvent):void {
        var snd:sound1 = new sound1();
        snd.play();
        this.parent.removeChild(this);
    function unloadexitb(e:MouseEvent):void {
         var snd:sound1 = new sound1();
        snd.play();
        I NEED CODE HERE
    function errorF(e:IOErrorEvent):void{
    trace(e);
    Any ideas?

    If that code is inside the alert_mc object, then you can try...
    function unloadexitb(e:MouseEvent):void {
         var snd:sound1 = new sound1();
        snd.play();
        MovieClip(parent).gotoAndStop(6);
        MovieClip(parent).removeChild(this);
    Another way to do it would be to just have the alert_mc dispatch an event that you assign a listener for in the main, and have the main event handler function for that listener deal with removing the child and moving on its own timeline.

  • Close current gui and open another?

    how can i close the current gui and then open another? what would be a suitable way to so? so far i do it using the following code but it does not close the current window and it takes a couple of seconds to load the other gui screen..
       private void btn_registerActionPerformed(java.awt.event.ActionEvent evt) {                                            
             Register Register_gui = new Register();
             Register_gui.setTitle("Login");
             Register_gui.setSize(467, 460);
             Register_gui.getSize();
             Register_gui.setVisible(true);// TODO add your handling code here:
             new Login().setVisible(false);
        }     

    Instead of new Login().setVisible(false); use dispose();This assumes that the event handler is a member of the frame you want to close. If not, you'll have to provide the handler with a reference.

  • In SAPUI5, Passing Table Row Data  Selected in one xml view to another xml view and display in the second View

    Dear Friends,
    Please provide the solution for the following scenario:
    In the first view(xml)  I have a table with the fields QuotationNo,plant name, material no...etc, where I am displaying the data fetched using Odata model. The table is enable with Single line selection mode. My requirement is to Carry the selected row data to another view(xml) and display there.
    Please give your valuable inputs.

    Hi Rinku,
    depending on how you do the navigation, you might find the information here: OpenUI5 SDK - Demo Kit helpful.
    Regards Frank

  • When I try to open Firefox 3.6 (Mac) by clicking on the icon, I get this message: "Close Firefox: A copy of Firefox is already open. Only one copy of Firefox can be open at a time." I've removed older versions and restarted, but still get this message. Wh

    I've just downloaded Firefox 3.6 (Mac). When I attempt to open, this message pops up: "Close Firefox: A copy of Firefox is already open. Only one copy of Firefox can be open at a time." I've removed older versions and restarted, but still get this message. What's going on?
    == This happened ==
    Every time Firefox opened
    == after I downloaded the latest version. ==
    == User Agent ==
    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7

    You might find your solution in [http://kb.mozillazine.org/Profile_in_use this article].

  • How can I remove the Apple ID authorization only on one computer and authorize another in his place?

    how can I remove the Apple ID authorization only on one computer and authorize another in his place?

    De-authorize the computer in question.
    Then authorize the new computer.
    Or de-authorize all computers and authorize only the ones that actually exist.

Maybe you are looking for