本文整理了Java中javax.swing.JFrame.getGraphicsConfiguration()
方法的一些代码示例,展示了JFrame.getGraphicsConfiguration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getGraphicsConfiguration()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getGraphicsConfiguration
暂无
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame();
// ...
GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
代码示例来源:origin: sc.fiji/TrakEM2_
CloseIcon() {
img = frame.getGraphicsConfiguration().createCompatibleImage(20, 16, Transparency.TRANSLUCENT);
Graphics2D g = img.createGraphics();
g.setColor(Color.black);
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.drawOval(4 + 2, 2, 12, 12);
g.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
g.drawLine(4 + 4, 4, 4 + 11, 12);
g.drawLine(4 + 4, 12, 4 + 11, 4);
icon = new ImageIcon(img);
}
代码示例来源:origin: org.cytoscape.distribution/karaf-launcher
private static void showSplashPanel() throws IOException {
File karafBase = new File(System.getProperty("karaf.base"));
BufferedImage background = ImageIO.read(new File(karafBase, "CytoscapeSplashScreen.png"));
splashPanel = new SplashPanel(background);
final JFrame frame = new JFrame();
frame.add(splashPanel);
frame.setUndecorated(true);
int width = background.getWidth();
int height = background.getHeight();
frame.setSize(width, height);
// Center the frame in the current screen.
Rectangle bounds = frame.getGraphicsConfiguration().getBounds();
frame.setLocation((bounds.width - width) / 2, (bounds.height - height) / 2);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
frame.setVisible(true);
}
});
}
代码示例来源:origin: org.boofcv/boofcv-swing
/**
* Creates a window showing the specified image.
*/
public static ImagePanel showWindow(BufferedImage img, String title, boolean closeOnExit ) {
JFrame frame = new JFrame(title);
ImagePanel panel = new ImagePanel(img);
panel.setScaling(ScaleOptions.DOWN);
// If the window will be too large to be displayed on the monitor set the bounds to something that can be
// shown. The default behavior will just change one axis leaving it to have an awkward appearance
Rectangle monitorBounds = frame.getGraphicsConfiguration().getBounds();
if( monitorBounds.width < img.getWidth() || monitorBounds.height < img.getHeight()) {
double scale = Math.min(monitorBounds.width/(double)img.getWidth(),monitorBounds.height/(double)img.getHeight());
int width = (int)(scale*img.getWidth());
int height = (int)(scale*img.getHeight());
panel.setPreferredSize(new Dimension(width,height));
}
frame.add(panel, BorderLayout.CENTER);
frame.pack();
frame.setLocationByPlatform(true);
frame.setVisible(true);
if( closeOnExit )
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
return panel;
}
代码示例来源:origin: javax.help/javahelp
/**
* Requests the presentation be located at a given position.
*/
public void setLocation(Point p) {
debug("setLocation");
location = p;
if (jhelp != null) {
if (modallyActivated) {
if (dialog != null) {
GraphicsConfiguration gc =
dialog.getGraphicsConfiguration();
Rectangle gcBounds = gc.getBounds();
Point loc = new Point (gcBounds.x + p.x,
gcBounds.y + p.y);
dialog.setLocation(loc);
}
} else {
if (frame != null) {
GraphicsConfiguration gc =
frame.getGraphicsConfiguration();
Rectangle gcBounds = gc.getBounds();
Point loc = new Point (gcBounds.x + p.x,
gcBounds.y + p.y);
frame.setLocation(loc);
}
}
}
}
代码示例来源:origin: cpesch/RouteConverter
private void putPreferencesLocation() {
int x = frame.getLocation().x;
int y = frame.getLocation().y;
if(getPreferencesX() == x && getPreferencesY() == y)
return;
preferences.putInt(X_PREFERENCE, x);
preferences.putInt(Y_PREFERENCE, y);
log.info("Storing frame location as " + frame.getLocation());
String deviceId = frame.getGraphicsConfiguration().getDevice().getIDstring();
preferences.put(DEVICE_PREFERENCE, deviceId);
log.info("Storing graphics device as " + deviceId);
}
代码示例来源:origin: khuxtable/seaglass
/**
* Maximize/Restore the window.
*
* @param maximize iconify {@code true} if we are to maximize the window,
* {@code false} if we are to restore the window.
*/
private void setParentMaximum(boolean maximize) {
if (rootParent instanceof JFrame) {
JFrame frame = (JFrame) rootParent;
int state = frame.getExtendedState();
if (maximize) {
GraphicsConfiguration gc = frame.getGraphicsConfiguration();
Insets i = Toolkit.getDefaultToolkit().getScreenInsets(gc);
Rectangle r = gc.getBounds();
r.x = 0;
r.y = 0;
r.width -= i.left + i.right;
r.height -= i.top + i.bottom;
frame.setMaximizedBounds(r);
}
frame.setExtendedState(maximize ? state | Frame.MAXIMIZED_BOTH : state & ~Frame.MAXIMIZED_BOTH);
}
}
代码示例来源:origin: net.sf.sf3jswing/kernel-core
jf.setUndecorated(true);
jf.pack();
DisplayMode dm = jf.getGraphicsConfiguration().getDevice().getDisplayMode();
Dimension contentSize = jf.getSize();
jf.dispose();
代码示例来源:origin: javax.help/javahelp
Point flocation = frame.getLocation();
if (isXinerama()) {
GraphicsConfiguration gc = frame.getGraphicsConfiguration();
Rectangle gcBounds = gc.getBounds();
return new Point(flocation.x - gcBounds.x,
代码示例来源:origin: javax.help/javahelp
gc = frame.getGraphicsConfiguration();
代码示例来源:origin: stackoverflow.com
public void moveToVisible(JFrame frame) {
// Vertical position
GraphicsDevice activeScreen = getGraphicsConfiguration().getDevice();
if (frame.getLocation().y < 0) {
frame.setLocation(getLocation().x, 0);
}
if ((frame.getLocation().y + frame.getHeight()) >
activeScreen.getDisplayMode().getHeight()) {
frame.setLocation(
frame.getLocation().x,
(activeScreen.getDisplayMode().getHeight()
- frame.getHeight())
);
}
// Horizontal position
int offsetRight = frame.getX() + frame.getWidth() - frame.getGraphicsConfiguration().getBounds().x + frame.getGraphicsConfiguration().getBounds().width;
if (offsetRight > 0) {
setLocation(frame.getX() - offsetRight, frame.getY());
}
int offsetLeft = frame.getX() - frame.getGraphicsConfiguration().getBounds().x;
if (offsetLeft < 0) {
frame.setLocation(frame.getX() - offsetLeft, frame.getY());
}
}
代码示例来源:origin: cpesch/RouteConverter
frame.setLocationRelativeTo(null);
Rectangle bounds = frame.getGraphicsConfiguration().getBounds();
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(frame.getGraphicsConfiguration());
log.info("Screen size is " + bounds + ", insets are " + insets);
代码示例来源:origin: sc.fiji/TrakEM2_
final Image background = frame.getGraphicsConfiguration().createCompatibleImage(512, 512);
final Image some = new ij.io.Opener().openImage("http://rsb.info.nih.gov/ij/images/bridge.gif").getProcessor().createImage();
java.awt.Graphics g = background.getGraphics();
代码示例来源:origin: stackoverflow.com
GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
boolean result = device.isFullScreenSupported();
frame.setPreferredSize(frame.getGraphicsConfiguration().getBounds().getSize());
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
device = frame.getGraphicsConfiguration().getDevice();
代码示例来源:origin: freeplane/freeplane
Iterable<Window> visibleFrames = collectVisibleFrames(frame);
if (fullScreen) {
final GraphicsConfiguration graphicsConfiguration = frame.getGraphicsConfiguration();
final Rectangle bounds = graphicsConfiguration.getBounds();
frame.getRootPane().putClientProperty(FrameState.class,
内容来源于网络,如有侵权,请联系作者删除!