本文整理了Java中javax.swing.JWindow.setLocation()
方法的一些代码示例,展示了JWindow.setLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JWindow.setLocation()
方法的具体详情如下:
包路径:javax.swing.JWindow
类名称:JWindow
方法名:setLocation
暂无
代码示例来源:origin: com.github.lgooddatepicker/LGoodDatePicker
/**
* setLocation, This changes the location of the popup window.
*/
public void setLocation(int popupX, int popupY) {
displayWindow.setLocation(popupX, popupY);
}
代码示例来源:origin: chatty/chatty
public void setLocation(Point location) {
window.setLocation(location);
}
代码示例来源:origin: chatty/chatty
public void moveVertical(int offset) {
Point location = window.getLocation();
location.y += offset;
window.setLocation(location);
}
代码示例来源:origin: Baralga/baralga
@Override
public void mouseDragged(MouseEvent e) {
// get location of Window
int thisX = parent.getLocation().x;
int thisY = parent.getLocation().y;
// Determine how much the mouse moved since the initial click
int xMoved = (thisX + e.getX()) - (thisX + initialClick.x);
int yMoved = (thisY + e.getY()) - (thisY + initialClick.y);
// Move window to this position
int X = thisX + xMoved;
int Y = thisY + yMoved;
parent.setLocation(X, Y);
}
});
代码示例来源: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: stackoverflow.com
JFrame frame = new JFrame("Test");
frame.setLocation(100, 100);
frame.setSize(500, 500);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
// 'Invisible' fake component for positioning
JWindow c = new JWindow();
c.setSize(0, 0);
c.setVisible(true);
Point location = frame.getLocation();
location.translate(200, 100);
c.setLocation(location);
JOptionPane.showInputDialog(c,"Foo");
代码示例来源:origin: igniterealtime/Spark
public void setWindowLocation(int x, int y) {
Point mainWindowLocation = SparkManager.getMainWindow().getLocationOnScreen();
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int actualX = x;
int actualY = y - 5;
if ((int) screenSize.getWidth() - getPreferredSize().getWidth() < x) {
actualX = (int) mainWindowLocation.getX() - (int) getPreferredSize().getWidth();
}
// keep this away from bottom edge
if (actualY + getHeight() > screenSize.height - 64) {
actualY -= actualY + getHeight() - screenSize.height + 64;
}
window.setLocation(actualX, actualY);
}
代码示例来源:origin: net.sf.ingenias/editor
public void run() {
JLabel jl = new JLabel(message);
jl.setFont(new java.awt.Font("Dialog", 1, 36));
jw.getContentPane().add(jl);
jw.pack();
jw.setLocation(getCenter(jw.getSize(),resources.getMainFrame()));
jw.setVisible(true);
}
});
代码示例来源:origin: org.gephi/ui-components
private void resizePopup() {
popupWindow.pack();
Point point = new Point(0, 0);
SwingUtilities.convertPointToScreen(point, ancestor);
Dimension dim = popupWindow.getSize();
Rectangle usableRect = Utilities.getUsableScreenBounds();
int sepShift = 0;
Point loc = new Point(point.x + ancestor.getSize().width - dim.width - sepShift - 5 * 2, point.y - dim.height - 5);
if (!usableRect.contains(loc)) {
loc = new Point(loc.x, point.y + 5 + ancestor.getSize().height);
}
popupWindow.setLocation(loc);
}
代码示例来源: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: de.uni_leipzig.asv.toolbox/toolbox-utils
/**
* Show the splash screen while the rest of the program loads
*/
public void createSplashScreen() {
JLabel splashLabel = new JLabel(createImageIcon("Splash3.jpg"));
this.splashScreen = new JWindow();
this.splashScreen.getContentPane().add(splashLabel);
this.splashScreen.pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.splashScreen.setLocation(screenSize.width / 2
- this.splashScreen.getSize().width / 2, screenSize.height / 2
- this.splashScreen.getSize().height / 2);
}
代码示例来源:origin: PsiLupan/MakeLobbiesGreatAgain
@Override
public void mouseDragged(MouseEvent e) {
if (frameMove)
frame.setLocation(e.getXOnScreen() - (getPreferredSize().width / 2), e.getYOnScreen() - 6);
}
代码示例来源:origin: stackoverflow.com
public static void main(String args[]) {
JWindow w = new JWindow();
w.add(new JLabel("Testing a Window!!!!!"));
w.setLocation(300, 300);
w.pack();
w.setVisible(true);
}
代码示例来源: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
private Window initFullScreenWindow() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gds = ge.getScreenDevices();
GraphicsDevice gd = gds[1];
JWindow window = new JWindow(gd.getDefaultConfiguration());
window.setContentPane(getJFSPanel());
window.setLocation(1280, 0);
window.setSize(gd.getDisplayMode().getWidth(), gd.getDisplayMode().getHeight());
window.setAlwaysOnTop(true);
//gd.setFullScreenWindow(window);
return window;
}
代码示例来源:origin: cpesch/RouteConverter
private void display(Point locationOnScreen, int mouseX, int mouseY) {
LatLong latLong = new MapViewProjection(mapView).fromPixels(mouseX, mouseY);
label.setText(mapViewCallback.createCoordinates(latLong.longitude, latLong.latitude));
window.pack();
window.setLocation(locationOnScreen.x + 16, locationOnScreen.y + 15);
show();
}
代码示例来源:origin: GoldenGnu/jeveassets
public void show() {
Point point = jButton.getLocationOnScreen();
jWindow.pack();
jWindow.setLocation(point.x + 2, point.y + jButton.getHeight() - 1);
jWindow.setVisible(true);
}
代码示例来源:origin: cpesch/RouteConverter
private void show(String message) {
label.setText(message);
JFrame frame = getFrame();
if(frame == null)
return;
Point locationOnScreen = frame.getLocationOnScreen();
Dimension frameSize = getFrame().getSize();
window.pack();
window.setLocation(locationOnScreen.x + frameSize.width - label.getWidth() - 25,
locationOnScreen.y + frameSize.height - label.getHeight() - 25);
window.setVisible(true);
}
代码示例来源:origin: edu.stanford.protege/protege-editor-owl
private void showResults() {
JWindow window = getWindow();
Point pt = new Point(0, 0);
SwingUtilities.convertPointToScreen(pt, this);
window.setLocation(pt.x + (getWidth() - WINDOW_WIDTH), pt.y + getHeight() + 2);
Container parent = window.getParent();
int height = 400;
if (parent != null) {
height = (parent.getHeight() * 3) / 4;
}
window.setSize(WINDOW_WIDTH, height);
searchPanel.setSearchString(getText().trim());
window.setVisible(true);
window.validate();
}
代码示例来源:origin: protegeproject/protege
private void showResults() {
selectEntityAction.setEnabled(true);
JWindow window = getWindow();
Point pt = new Point(0, 0);
SwingUtilities.convertPointToScreen(pt, this);
window.setLocation(pt.x + (getWidth() - WINDOW_WIDTH) / 2, pt.y + getHeight() + 2);
Container parent = window.getParent();
int height = 400;
if (parent != null) {
height = (parent.getHeight() * 3) / 4;
}
window.setSize(WINDOW_WIDTH, height);
searchPanel.setSearchString(getText().trim());
window.setVisible(true);
window.validate();
}
内容来源于网络,如有侵权,请联系作者删除!