import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; /** * @auther Chris Thiel, ofmCap * @version Sep 7, 2026 * */ public class BasicGUIApp extends JPanel { public static int WIDTH=800; public static int HEIGHT=600; private Font titleFont, regularFont; public BasicGUIApp() { //initialize variables here... titleFont = new Font("Roman", Font.BOLD, 18); regularFont = new Font("Helvetica", Font.PLAIN, 12); } /** * The main method * - makes an instance of the App, * - associates a window close to quit the App * - Initializes the Frame * - adds the App to the Content Pane associated to the Frame * - Makes it visible */ public static void main(String[] args) { BasicGUIApp app= new BasicGUIApp(); JFrame window = new JFrame("My BasicGUIApp"); window.setSize(WIDTH, HEIGHT); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.getContentPane().add(app); window.setVisible(true); } /** * This the place to add the visible content * See the API for Graphics to discover * How to draw pictures */ public void paintComponent(Graphics g){ super.paintComponent(g); g.setColor(Color.WHITE); g.fillRect(0, 0, getWidth(),getHeight()); g.setColor(Color.BLUE); g.setFont(titleFont); g.drawString("My Generic Application", 20, 20); g.setColor(Color.BLACK); g.setFont(regularFont); g.drawString("Version 1.0", 20, 40); } // update is a workaround to cure Windows screen flicker problem public void update(Graphics g){ paint(g); } }