本文整理了Java中javax.swing.JFrame.getInsets()
方法的一些代码示例,展示了JFrame.getInsets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getInsets()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getInsets
暂无
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame("title");
frame.setVisible(true);
System.out.println(frame.getInsets());
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
public BambooVideoWall()
{
jFrame = new JFrame(BambooVideoWall.class.getSimpleName());
double adjustedVideoHeight = PLAYBACKER_HEIGHT / (double) NUMBER_OF_ROWS_OF_VIDEO;
double adjustedVideoWidth = adjustedVideoHeight * VIDEO_WIDTH / VIDEO_HEIGHT;
double width = adjustedVideoWidth * NUMBER_OF_COLUMNS_OF_VIDEO;
videoPlayerGrid = new VideoPlayerGrid(NUMBER_OF_ROWS_OF_VIDEO, NUMBER_OF_COLUMNS_OF_VIDEO);
jFrame.getContentPane().add(videoPlayerGrid);
jFrame.setSize((int) width, (int) PLAYBACKER_HEIGHT + jFrame.getInsets().top);
jFrame.setIconImage(new ImageIcon(ClassLoader.getSystemResource("us/ihmc/tools/icons/running-man-32x32.png").getPath()).getImage());
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setVisible(true);
}
代码示例来源:origin: klamonte/jexer
/**
* If a border has been set on this component, returns the border's
* insets; otherwise calls super.getInsets.
*
* @return the value of the insets property
*/
public Insets getInsets() {
Insets swingInsets = null;
if (frame != null) {
swingInsets = frame.getInsets();
} else {
swingInsets = component.getInsets();
}
Insets result = new Insets(swingInsets.top + adjustInsets.top,
swingInsets.left + adjustInsets.left,
swingInsets.bottom + adjustInsets.bottom,
swingInsets.right + adjustInsets.right);
return result;
}
代码示例来源:origin: com.github.fracpete/princeton-java-stdlib
public static void fullscreen () {
frame.setResizable(true);
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
int w = frame.getSize().width;
int h = frame.getSize().height;
//int w = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
//int h = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
int borderY = frame.getInsets().top + frame.getInsets().bottom;
int borderX = frame.getInsets().left + frame.getInsets().right;
setCanvasSize(w - borderX, h - borderY - menuBar.getHeight(), true);
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
}
代码示例来源:origin: com.googlecode.princeton-java-introduction/stdlib
public static void fullscreen () {
frame.setResizable(true);
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
int w = frame.getSize().width;
int h = frame.getSize().height;
//int w = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
//int h = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
int borderY = frame.getInsets().top + frame.getInsets().bottom;
int borderX = frame.getInsets().left + frame.getInsets().right;
setCanvasSize(w - borderX, h - borderY - menuBar.getHeight(), true);
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
}
代码示例来源:origin: gurkenlabs/litiengine
private void setResolution(Dimension dim) {
Dimension insetAwareDimension = new Dimension(dim.width + this.hostControl.getInsets().left + this.hostControl.getInsets().right, dim.height + this.hostControl.getInsets().top + this.hostControl.getInsets().bottom);
if (Game.config().graphics().enableResolutionScaling()) {
this.resolutionScale = (float) (dim.getWidth() / Resolution.Ratio16x9.RES_1920x1080.getWidth());
Game.graphics().setBaseRenderScale(Game.graphics().getBaseRenderScale() * this.resolutionScale);
}
this.hostControl.setSize(insetAwareDimension);
}
代码示例来源:origin: klamonte/jexer
/**
* Resize the component to match the font dimensions.
*
* @param width the new width in pixels
* @param height the new height in pixels
*/
public void setDimensions(final int width, final int height) {
// Figure out the thickness of borders and use that to set the final
// size.
if (frame != null) {
Insets insets = frame.getInsets();
frame.setSize(width + insets.left + insets.right,
height + insets.top + insets.bottom);
} else {
Insets insets = component.getInsets();
component.setSize(width + insets.left + insets.right,
height + insets.top + insets.bottom);
}
}
代码示例来源:origin: stackoverflow.com
public class SwingExample implements Runnable {
@Override
public void run() {
// Create the window
final JFrame f = new JFrame("Hello, World!");
SwingExample.centerWindow(f);
f.setPreferredSize(new Dimension(500, 250));
f.setMaximumSize(new Dimension(10000, 200));
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void centerWindow(JFrame frame) {
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.left + insets.right + 500, insets.top + insets.bottom + 250));
frame.setVisible(true);
frame.setResizable(false);
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
int x = (int) ((dimension.getWidth() - frame.getWidth()) / 2);
int y = (int) ((dimension.getHeight() - frame.getHeight()) / 2);
frame.setLocation(x, y);
}
}
代码示例来源:origin: stackoverflow.com
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new GridLayout(1,2));
Insets inset = frame.getInsets();
代码示例来源:origin: org.fuin/utils4swing
final Insets insets = frame.getInsets();
代码示例来源:origin: stackoverflow.com
frame.add(b3);
Insets insets = frame.getInsets();
Dimension size = b1.getPreferredSize();
代码示例来源:origin: sc.fiji/Interactive_3D_Surface_Plot
public void componentResized(ComponentEvent event) {
Insets insetsFrame = frame.getInsets();
windowWidth = frame.getWidth() - insetsFrame.left - insetsFrame.right - settingsPanel2.getWidth();
windowHeight = frame.getHeight() - insetsFrame.bottom - insetsFrame.top - settingsPanel1.getHeight();
if (windowHeight>0 && windowWidth > 0)
resizeImagePanel(windowWidth, windowHeight);
frame.pack();
}
});
代码示例来源:origin: ribomation/DroidAtScreen1
@Override
public Dimension getPreferredSize() {
Dimension frame = super.getPreferredSize();
Insets fb = super.getInsets();
Dimension screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getSize();
Dimension canvasSize = canvas.getPreferredSize();
代码示例来源:origin: com.eas.platypus/platypus-js-forms
showingForms.put(formKey, this);
frame.setVisible(true);
Insets decorInsets = frame.getInsets();
windowDecorSize = new Dimension(decorInsets.left + decorInsets.right, decorInsets.top + decorInsets.bottom);
if (formSize != null) {
代码示例来源:origin: sc.fiji/Interactive_3D_Surface_Plot
int screenHeight = screenSize.height;
Insets ins = frame.getInsets();
xloc = (screenWidth-windowWidth-ins.left-ins.right - 70)/2;
yloc = (screenHeight-windowHeight-ins.bottom-ins.top - 75)/2;
内容来源于网络,如有侵权,请联系作者删除!