Es bleibt immer noch eine Javaw instanz zurück

Status
Nicht offen für weitere Antworten.

materthron

Mitglied
Hallo an alle!

Was stimmt bei diedem Code nicht, dass im Taskmanager immer noch ein(e) Task Javaw zurückbleibt?

Und was hat das Javaw eigentlich zu bedeuten?

BTW: die String usw. hab ich deshalb so umständlich gemacht, weil ich diesen AboutDialog immer wieder verwenden will *g*.

Code:
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class AboutWindow extends JDialog {

    
    public String name = "BMICalc"; //the applications name
    public String version = "0.2"; //the applications version
    private String author = "Philipp Weissenbacher"; //the applications author(s)
    
    private String description = "<html>BMICalc is a BMICalculator which enriches your BMI with useful information."; //the applications description
    private String copyright = "© & 2004 Philipp Weissenbacher</html>"; //the copyright information
    
    
    private URL pictureURL = AboutWindow.class.getResource("logo big.png");
	private ImageIcon icon = new ImageIcon(pictureURL);
    
    Font small = new Font("sans-serif", Font.PLAIN, 10); //the descriptions and copyrights font 
    
    public AboutWindow() {
        //The panel covers the whole window
        JPanel aboutPanel = new JPanel();
            getContentPane().add(aboutPanel);
            
            aboutPanel.setLayout(new BoxLayout(aboutPanel, BoxLayout.PAGE_AXIS));

            aboutPanel.setOpaque(false);
            
        /** Application logo */
        JLabel logo = new JLabel();
            aboutPanel.add(logo);
        
            logo.setIcon(icon);
          
            
            
       /** Application name label */
       JLabel nameLabel = new JLabel(name);
           aboutPanel.add(nameLabel);
           
           nameLabel.setFont( new Font("sans-serif", Font.BOLD, 14) );
           nameLabel.setBorder( BorderFactory.createEmptyBorder(5,35,10,25) );
           
      
      /** Application description & copyright information */
      JLabel descrLabel = new JLabel(description+"

"+copyright);
          aboutPanel.add(descrLabel);
          
          descrLabel.setFont(small);
         
         
    /** OkButton */
    JPanel buttonPanel = new JPanel( new FlowLayout(FlowLayout.CENTER) );
        aboutPanel.add(buttonPanel);
        buttonPanel.setBorder( BorderFactory.createEmptyBorder(10,5,5,5) );
    
        JButton OkButton = new JButton("Ok");
            buttonPanel.add(OkButton);
        
            OkButton.addActionListener( new ActionListener() 
             {
                public void actionPerformed(ActionEvent ae)
                {
                    //close the window if "Ok" is clicked
                    if( ae.getActionCommand().equals("Ok") ) 
                    {
                        dispose();
                        System.gc();
                    }
                } 
             }
            );
            
        OkButton.setBounds(25,5,5,5);    
            
            
        //Window preferences
        setLocation(300,200);
        setSize(300,400);
        setResizable(false);
        setModal(true);
        setTitle(name + " " + version);
        
        setVisible(true);
    }
    
    public static void main(String[] args) {
        AboutWindow a = new AboutWindow();
    }
}


Danke vielmals im Voraus!

Gruss,
Philipp
 
materthron hat gesagt.:
Hallo an alle!

Was stimmt bei diedem Code nicht, dass im Taskmanager immer noch ein(e) Task Javaw zurückbleibt?

Und was hat das Javaw eigentlich zu bedeuten?

Javaw ist das Programm, welches deinen Java-Prog erst Leben einhaucht, es interpretiert die *.class-Dateien und sorgt dafür, dass die Befehle die dort drinstehen ausgeführt werden. Und solange dein Progi läuft, wird auch ein "javaw" (oder ein "java") laufen, das endet erst, wenn dein Progi mausetod ist.
 
natürlich bleibt der prozess auch über. du shcließt ja auch nirgendwo dein program !?!?
System.exit zum schließen

edit gr
 
In der Main am besten noch hinten ein
Code:
System.exit(0);
als letzte Zeile ranklatschen.
 
Status
Nicht offen für weitere Antworten.

Zurück
Oben