Yurttas/PL/OOL/Java/F/09/02/01/00/JxFrame.java

 1import java.awt.*;
 2import java.awt.event.*;
 3import java.util.*;
 4
 5//swing classes
 6import javax.swing.text.*;
 7import javax.swing.*;
 8import javax.swing.event.*;
 9
10
11public class JxFrame extends JFrame
12{
13   public JxFrame(String title)
14   {
15      super(title);
16      setCloseClick();
17      setLF();
18   }
19   private void setCloseClick()
20   {
21      //create window listener to respond to window close click
22      addWindowListener(new WindowAdapter() 
23       {
24	    public void windowClosing(WindowEvent e) {System.exit(0);}
25	    });
26   }
27   //------------------------------------------
28   private void setLF()
29   {
30   // Force SwingApp to come up in the System L&F
31	String laf = UIManager.getSystemLookAndFeelClassName();
32	try {
33       UIManager.setLookAndFeel(laf);
34   	 }
35       catch (UnsupportedLookAndFeelException exc) 
36         {System.err.println("Warning: UnsupportedLookAndFeel: " + laf);}
37       catch (Exception exc) {System.err.println("Error loading " + laf + ": " + exc);
38	   }
39   }
40}