当前位置: 首页>>代码示例>>Java>>正文


Java JFrame.getSize方法代码示例

本文整理汇总了Java中javax.swing.JFrame.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.getSize方法的具体用法?Java JFrame.getSize怎么用?Java JFrame.getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JFrame的用法示例。


在下文中一共展示了JFrame.getSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: displayCalibrationStatus

import javax.swing.JFrame; //导入方法依赖的package包/类
@Override
protected void displayCalibrationStatus(JFrame frame) throws Exception {
      	CalibrationStatusDisplay calibDisplay = 
      			new CalibrationStatusDisplay(frame, calibrationPoints,new java.awt.geom.Point2D.Double[9]);
      	frame.setMinimumSize(new Dimension(600,300));
      	
      	frame.add(calibDisplay);
      	
      	frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      	frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
      	frame.setVisible(true);
      	frame.setTitle("Calibration: "+new Date());
      	Insets insets = frame.getInsets();
      	int width = frame.getSize().width-(insets.left+insets.right);
      	int height = frame.getSize().height-(insets.top+insets.bottom);
      	calibDisplay.windowDimension = new Dimension(width,height);
      	frame.toFront();
      	calibDisplay.repaint();
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:20,代码来源:SystemMouseTracker.java

示例2: setFramePositon

import javax.swing.JFrame; //导入方法依赖的package包/类
static void setFramePositon(JFrame inTargetFrame) {

        Dimension d    = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension size = inTargetFrame.getSize();

        // (ulrivo): full size on screen with less than 640 width
        if (d.width >= 640) {
            inTargetFrame.setLocation((d.width - size.width) / 2,
                                      (d.height - size.height) / 2);
        } else {
            inTargetFrame.setLocation(0, 0);
            inTargetFrame.setSize(d);
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:15,代码来源:CommonSwing.java

示例3: CompositionArea

import javax.swing.JFrame; //导入方法依赖的package包/类
CompositionArea() {
    // create composition window with localized title
    String windowTitle = Toolkit.getProperty("AWT.CompositionWindowTitle", "Input Window");
    compositionWindow =
        (JFrame)InputMethodContext.createInputMethodWindow(windowTitle, null, true);

    setOpaque(true);
    setBorder(LineBorder.createGrayLineBorder());
    setForeground(Color.black);
    setBackground(Color.white);

    // if we get the focus, we still want to let the client's
    // input context handle the event
    enableInputMethods(true);
    enableEvents(AWTEvent.KEY_EVENT_MASK);

    compositionWindow.getContentPane().add(this);
    compositionWindow.addWindowListener(new FrameWindowAdapter());
    addInputMethodListener(this);
    compositionWindow.enableInputMethods(false);
    compositionWindow.pack();
    Dimension windowSize = compositionWindow.getSize();
    Dimension screenSize = (getToolkit()).getScreenSize();
    compositionWindow.setLocation(screenSize.width - windowSize.width-20,
                                screenSize.height - windowSize.height-100);
    compositionWindow.setVisible(false);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:CompositionArea.java

示例4: saveScreenAndDimensions

import javax.swing.JFrame; //导入方法依赖的package包/类
private void saveScreenAndDimensions(JFrame frame) {
    if (!frame.isVisible()) {
        return;
    }

    // check multiple displays
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] screens = ge.getScreenDevices();
    Point pos = frame.getLocationOnScreen();
    Dimension size = frame.getSize();
    if (screens.length == 1) {
        Config.instance().to().setProperty(Config.Entry.POS_X.key(), pos.x);
        Config.instance().to().setProperty(Config.Entry.POS_Y.key(), pos.y);
        Config.instance().to().setProperty(Config.Entry.POS_WIDTH.key(), size.width);
        Config.instance().to().setProperty(Config.Entry.POS_HEIGHT.key(), size.height);
        logger.info("Saved window dimensions to config file (single screen found)");
    } else {
        Rectangle screenBounds = frame.getGraphicsConfiguration().getBounds();
        pos.x -= screenBounds.x;
        pos.y -= screenBounds.y;
        GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
        Config.instance().to().setProperty(Config.Entry.SCREEN_POS_X.key(), pos.x);
        Config.instance().to().setProperty(Config.Entry.SCREEN_POS_Y.key(), pos.y);
        Config.instance().to().setProperty(Config.Entry.SCREEN_POS_WIDTH.key(), size.width);
        Config.instance().to().setProperty(Config.Entry.SCREEN_POS_HEIGHT.key(), size.height);
        
        Config.instance().to().setProperty(Config.Entry.SCREEN.key(), device.getIDstring());
        logger.info("Saved window dimensions to config file (multi screen found)");
    }
    
}
 
开发者ID:rjaros87,项目名称:pm-home-station,代码行数:32,代码来源:Station.java

示例5: center

import javax.swing.JFrame; //导入方法依赖的package包/类
/**
 * Center JFrame.
 */
public static void center(JFrame frame) {
	Dimension frameSize = frame.getSize();
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	frame.setLocation((screenSize.width - frameSize.width) >> 1, (screenSize.height - frameSize.height) >> 1);
}
 
开发者ID:igr,项目名称:swingspy,代码行数:9,代码来源:SwingUtil.java

示例6: displayCalibrationStatus

import javax.swing.JFrame; //导入方法依赖的package包/类
protected void displayCalibrationStatus(JFrame frame) throws Exception {
	 double[] pointsNormalized = jniGetCalibration();
	 
	 if (pointsNormalized == null)
		 throw new IOException("Can't get calibration data!");
	 
	 int zeros = 0;
	 for( double ord: pointsNormalized){
		 if( ord <= 0 || ord > 1) zeros++;
	 }
	 ArrayList<Point2D.Double> points = new ArrayList<Point2D.Double>();
	 ArrayList<Point2D.Double> invalidpoints = new ArrayList<Point2D.Double>();
	//if( zeros > 0 ) throw new IOException("zeros in points: "+zeros+"/"+pointsNormalized.length);
	 
	 int itemCount = pointsNormalized.length/4;

	 for( int i=0; i < itemCount; i++ ){
		 
		points.add(new Point2D.Double(pointsNormalized[i],pointsNormalized[i+itemCount]));
		points.add(new Point2D.Double(pointsNormalized[(2*itemCount)+i],pointsNormalized[i+(itemCount*3)]));
	 }
	 
	 Rectangle2D.Double rect = new Rectangle2D.Double(0.0,0.0,1.0,1.0);
	 
	 for(Point2D.Double p: points){
		 if( !rect.contains(p) ) invalidpoints.add(p);
	 }
	 
	 for (int i = 0; i < pointsNormalized.length; i++) {
		 if (pointsNormalized[i] < 0.0001) {
			 pointsNormalized[i] = 0.0001;
		 } else if (pointsNormalized[i] > 0.9999) {
			 pointsNormalized[i] = 0.9999;
		 } else {
    		//do nothing
		 }
	 }
    
	 Point2D.Double[] calibrationData = new Point2D.Double[itemCount+1];
	 for (int j = 0; j < itemCount; j+=2) {
		 calibrationData[j] = (new Point2D.Double(pointsNormalized[j],pointsNormalized[itemCount+j]));
		 if(j != itemCount)
			 calibrationData[j+1] = (new Point2D.Double(pointsNormalized[2*itemCount+j],pointsNormalized[3*itemCount+j]));
	 }
	 JFrame calibFrame = frame;
	 CalibrationStatusDisplay calibDisplay = 
			 new CalibrationStatusDisplay(calibFrame,calibrationPoints,calibrationData);
	 
	 calibFrame.add(calibDisplay);
    calibFrame.setUndecorated(false);
    calibFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    calibFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    calibFrame.setMinimumSize(new Dimension(600,300));
    calibFrame.setTitle("Calibration: "+new Date());
    Insets insets = calibFrame.getInsets();
   	int width = calibFrame.getSize().width-(insets.left+insets.right);
   	int height = calibFrame.getSize().height-(insets.top+insets.bottom);
   	calibDisplay.windowDimension = new Dimension(width,height);
    calibFrame.setVisible(true);
    calibFrame.toFront();
    calibDisplay.repaint();
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:63,代码来源:EyeXTracker.java

示例7: displayCalibrationStatus

import javax.swing.JFrame; //导入方法依赖的package包/类
protected void displayCalibrationStatus(JFrame frame) throws Exception {
	 double[] pointsNormalized = jniGetCalibration();
	 
	 if (pointsNormalized == null)
		 throw new IOException("Can't get calibration data!");
	 
	 int zeros = 0;
	 for( double ord: pointsNormalized){
		 if( ord <= 0 || ord > 1) zeros++;
	 }
	 ArrayList<Point2D.Double> points = new ArrayList<Point2D.Double>();
	 ArrayList<Point2D.Double> invalidpoints = new ArrayList<Point2D.Double>();
	//if( zeros > 0 ) throw new IOException("zeros in points: "+zeros+"/"+pointsNormalized.length);
	 
	 int itemCount = pointsNormalized.length/4;

	 for( int i=0; i < itemCount; i++ ){
		 
		points.add(new Point2D.Double(pointsNormalized[i],pointsNormalized[i+itemCount]));
		points.add(new Point2D.Double(pointsNormalized[(2*itemCount)+i],pointsNormalized[i+(itemCount*3)]));
	 }
	 
	 Rectangle2D.Double rect = new Rectangle2D.Double(0.0,0.0,1.0,1.0);
	 
	 for(Point2D.Double p: points){
		 if( !rect.contains(p) ) invalidpoints.add(p);
	 }
	 
	 for (int i = 0; i < pointsNormalized.length; i++) {
		 if (pointsNormalized[i] < 0.0001) {
			 pointsNormalized[i] = 0.0001;
		 } else if (pointsNormalized[i] > 0.9999) {
			 pointsNormalized[i] = 0.9999;
		 } else {
    		//do nothing
		 }
	 }
    
	 Point2D.Double[] calibrationData = new Point2D.Double[itemCount+1];
	 for (int j = 0; j < itemCount; j+=2) {
		 calibrationData[j] = (new Point2D.Double(pointsNormalized[j],pointsNormalized[itemCount+j]));
		 if(j != itemCount)
			 calibrationData[j+1] = (new Point2D.Double(pointsNormalized[2*itemCount+j],pointsNormalized[3*itemCount+j]));
	 }
	 JFrame calibFrame = frame;
	 CalibrationStatusDisplay calibDisplay = 
			 new CalibrationStatusDisplay(calibFrame,calibrationPoints,calibrationData);
	 
	 calibFrame.add(calibDisplay);
    calibFrame.setUndecorated(false);
    calibFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    calibFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    calibFrame.setMinimumSize(new Dimension(600,300));
    calibFrame.setTitle("Calibration: "+new Date());
    Insets insets = calibFrame.getInsets();
    int width = calibFrame.getSize().width-(insets.left+insets.right);
    int height = calibFrame.getSize().height-(insets.top+insets.bottom);
  		calibDisplay.windowDimension = new Dimension(width,height);
    calibFrame.setVisible(true);
    calibDisplay.repaint();
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:62,代码来源:TobiiTracker.java


注:本文中的javax.swing.JFrame.getSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。