001 // GraphLab Project: http://graphlab.sharif.edu 002 // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology 003 // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ 004 package graphlab.ui.components.utils; 005 006 import java.awt.*; 007 008 /** 009 * @author rouzbeh ebrahimi 010 */ 011 public class GFrameLocationProvider { 012 static int coefficent = 16, determinator = 14; 013 static int prefCoef = 18; 014 015 public static Point getLocation() { 016 Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); 017 Point p = new Point((int) d.getWidth() / coefficent, (int) d.getHeight() / coefficent); 018 return p; 019 } 020 021 public static Dimension getSize() { 022 Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); 023 Dimension dim = new Dimension((int) d.getWidth() * determinator / coefficent, (int) d.getHeight() * determinator / coefficent); 024 return dim; 025 } 026 027 public static Dimension getPopUpSize() { 028 Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); 029 Dimension dim = new Dimension((int) d.getWidth() * 8 / coefficent, (int) d.getHeight() * 8 / coefficent); 030 return dim; 031 } 032 033 public static Dimension getPrefSize() { 034 Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); 035 Dimension dim = new Dimension((int) d.getWidth() * 8 / prefCoef, (int) d.getHeight() * 8 / prefCoef); 036 return dim; 037 } 038 039 public static Point getPrefLocation() { 040 Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); 041 Point p = new Point((int) d.getWidth() * 3 / prefCoef, (int) d.getHeight() * 3 / prefCoef); 042 return p; 043 } 044 045 public static Point getPopUpLocation() { 046 Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); 047 Point p = new Point((int) d.getWidth() * 4 / coefficent, (int) d.getHeight() * 4 / coefficent); 048 return p; 049 } 050 }