本文整理了Java中javax.swing.JFrame.getHeight()
方法的一些代码示例,展示了JFrame.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getHeight()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getHeight
暂无
代码示例来源:origin: marytts/marytts
/**
* Determine the next free location for a dependent and put the window there.
*
* @param jf
* jf
*/
protected void setDependentWindowLocation(JFrame jf) {
if (nextDependentWindowX == 0 && nextDependentWindowY == 0) {
// first dependent window:
nextDependentWindowX = getTopLevelAncestor().getWidth();
}
jf.setLocationRelativeTo(this);
jf.setLocation(nextDependentWindowX, nextDependentWindowY);
nextDependentWindowY += jf.getHeight();
}
代码示例来源:origin: marytts/marytts
/**
* Determine the next free location for a dependent and put the window there.
*
* @param jf
* jf
*/
protected void setDependentWindowLocation(JFrame jf) {
if (nextDependentWindowX == 0 && nextDependentWindowY == 0) {
// first dependent window:
nextDependentWindowX = getTopLevelAncestor().getWidth();
}
jf.setLocationRelativeTo(this);
jf.setLocation(nextDependentWindowX, nextDependentWindowY);
nextDependentWindowY += jf.getHeight();
}
代码示例来源:origin: pmd/pmd
@Override
public void componentResized(ComponentEvent e) {
JFrame tmp = (JFrame) e.getSource();
if (tmp.getWidth() < 600 || tmp.getHeight() < 700) {
tmp.setSize(600, 700);
}
}
});
代码示例来源:origin: pmd/pmd
private void createRuleXML() {
CreateXMLRulePanel rulePanel = new CreateXMLRulePanel(xpathQueryArea, codeEditorPane);
JFrame xmlframe = new JFrame("Create XML Rule");
xmlframe.setContentPane(rulePanel);
xmlframe.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
xmlframe.setSize(new Dimension(600, 700));
xmlframe.addComponentListener(new java.awt.event.ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
JFrame tmp = (JFrame) e.getSource();
if (tmp.getWidth() < 600 || tmp.getHeight() < 700) {
tmp.setSize(600, 700);
}
}
});
int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
xmlframe.pack();
xmlframe.setLocation((screenWidth - xmlframe.getWidth()) / 2, (screenHeight - xmlframe.getHeight()) / 2);
xmlframe.setVisible(true);
}
代码示例来源:origin: pmd/pmd
frame.setLocation((screenWidth - frame.getWidth()) / 2, (screenHeight - frame.getHeight()) / 2);
frame.setVisible(true);
int horozontalMiddleLocation = controlSplitPane.getMaximumDividerLocation() * 3 / 5;
代码示例来源:origin: RaiMan/SikuliX2
private int whichSide(int x, int y) {
if (isMiddle(box.getWidth(), x) && isLow(box.getHeight(), y)) return TOP;
if (isMiddle(box.getHeight(), y) && isLow(box.getWidth(), x)) return LEFT;
if (isMiddle(box.getWidth(), x) && isHigh(box.getHeight(), y)) return BOTTOM;
if (isMiddle(box.getHeight(), y) && isHigh(box.getWidth(), x)) return RIGHT;
return TOP;
}
代码示例来源:origin: RaiMan/SikuliX2
public Element whereShowing() {
return new Element(frame.getLocation().x, frame.getLocation().y, frame.getWidth(), frame.getHeight());
}
//</editor-fold>
代码示例来源:origin: klamonte/jexer
/**
* Returns the current height of this component.
*
* @return the current height of this component
*/
public int getHeight() {
if (frame != null) {
return frame.getHeight();
} else {
return component.getHeight();
}
}
代码示例来源:origin: stackoverflow.com
public Surface(JFrame frame) {
this.frame = frame;
frame.setContentPane(this); // add this line
rf = new RandomFrame(frame.getWidth(), frame.getHeight());
}
代码示例来源:origin: leMaik/swing-material
/**
* Alternative method to {@link JFrame#getHeight()}. Use it to get the
* height of this window in the desktop, excluding any margins present
* because of the shadow.
* @return the current height of this window
*/
public int getWindowHeight() {
return super.getHeight() - (!isShadowed() ?
0:MaterialShadow.OFFSET_TOP+MaterialShadow.OFFSET_BOTTOM);
}
代码示例来源:origin: stackoverflow.com
JFrame f = frameA; // or frameB
BufferedImage bi = new BufferedImage(f.getWidth(), f.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g = bi.createGraphics();
f.paint(g);
g.dispose();
lab.setIcon(new IconImage(bi));
代码示例来源:origin: JetBrains/jediterm
@Override
public void run() {
Dimension d = myTerminal.getPreferredSize();
d.width += frame.getWidth() - frame.getContentPane().getWidth();
d.height += frame.getHeight() - frame.getContentPane().getHeight();
frame.setSize(d);
}
});
代码示例来源:origin: cpesch/RouteConverter
private void enableActions() {
ActionManager actionManager = getContext().getActionManager();
actionManager.enable("maximize-map", location < frame.getHeight() - 10);
actionManager.enable("maximize-positionlist", location < frame.getHeight() - 10);
actionManager.enable("show-profile", location > frame.getHeight() - 80);
}
}
代码示例来源:origin: stackoverflow.com
public static void moveToCenterScreen(JFrame frame) {
Toolkit kit = frame.getToolkit();
GraphicsDevice[] gs = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
Insets in = kit.getScreenInsets(gs[0].getDefaultConfiguration());
Dimension d = kit.getScreenSize();
int max_width = (d.width - in.left - in.right);
int max_height = (d.height - in.top - in.bottom);
frame.setLocation((int) (max_width - frame.getWidth()) / 2, (int) (max_height - frame.getHeight() ) / 2);
}
代码示例来源:origin: gurkenlabs/litiengine
@Override
public void componentResized(ComponentEvent e) {
userPreferences.setWidth(window.getWidth());
userPreferences.setHeight(window.getHeight());
}
});
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-vmd-game
public static void center(JFrame frame) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Point center = ge.getCenterPoint();
Rectangle bounds = ge.getMaximumWindowBounds();
int w = Math.min(frame.getWidth(), bounds.width);
int h = Math.min(frame.getHeight(), bounds.height);
int x = center.x - w/2, y = center.y - h/2;
frame.setBounds(x, y, w, h);
if (w == bounds.width && h == bounds.height)
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.validate();
}
代码示例来源:origin: AliView/AliView
public void show(){
dialog.setPreferredSize(this.preferredSize);
dialog.pack();
// center
if(parentFrame != null){
int newX = parentFrame.getX() + parentFrame.getWidth()/2 - dialog.getPreferredSize().width/2;
int newY = parentFrame.getY() + parentFrame.getHeight()/2 - dialog.getPreferredSize().height/2;
dialog.setLocation(newX, newY);
}
dialog.setVisible(true);
}
代码示例来源:origin: google/sagetv
public void windowClosing(java.awt.event.WindowEvent evt)
{
int numCols = tracerTable.getColumnCount();
for (int i = 0; i < numCols; i++)
uiMgr.putInt("studio/tracer_col_width/" + i, tracerTable.getColumnModel().getColumn(i).getWidth());
uiMgr.putInt("studio/tracer_win_pos_x", tracerFrame.getX());
uiMgr.putInt("studio/tracer_win_pos_y", tracerFrame.getY());
uiMgr.putInt("studio/tracer_win_pos_w", tracerFrame.getWidth());
uiMgr.putInt("studio/tracer_win_pos_h", tracerFrame.getHeight());
tracerFrame.dispose();
}
});
代码示例来源:origin: google/sagetv
public void windowClosing(java.awt.event.WindowEvent evt)
{
// Ensure the debugger isn't paused/stepping
resumeExecution();
uiMgr.putInt("studio_win_pos_x", myFrame.getX());
uiMgr.putInt("studio_win_pos_y", myFrame.getY());
uiMgr.putInt("studio_win_pos_w", myFrame.getWidth());
uiMgr.putInt("studio_win_pos_h", myFrame.getHeight());
myFrame.dispose();
}
});
代码示例来源:origin: eu.mihosoft.vrl/vrl
/**
* @param parentFrame the parentFrame to set
*/
public void centerDialog(JFrame parentFrame) {
this.setLocation(
parentFrame.getLocation().x +
parentFrame.getWidth() / 2 - this.getWidth() / 2,
parentFrame.getLocation().y +
parentFrame.getHeight() / 2 - this.getHeight() / 2);
}
}
内容来源于网络,如有侵权,请联系作者删除!