Results 1 to 7 of 7
Like Tree5Likes
  • 1 Post By KevinWorkman
  • 2 Post By PhHein
  • 1 Post By PhHein
  • 1 Post By PhHein

Thread: after closing JFrame, "javaw.exe" is still in task manager

  1. #1
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default after closing JFrame, "javaw.exe" is still in task manager

    Hi,
    after closing JFrame close button , javaw.exe is still found in the task manager, and program doesn't exit..
    Java Code:
    public class Mixed extends JFrame{
    
    
    	
    	 public static void main(String[] args) throws Exception
    	 {
    		 Dimension abc=new Dimension(400,500);
    		 Dimension def=new Dimension(5,2);
    
    		 Mixed mixed=new Mixed();
    
    		 JFrame jpanel=new JFrame("myframe");
    		 jpanel.setVisible(true);
    		 jpanel.setPreferredSize(abc);
    		 jpanel.add(textfield);
    		 jpanel.setBackground(Color.BLACK);
    
    		 JTextField textfield = new JTextField();
    		 textfield.getCursor();
    		 textfield.setAlignmentX(TOP_ALIGNMENT)
    		 textfield.setPreferredSize(def);
    		 textfield.setText("myText");
    
    		 jpanel.pack();
             }
    }
    regards
    dhilip

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,691
    Rep Power
    8

    Default Re: after closing JFrame, "javaw.exe" is still in task manager

    A JFrame is not a JPanel, I'd recommend cleaning up your naming.

    From the API: JFrame (Java Platform SE 7 )

    Unlike a Frame, a JFrame has some notion of how to respond when the user attempts to close the window. The default behavior is to simply hide the JFrame when the user closes the window. To change the default behavior, you invoke the method setDefaultCloseOperation(int). To make the JFrame behave the same as a Frame instance, use setDefaultCloseOperation(WindowConstants.DO_NOTHIN G_ON_CLOSE).
    noobplus likes this.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    6

    Default Re: after closing JFrame, "javaw.exe" is still in task manager

    Set the default close operation to EXIT_ON_CLOSE.

    EDIT: dammit Kevin ;)
    noobplus and KevinWorkman like this.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  4. #4
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: after closing JFrame, "javaw.exe" is still in task manager

    Hi,
    the object "textfield" is not visible.. is there an API for a JTextField?
    should we set backgroundcolor?
    Java Code:
    setBackGround()
    Edited to add: sorry, JTextField is for JPanel, JFrame has JMenubar.. removing JTextFields..
    regards
    dhilip
    Last edited by noobplus; 07-16-2013 at 03:23 PM.

  5. #5
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    6

    Default Re: after closing JFrame, "javaw.exe" is still in task manager

    There's an API for everything! Java Platform SE 7
    noobplus likes this.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  6. #6
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: after closing JFrame, "javaw.exe" is still in task manager

    Hi,
    1 more doubt.. JTextField() method is only for JPanel() class, and doesn't work for JFrame() class?
    regards
    dhilip

  7. #7
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    6

    Default Re: after closing JFrame, "javaw.exe" is still in task manager

    What?! JTextField() is a constructor. Read about JComponent, JWindow and in general all tutorials about Swing. There is so much wrong in you code.
    noobplus likes this.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

Similar Threads

  1. Replies: 8
    Last Post: 12-14-2012, 01:34 PM
  2. Replies: 0
    Last Post: 12-07-2012, 08:29 AM
  3. Security Manager equivalent of the "setuid" bit
    By erelsgl in forum Advanced Java
    Replies: 5
    Last Post: 07-12-2011, 09:52 AM
  4. javaw.exe problem in Task Manager
    By sarwar1234 in forum New To Java
    Replies: 5
    Last Post: 09-30-2010, 01:47 AM
  5. " javaw " not recognized
    By ChosenOne in forum New To Java
    Replies: 1
    Last Post: 09-23-2009, 12:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •