GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


picJava code by pic
import java.awt.*;
import java.awt.Toolkit.*;
import java.awt.Component.*;
import javax.swing.*;

class PoyuWindow
{
    private JFrame m_Frame;
    private String m_sTitle;
    private Rectangle m_WindowBoundaries;
    private GraphicsConfiguration m_gc;

    // constructors
    public PoyuWindow(String sTitle)
    {
        m_sTitle = sTitle;
    }

    // this function gets the default configuration for the 
    // display device and also sets the screen boundaries
    
    public GraphicsConfiguration GetConfig()
    {
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = ge.getDefaultScreenDevice();
        m_gc = gd.getDefaultConfiguration();

        m_WindowBoundaries = m_gc.getBounds();
        System.out.println("Boundaries : " + m_WindowBoundaries);

        return m_gc;
    }
        

    // create a window and set default properties
    public void CreateGUI()
    {
        JFrame.setDefaultLookAndFeelDecorated(true);

        m_Frame = new JFrame(m_sTitle, m_gc);
        m_Frame.setBounds(m_WindowBoundaries);
        m_Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        m_Frame.getContentPane().setLayout(new BorderLayout());
        m_Frame.pack();
        m_Frame.setVisible(true);

        
    }

    public void RunPoyu()
    {

    }

    public int GetWidth()
    {
        return m_WindowBoundaries.x;
    }

    public int GetHeight()
    {
        return m_WindowBoundaries.y;
    }
    
};