/************************************************************/ /* Petri.java Version 2003/03/28 */ /* */ /* Tom Fellmann, Christoph Weißenborn */ /* */ /************************************************************/ import java.awt.*; import javax.swing.*; /********************************************************************/ /* Klasse Petri */ /********************************************************************/ public class Petri /* ALTEVERSION extends Frame implements ActionListener */{ public static PetriFrame frame; public static Dimension screenSize; /***************************************************/ /* Main-Teil */ /***************************************************/ public static void main(String[] args) { System.out.println("Starte: Petrinetze mit gefaerbten Marken..."); try { screenSize = Toolkit.getDefaultToolkit().getScreenSize(); UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); new Petri(); } catch (Exception e) { e.printStackTrace(); } } //main /*********************************************************/ /* Konstruktor */ /*********************************************************/ public Petri() { frame = new PetriFrame(); /*frame.validate();*/ frame.jStatusBar.setText(""); frame.gefNetz.setModus( Netz.MODUS_NICHTS); frame.setSize( screenSize.width*7/8, screenSize.height*7/8); frame.setLocation(calculateDimensions_getLocalLocation(frame.getSize(),screenSize)); frame.setVisible(true); } //Petri-Konstruktor /*********************************************************/ /* Hilfsmethoden */ /*********************************************************/ public static Point calculateDimensions_getGlobalLocation( Dimension prefComponentSize, Container parent) { Dimension pS = parent.getSize(); Point pL = parent.getLocation(); int h = Math.min( prefComponentSize.height, pS.height); int w = Math.min( prefComponentSize.width, pS.width); prefComponentSize.setSize( w, h); return new Point( pL.x+(pS.width-prefComponentSize.width>>1), pL.y+(pS.height-prefComponentSize.height>>1)); }//calculateDimensions_getGlobalLocation private static Point calculateDimensions_getLocalLocation(Dimension prefComponentSize, Dimension parentSize) { int h = Math.min( prefComponentSize.height, parentSize.height); int w = Math.min( prefComponentSize.width, parentSize.width); prefComponentSize.setSize( w, h); return new Point( parentSize.width-prefComponentSize.width>>1, parentSize.height-prefComponentSize.height>>1); }//calculateDimensions_getLocalLocation } //Petri-Klasse