本文整理汇总了Java中javax.swing.JFrame.getInsets方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.getInsets方法的具体用法?Java JFrame.getInsets怎么用?Java JFrame.getInsets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.getInsets方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: 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();
}
示例3: 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();
}