// @topic T11682 Swing demo A8 -- GUI window with three radio buttons // @brief class FrameApplication extends javax.swing.JFrame /** * @author ik */ package pckg; import java.awt.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.border.*; import javax.swing.text.*; /** * <code>FrameApplication</code> is the base class for UI window * of the application. */ public class FrameApplication extends javax.swing.JFrame { // ----- Operations ---------- /** * Class constructor takes care of all basic setup steps. */ public FrameApplication(String aCaption) { super(aCaption); setSystemLookFeel(); // Proper close-down procedure: this.addWindowListener(new FrameApplicationClosing()); } // method: FrameApplication /** * Sets the frame size */ private void setFrameDimension() { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int origin_x = screen.width / 4; int origin_y = screen.height / 4; int width = screen.width * 2 / 7; int height = screen.height * 2 / 7; this.setBounds(origin_x, origin_y, width, height); } // method: setFrameDimension // ----- Static Operations ---------- /** * Sets OS-specific look and feel */ private static void setSystemLookFeel() { // Force to come up in the system look and feel String laf = UIManager.getSystemLookAndFeelClassName(); try { UIManager.setLookAndFeel(laf); } catch (UnsupportedLookAndFeelException exc) { System.err.println("Unsupported: " + laf); } catch (Exception exc) { System.err.println("Error loading " + laf); } }// method: setSystemLookFeel } // class: FrameApplication