LINUX: Swing creates indestructible JFrame-threads

Discussion in 'Java' started by tom baker, Sep 27, 2004.

  1. tom baker

    tom baker Guest

    Hi there,

    I'm programming an application for touchscreens. Each 'page' on the
    screen is a JFrame. Among other criterions it's IMHO the easiest way
    to go into 'idle'-state (by using a javax-Timer with 'dispose').

    Each new JFrame (e.g. gui_start_swt_log_inst=new
    cls_gui_start_swt_log(getCode()); ) creates a new linux
    thread (or process). But after dispose() the thread/process of this
    JFrame is still there.

    Now I worry about that the whole system could
    slow down or stop after a certain time, because the OS still has to
    provide ressources for these non-active processes/threads.

    What is the cause? java?


    I hope this is part of my code ist not to short but meaningful enough:




    public class cls_gui_start extends JFrame
    {

    private cls_gui_start_swt_log gui_start_swt_log_inst;
    private GuiStartListener listener_gui_start;
    ...


    public cls_gui_start()
    {
    JTextField jtf_code;
    JButtons, etc.
    }

    class GuiStartListener implements ActionListener {


    public void actionPerformed(ActionEvent event)
    {

    // ----------------------------------------------------------------------------

    if ( (jtf_code.getText()).startsWith("P") )
    {

    gui_start_swt_log_inst=new
    cls_gui_start_swt_log(getCode());
    gui_start_swt_log_inst.show();

    gui_start_swt_log_inst.addWindowListener(new
    WindowAdapter() {
    public void windowClosed(WindowEvent event)
    {
    System.out.println("gui_start: the end of
    gui_start_swt_log_inst");
    }
    });
    }
    }
    }
    }


    ##########################################################
    ##########################################################
    //
    // Staff Work time logging


    public class cls_gui_start_swt_log extends JFrame
    {

    private GuiStartSwtLogListener listener_gui_start_swt_log;
    private javax.swing.Timer countdown;
    ...

    public cls_gui_start_swt_log(int code)
    {
    // Kills the window after 10 seconds if it is unused
    countdown = new javax.swing.Timer(10000, new ActionListener()
    {
    public void actionPerformed(ActionEvent e) {
    countdown.stop();
    dispose();
    }
    });
    countdown.start();

    // Buttons etc.
    }


    class GuiStartSwtLogListener implements ActionListener {


    public void actionPerformed(ActionEvent event)
    {

    // ------------------------------------------------------------------------

    if (event.getSource() == btn_begin)
    {
    countdown.stop();
    // write into file
    dispose();
    }
    }
    }




    Thanks in advance !

    tom
     
    tom baker, Sep 27, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lucky

    swing JFrame problem

    lucky, Aug 17, 2003, in forum: Java
    Replies:
    3
    Views:
    596
    =?ISO-8859-1?Q?Andree_Gro=DFe?=
    Aug 18, 2003
  2. tom baker

    LINUX: Swing creates

    tom baker, Sep 10, 2004, in forum: Java
    Replies:
    2
    Views:
    404
    tom baker
    Sep 21, 2004
  3. David Coppit
    Replies:
    5
    Views:
    335
    David Coppit
    Mar 19, 2005
  4. jakester
    Replies:
    3
    Views:
    1,833
    jakester
    Apr 3, 2007
  5. Replies:
    2
    Views:
    418
    markspace
    Aug 27, 2012
Loading...

Share This Page