Closing a running gui

Hi
I have one Java Gui
public class GuiOne extends JFrame {..}
which opens another Gui
public class Gui2 which also extends JFrame,
I create the container for the second gui and add one label then
I do some processing after this but then
"if" a certain condition happens
I would like to close this second Gui but keep the first one open.
Can this be done?
Is there any way to close the second gui (Gui2)? I tryed calling
dispose() but it didnt' seem to work and System.exit() unfortunately
closes both of my gui!
Any help greatly appreciated!
Thanks
Gerry

Ahh, you need to call hide on the frame itself, not
the component.
Example:
public MyPanel extends JPanel implements
ActionListener {
public void actionPerformed(ActionEvent evt) {
Window w =
Window w = SwingUtilities.windowForComponent(this);
w.hide();
Thanks very much it does the trick surely! And my first Gui stays open which is what i want!
But it brings up this error in the command pompt , i'm not too sure if this is supposed to happen.
I just implemented your two lines inside action performed as I dont really want it to close at the hit of a button, just kinda after the program does a bit of processing. ActionPerformed is kinda for when a button is pressed isn't it?
.java.lang.NullPointerException
at TimetableWithParse.<init>(TimetableWithParse.java:132)
at PanelGui2$ButtonHandler.actionPerformed(PanelGui2.java:182)

Similar Messages

  • My iPad 1 apps keeps crashing. I have closed all running background apps,reset by holding power and home buttons but nothing works. Please its starting to get very frustrating and annoying.

    My iPad 1 apps keeps crashing. I have closed all running background apps,reset by holding power and home buttons but nothing works. Please help its starting to get very frustrating and annoying.

    What exactly do you mean by "crashing" and is it occuring on a specific app or under specific circumstances?

  • Closing Entry Run without "Revaluation of Consumption Checkbox"

    Hi gurus,
    I have a very important problem and I need to close the period as soon as possible.
    I did closing entry run for an individual material without the Revaluation of Consumption checkbox. CO object revaluation is active for the consumption alternatives (Both for CO and FI revaluation). We see normal postings (with checbox filled) with profitability (CO-PA) object. 
    What are the postings that ML did in both FI side and CO side. When I looked at the posting price differences are distributed for each single profitability(CO-PA) object in CKM3 view. Also related amount sent to ending inventory (both in CKM3 view and with FI stock account postings).
    Under this conditions, COGS account are posted still with standard price rather then actual price. Am I right. So, for the correct result, should we post the related amount (actual - std price difference X sold amount) to the COGS account?
    On the other hand, how will be the CO-PA posting at the end of the period. As you know the actual prices are taken from ML and COGS accounts are posted with standard prices. Therefore, CO-PA COGS amount will not be actual amount. Am I right.
    Thanks in advance.
    Ahmet

    Hi,
    I mean system has two different kind of postings, one of that is FI posting (legal) and the other is CO posting with cost elements (statistical like cost allocations). I run the step Consumption revaluation in CKMLCP and price differences distributed in CKM3 view. But as you know that actual postings are done in the closing entry step and I do not check the box of revaluate consumption in the closing entry parameters, actually price differences are not posted to consumptions rather CKM3 view changed.
    Therefore, COGS account posted with srtandart prices rather than actual prices because we did not checked the "revaluate consumption box". In order to fix the situation (actual-standart differences) should we post the related price difference amount to the COGS account.
    Ahmet

  • Firefox.exe (32 bit) continues to run in the background after closing, Im running Firefox (64 bit).

    After browsing the web and downloading items from websites, with Firefox's built in download manager, then closing Firefox I'll have to open my task manager and manually stop the 32 bit .exe. Im running Firefox (64 bit) on a Win7 (64 bit) system.

    see https://support.mozilla.com/questions/836193

  • [SOLVED] Problem with running GUI apps as root

    Hi,
    I have a serious problem with running any kind of software having GUI as root, which is indispensable for editing system files. For example I want to edit /etc/pacman.conf file with KWrite, and here's what I get
    [zbyszek@barca ~]$ xhost +
    access control disabled, clients can connect from any host
    [root@barca zbyszek]# kwrite /etc/pacman.conf
    kwrite(11282): Session bus not found
    KCrash: Application 'kwrite' crashing...
    KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
    sock_file=/root/.kde4/socket-barca/kdeinit4__0
    Warning: connect() failed: : Nie ma takiego pliku ani katalogu
    KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi directly
    drkonqi(11284): Session bus not found
    Can anyone help me with this? Can anyone tell me how to login as root?
    Thank you in advance.
    Last edited by Zibi1981 (2010-10-05 19:30:20)

    O.K., but how to run KWrite as root on my account??? That was my main question
    karol wrote:
    Try running 'xhost +' as root.
    https://bbs.archlinux.org/viewtopic.php?pid=817674
    Maybe vim is in edit mode when you press 'i' but it doesn't show '-- INSERT --' at the bottom of the screen.
    Here you are
    [root@barca zbyszek]# xhost +
    access control disabled, clients can connect from any host
    [root@barca zbyszek]# kwrite /etc/pacman.conf
    kwrite(12941): Session bus not found
    KCrash: Application 'kwrite' crashing...
    KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
    sock_file=/root/.kde4/socket-barca/kdeinit4__0
    Warning: connect() failed: : Nie ma takiego pliku ani katalogu
    KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi directly
    drkonqi(12942): Session bus not found
    Last edited by Zibi1981 (2010-09-25 10:19:50)

  • StackOverFlow when trying to run GUI.

    Hi, got StackOverFlowError when trying to run the GUI, please help..
    public class mainScreen extends JFrame {
        private JTabbedPane tabbedPane;
         private JFrame parent;     //creates a JFrame variable called parent to fit everything inside
         private JLabel lblUserID;     //creates a variable JLabel called lblUserID
         private JLabel lblPwd;          //creates a variable JLabel called lblPwd
         private JTextField tfdUserID;     //creates a JTextField variable called tfdUserID
         private JPasswordField pfdPwd;     //creates a JPasswordField variable called pfdPwd
         private JButton btnLogin, btnReset;     //creates JButton variables called btnLogin and btnReset
    ... yada yada..
       public mainScreen() {
          super( "Client GUI" );
          tabbedPane=new JTabbedPane();
          tabbedPane.addTab("Home", new HomePanel());
          tabbedPane.addTab("Profile",new profile());
          tabbedPane.addTab("Search",new search());
          tabbedPane.addTab("History",new history());
          tabbedPane.addTab("Subscription", new subscription());
          tabbedPane.setSelectedIndex(0);
          getContentPane().add(tabbedPane);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          setSize(600,420);
          setVisible(true);
          setResizable (false);
       }public static void main( String args[] ) {
    new mainScreen();
    Thanks!

    This section from the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html]Using Tabbed Panes gives you a working example. Compare your code with the example. You have so many custom components that we can't tell you what the problem is. Try creating one tab at a time to determine which tab is causing the problem. Basic debugging 101.

  • Workaround to run GUI apps on only text env.?

    Hi gurus,
    I have a GUI application and recently, I tried to add a shell mode support to it but, unfortunately, I found out that this apps is strongly GUI dependent. For now, I kinda cheated hiding any GUI display when run in shell mode.
    In fact, running from shell mode will still use awt, javax libraries but will not display any GUI. Therefore, when running this application in an only text environment will throw the exception "Can't connect to X11 window server".
    Is there any possible solution to workaround this issue? I'd like to try every possible solution before trying to remove completely the GUI dependence because this will be a major change for me.
    Any help will be greatly appreciated.
    Ward

    Have you tried catching the exception and ignoring it?yes but it dies anyway throwing the exception.
    Also, I'm trying using the Headless support but I'm getting a HeadlessException:
    bash-2.05b$ java -Djava.awt.headless=true -cp testTool.jar test.JTestoraptor.Main
    Exception in thread "main" java.awt.HeadlessException
    at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:121)
    at java.awt.Window.<init>(Window.java:274)
    at java.awt.Frame.<init>(Frame.java:401)
    at java.awt.Frame.<init>(Frame.java:366)
    at javax.swing.SwingUtilities$1.<init>(SwingUtilities.java:1641)
    at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1637)
    at javax.swing.JDialog.<init>(JDialog.java:211)
    at test.JTestoraptor.UI.MessageBox.<init>(MessageBox.java:69)
    at test.JTestoraptor.UI.ExceptionMessageBox.<init>(ExceptionMessageBox.java:
    64)
    at test.JTestoraptor.UI.ExceptionMessageBox.doExceptionMessageBox(ExceptionM
    essageBox.java:152)
    at test.JTestoraptor.Main.main(Main.java:121)
    The classes MessageBox and ExceptionMessageBox extend the class JDialog. Does the headless support work also with swing classes? or this headless support works only for awt classes?
    My main class extends JFrame so if the headless support doesn't work with swing classes, I was expecting to fail at the main class.
    Again, any help will be very much appreciated,
    Ward

  • Run GUI app with sudo privileges and no need for Terminal?

    I try to use 'Locator' (the GUI version of the 'locate' command) but find that it can't update its database without root privileges, which defeats the GUI-ness of it.
    Can it be set up to be 'run as administrator' a la Vista?

    Not on my machine. Might you have changed it?
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-*//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"*>
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>com.apple.locate</string>
    <key>Disabled</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/libexec/locate.updatedb</string>
    </array>
    <key>LowPriorityIO</key>
    <true/>
    <key>Nice</key>
    <integer>5</integer>
    <key>KeepAlive</key>
    <dict>
    <key>PathState</key>
    <dict>
    <key>/var/db/locate.database</key>
    <false/>
    </dict>
    </dict>
    <key>StartCalendarInterval</key>
    <dict>
    <key>Hour</key>
    <integer>3</integer>
    <key>Minute</key>
    <integer>15</integer>
    <key>Weekday</key>
    <integer>6</integer>
    </dict>
    <key>AbandonProcessGroup</key>
    <true/>
    </dict>
    </plist>

  • NWBC Desktop running GUI for HTML

    My NWBC Desktop installation is running all SAP transactions using the SAP GUI for HTML.  How can I fix my NWBC installation to use the desktop SAP GUI instead of the GUI for HTML?

    First of all a supported SAP GUI for Windows version needs to be installed, it is best to go with the latest one which is 7.30 PL 9. That said at least 7.20 PL 8 is required. Secondly you have to maintain connection entries both in SAP Logon as well as NWBC connections. Thirdly make sure that in NWBC connections the SAP GUI Logon Description field matches the description of the same system in SAP Logon. If it still isn't working, activate trace in NWBC and share the result as an attachment, not embedded in the body of the message.

  • I need help with closing a running program. It seems like it does not count as a program. Tried to turn of the computer and closing all programs. Please help!?

    I have a problem with a grey text box. It writes and says all i do. For example: When i now write it says all the letters one for one. If i open a new rogram it says so. If i click on something it gives me information about it. I can click the box and drag it, but dont close it. I have restarted the computer and closing all windows and programs. It just popped out when i was pressing some buttons on the mac. I think it is a easy way to fix it, but i cant find out what it is named and search for it. I think it is made for help and i did not download anything to get it. If i change user on the mac it does go away when I am on the other user, but i really want to keep the one i have because off all the settings and programs i have.
    Please reply if you know anything about this.
    This is a printscreen of the box, the language is Norwegian if someone wonder...
    It is really annoying, I hope someone can help me out.

    Oh thanks alot! Really happy that people take the time to answer my `noob`questions! Would not find that out by my own.
    Thanks!

  • Closing an inner gui

    Hey Folks
    I have a gui with two class's. One class is a gui and so is the other. The way i have it set up i can call the sub gui from the main gui. The problem that i'm having is that when the sub gui comes up, and i exit it, that it exits the entire program and brings me back to the dos prompt. I've tried another way of adding a button to the sub gui that calls the main gui, but it leaves the other open. The code below i think is where i should be lookin but not sure where to put the correct cmd that closes the sub gui and brings me back to the main gui
    Thanks
    Ambrose
    public void windowClosed(WindowEvent e)
         public void windowClosing(WindowEvent e)
         public void windowDeactivated(WindowEvent e)
         public void windowDeiconified(WindowEvent e)
         public void windowIconified(WindowEvent e)
         public void windowOpened(WindowEvent e)
         }

    if ( Target ==b1)
              System.out.println("Method Testing");
              //The call for the main gui
              JFrame frame = new JFrame ("Sending_Mail");
    frame.setDefaultCloseOperation
    peration (JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add (new
    add (new Sending_Mail());
    frame.pack();
    frame.setVisible (true);
    //Atttempting to clsoe the sub guiYou're instantiating a new JFrame and disposing it. WTFO? >           new JFrame ("Sending_Mail").dispose();
         }How about posting some code that makes sense. Your first two posts don't explain or illustrate your problem at all
    Cheers
    DB

  • Closing a running windows XP program from java

    Hello,
    Im currently making a program in java under sdk 1.4.0_01 and i want to be able to close a program which is already running in windows(Emule).
    Is this possible?
    I know how to run it using: Process proc = Runtime.getRuntime().exec ("mulePath");
    ...but i dont know how to close it unless ive already run it from java.
    Any help appreciated!
    Craig

    Search the web for the NT Toolkit. It has utilities that you can use to kill a process on NT type os's.

  • Unix Aix server how to run GUI mode for OBIEE 10.1.3.4.0

    Hi
    Experts
    I have Query on Obiee
    how to start GUI mode IN AIX unix server trough Vnc viewer. could Please tell Me any shell scripts is there
    very Urgent
    AdvanceThanks

    Thanks very much to responding to my question.
    I tried by disabling the Java Plugin in my IE browser and open a few chart reports with no problem.
    Have you actually experience problem when you do that? Like to know when will it actually have problem.

  • Automatic closing of SAP GUI generated by RRI in WAD

    BW experts,
    I am having a showstopper scenario in our project.  Basically i have a webbased report produced by WAD 7.0 and it is working correctly.  I have an RRI connected to it.  The RRI receiver is an ABAP program which we execute based from the item in WAD (i.e document number).
    However, it always open 2 browsers. 1 is for the SAP Gui session generated by RRI and 2nd browser is open due to the code we have in our abap which calls a browser (CALL_BROWSER).
    My question now is, is there a way to put an IF-THEN condition somewhere, perhaps in javascript, where the 1st SAP gui session can be killed immediately and the 2nd browser opened?
    I have already used different components like RRI, ClOSE_WINDOW, Script_item in WAD but with no avail.
    Any ideas is highly appreciated.

    Hello,
    I’m glad that you answered me. Your feedback was helpful for me and a source of good news for our project.
    I saw the B1DE form generator, it is still axed on the screen painter, and also I saw Ibai’s project.
    I realize that SBO developers need a more powerful tool for developing their add-ons. For the same reason we have started this project and we’ll continue to develop it.
    This is not just a .srf generator and converter. A powerful feature is that our visual objects have implemented the business objects from DI API (of course you choose with what business objects the visual objects are associated, obviously for performance reasons). The business logic can be made at the designer level. It is improper to say that they generate code because the code is embedded in the visual objects, and no code line is added. For example a complex choose from list can be made in a few minutes without any code writing. In a month the SBO UI add-on generator will be ready. So you can have the add-on developed with Axel Controls in Windows forms without writing hundreds of lines, and additionally with a click the SBO UI add-on will be generated automatically (srfs, functionality, menu and the .exe). And let’s not forget that the Windows forms solution made with Axel Controls has the same feel and look as the SBO.
    If you still have ideas or suggestions please post them.
    Regards,
    Andrei Baciu.

  • Closing a running process

    Being as I am now without a clockradio, I wrote a little alarm clock program for myself. Now that I wish to implement a "snooze" function, I need to be able to close a running Windows process (in this case, Winamp), from within my program. How would I go about this?
    Thanks.

    U can kill a process, if u r invoking the process
    Process p = Runtime.getRuntime().exec("notepad.exe");
    Later you decide you want to kill that process so you do this:
    p.destroy();

Maybe you are looking for