本文整理了Java中javax.swing.JWindow.getHeight()
方法的一些代码示例,展示了JWindow.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JWindow.getHeight()
方法的具体详情如下:
包路径:javax.swing.JWindow
类名称:JWindow
方法名:getHeight
暂无
代码示例来源:origin: chatty/chatty
public int getHeight() {
return window.getHeight();
}
代码示例来源:origin: google/sagetv
private static void splash()
{
splashWindow = new javax.swing.JWindow();
splashWindow.getContentPane().setLayout(new java.awt.BorderLayout());
java.awt.Image theImage = java.awt.Toolkit.getDefaultToolkit().createImage(MiniClient.class.getClassLoader().getResource("images/splash.gif"));
GFXCMD2.ensureImageIsLoaded(theImage);
javax.swing.JLabel splashImage = new javax.swing.JLabel(new javax.swing.ImageIcon(theImage));
splashWindow.getContentPane().add(splashImage, "Center");
java.awt.Dimension scrSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
splashWindow.pack();
java.awt.Point center = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
splashWindow.setLocation(center.x - splashWindow.getWidth()/2, center.y - splashWindow.getHeight()/2);
splashWindow.setVisible(true);
}
代码示例来源:origin: google/sagetv
public void run()
{
Rectangle screenRect = getScreenArea0();
poppy.setLocation(Math.min(screenRect.x + screenRect.width - poppy.getWidth(),
Math.max(mouseX, screenRect.x)), Math.min(screenRect.y + screenRect.height - poppy.getHeight(),
Math.max(mouseY, screenRect.y)));
poppy.setVisible(true);
poppy.toFront();
poppy.repaint();
}
});
代码示例来源:origin: net.java.dev.laf-widget/laf-widget
/**
* Synchronizes the preview window.
*
* @param toShow
* Indication whether the preview window is shown.
*/
private void syncPreviewWindow(boolean toShow) {
if (toShow) {
int x = jcomp.getLocationOnScreen().x;
int y = jcomp.getLocationOnScreen().y;
this.previewWindow.setLocation(x, y
- this.previewWindow.getHeight());
}
}
代码示例来源:origin: stackoverflow.com
int taskBar = scnMax.bottom;
int x = screenSize.width - newWin.getWidth();
int y = screenSize.height - taskBar - newWin.getHeight();
newWin.setLocation(x,y);
newWin.setVisible(true);
代码示例来源:origin: GoldenGnu/jeveassets
public void show(final String text, final LockWorker lockWorker) {
jLabel.setText(text);
jWindow.pack();
//Get the parent size
Dimension parentSize = parent.getSize();
//Calculate the frame location
int x = (parentSize.width - jWindow.getWidth()) / 2;
int y = (parentSize.height - jWindow.getHeight()) / 2;
//Set the new frame location
jWindow.setLocation(x, y);
jWindow.setLocationRelativeTo(parent);
parent.setEnabled(false);
jProgress.setIndeterminate(false);
jProgress.setIndeterminate(true);
jWindow.setVisible(true); //Does not block!
Wait wait = new Wait(lockWorker);
wait.execute();
}
代码示例来源:origin: undera/jmeter-plugins
private synchronized void showHoverInfo() {
if (isPreview
|| chartRect.width == 0 || chartRect.height == 0
|| xHoverInfo == -1 || yHoverInfo == -1) {
return;
}
long realX = minXVal + (maxXVal - minXVal) * (xHoverInfo - chartRect.x) / chartRect.width;
double realY = minYVal + (maxYVal - minYVal) * (chartRect.height - yHoverInfo + chartRect.y) / chartRect.height;
xAxisLabelRenderer.setValue(realX);
yAxisLabelRenderer.setValue(realY);
String hoverInfo = "(" + xAxisLabelRenderer.getText() + " ; " + yAxisLabelRenderer.getText() + ")";
hoverLabel.setText(hoverInfo);
int labelWidth = hoverLabel.getPreferredSize().width + 5;
int labelHeight = hoverLabel.getPreferredSize().height;
if (hoverWindow.getWidth() < labelWidth || hoverWindow.getHeight() < labelHeight) {
hoverWindow.setSize(labelWidth, labelHeight);
}
Point mousePos = MouseInfo.getPointerInfo().getLocation();
int hoverWindowX = mousePos.x + hoverGap;
int hoverWindowY = mousePos.y + hoverGap;
//we move window only if far from pointer to limit cpu
double deltaX = Math.abs(hoverWindow.getLocation().getX() - hoverWindowX);
double deltaY = Math.abs(hoverWindow.getLocation().getY() - hoverWindowY);
if (forceHoverPosition || deltaX >= hoverGap || deltaY >= hoverGap) {
//prevent out of screen
int correctedX = Math.min(hoverWindowX, Toolkit.getDefaultToolkit().getScreenSize().width - hoverWindow.getSize().width);
hoverWindow.setLocation(correctedX, hoverWindowY);
forceHoverPosition = false;
}
}
代码示例来源:origin: fcrepo3/fcrepo
splashScreen.pack();
int xSize = splashScreen.getWidth();
int ySize = splashScreen.getHeight();
Dimension screenSize = getToolkit().getScreenSize();
int xLoc = screenSize.width / 2 - xSize / 2;
代码示例来源:origin: kg.apc/jmeter-plugins-cmn-jmeter
private synchronized void showHoverInfo() {
if (isPreview
|| chartRect.width == 0 || chartRect.height == 0
|| xHoverInfo == -1 || yHoverInfo == -1) {
return;
}
long realX = minXVal + (maxXVal - minXVal) * (xHoverInfo - chartRect.x) / chartRect.width;
double realY = minYVal + (maxYVal - minYVal) * (chartRect.height - yHoverInfo + chartRect.y) / chartRect.height;
xAxisLabelRenderer.setValue(realX);
yAxisLabelRenderer.setValue(realY);
String hoverInfo = "(" + xAxisLabelRenderer.getText() + " ; " + yAxisLabelRenderer.getText() + ")";
hoverLabel.setText(hoverInfo);
int labelWidth = hoverLabel.getPreferredSize().width + 5;
int labelHeight = hoverLabel.getPreferredSize().height;
if (hoverWindow.getWidth() < labelWidth || hoverWindow.getHeight() < labelHeight) {
hoverWindow.setSize(labelWidth, labelHeight);
}
Point mousePos = MouseInfo.getPointerInfo().getLocation();
int hoverWindowX = mousePos.x + hoverGap;
int hoverWindowY = mousePos.y + hoverGap;
//we move window only if far from pointer to limit cpu
double deltaX = Math.abs(hoverWindow.getLocation().getX() - hoverWindowX);
double deltaY = Math.abs(hoverWindow.getLocation().getY() - hoverWindowY);
if (forceHoverPosition || deltaX >= hoverGap || deltaY >= hoverGap) {
//prevent out of screen
int correctedX = Math.min(hoverWindowX, Toolkit.getDefaultToolkit().getScreenSize().width - hoverWindow.getSize().width);
hoverWindow.setLocation(correctedX, hoverWindowY);
forceHoverPosition = false;
}
}
代码示例来源:origin: otros-systems/otroslogviewer
private void setSuggestionWindowLocation() {
if (textComponent.isShowing()){
suggestionWindow.pack();
if (textComponent instanceof JTextField) {
int width = Math.max(textComponent.getWidth(), suggestionWindow.getWidth());
int screenHeight = suggestionWindow.getGraphicsConfiguration().getDevice().getDisplayMode().getHeight();
suggestionWindow.setSize(width, (int) Math.min(suggestionWindow.getHeight(), screenHeight / 2));
int x = (int) textComponent.getLocationOnScreen().getX();
int y = (int) (textComponent.getLocationOnScreen().getY() + textComponent.getHeight());
suggestionWindow.setLocation(x, y);
} else {
try {
final int caretPosition = Math.min(textComponent.getText().length(), textComponent.getCaretPosition());
final Rectangle rectangle = textComponent.modelToView(caretPosition);
final Point p = new Point(rectangle.x, rectangle.y + rectangle.height);
SwingUtilities.convertPointToScreen(p, textComponent);
suggestionWindow.setLocation(p.x, p.y);
} catch (BadLocationException e) {
e.printStackTrace();
}
}
}
}
代码示例来源:origin: com.fifesoft/autocomplete
/**
* Sets the location of this tool tip relative to the given rectangle.
*
* @param r The visual position of the caret (in screen coordinates).
*/
public void setLocationRelativeTo(Rectangle r) {
// Multi-monitor support - make sure the completion window (and
// description window, if applicable) both fit in the same window in
// a multi-monitor environment. To do this, we decide which monitor
// the rectangle "r" is in, and use that one (just pick top-left corner
// as the defining point).
Rectangle screenBounds = Util.getScreenBoundsForPoint(r.x, r.y);
//Dimension screenSize = tooltip.getToolkit().getScreenSize();
// Try putting our stuff "above" the caret first.
int y = r.y - 5 - tooltip.getHeight();
if (y<0) {
y = r.y + r.height + 5;
}
// Get x-coordinate of completions. Try to align left edge with the
// caret first.
int x = r.x;
if (x<screenBounds.x) {
x = screenBounds.x;
}
else if (x+tooltip.getWidth()>screenBounds.x+screenBounds.width) { // completions don't fit
x = screenBounds.x + screenBounds.width - tooltip.getWidth();
}
tooltip.setLocation(x, y);
}
代码示例来源:origin: stackoverflow.com
y = (bounds.y + bounds.height) - popup.getHeight();
代码示例来源:origin: com.eas.platypus/platypus-js-calendar-widget
if (y + 30 + _calendarWindow.getHeight() > screenSize.height) {
y = (int) location.getY() - _calendarWindow.getHeight();
_calendarWindow.getHeight());
_calendarWindow.setVisible(true);
代码示例来源:origin: chatty/chatty
int prevHeight = infoWindow.getHeight();
int prevWidth = infoWindow.getWidth();
if (prevHeight != infoWindow.getHeight()
|| prevWidth != infoWindow.getWidth()) {
newPosition = true;
location.x = 8;
location.y -= infoWindow.getHeight();
SwingUtilities.convertPointToScreen(location, textField);
infoWindow.setLocation(location);
代码示例来源:origin: net.java.dev.laf-widget/laf-widget
currTabPreviewInfo.tabIndexToPreview = this.currTabIndex;
currTabPreviewInfo.setPreviewWidth(this.currTabWindow.getWidth() - 4);
currTabPreviewInfo.setPreviewHeight(this.currTabWindow.getHeight() - 20);
currTabPreviewInfo.previewCallback = new TabPagerPreviewCallback(
this.currTabWindow, this.currTabbedPane, this.currTabIndex);
prevTabPreviewInfo.tabIndexToPreview = this.prevTabIndex;
prevTabPreviewInfo.setPreviewWidth(this.prevTabWindow.getWidth() - 4);
prevTabPreviewInfo.setPreviewHeight(this.prevTabWindow.getHeight() - 20);
prevTabPreviewInfo.previewCallback = new TabPagerPreviewCallback(
this.prevTabWindow, this.currTabbedPane, this.prevTabIndex);
nextTabPreviewInfo.tabIndexToPreview = this.nextTabIndex;
nextTabPreviewInfo.setPreviewWidth(this.nextTabWindow.getWidth() - 4);
nextTabPreviewInfo.setPreviewHeight(this.nextTabWindow.getHeight() - 20);
nextTabPreviewInfo.previewCallback = new TabPagerPreviewCallback(
this.nextTabWindow, this.currTabbedPane, this.nextTabIndex);
内容来源于网络,如有侵权,请联系作者删除!