项目:jdk8u-jdk
文件:displayChangeVITest.java
@H_502_5@
public static void main(String[] args) throws Exception {
displayChangeVITest test = new displayChangeVItest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printstacktrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
@H_502_5@
@H_502_5@
项目:Openjsharp
文件:SurfaceManager.java
@H_502_5@
public boolean isAccelerated() {
// Note that when img.getaccelerationPriority() gets set to 0
// we remove SurfaceDataProxy objects from the cache and the
// answer will be false.
GraphicsConfiguration tmpGc = gc;
if (tmpGc == null) {
tmpGc = GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice().getDefaultConfiguration();
}
if (tmpGc instanceof ProxiedGraphicsConfig) {
Object proxyKey =
((ProxiedGraphicsConfig) tmpGc).getProxyKey();
if (proxyKey != null) {
SurfaceDataProxy sdp =
(SurfaceDataProxy) getCacheData(proxyKey);
return (sdp != null && sdp.isAccelerated());
}
}
return false;
}
@H_502_5@
@H_502_5@
项目:Cognizant-Intelligent-Test-Scripter
文件:Canvas.java
@H_502_5@
public static Image iconToImage(Icon icon) {
if (icon instanceof ImageIcon) {
return ((ImageIcon) icon).ge@R_502_5034@();
} else {
int w = icon.getIconWidth();
int h = icon.getIconHeight();
GraphicsEnvironment ge
= GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = gd.getDefaultConfiguration();
BufferedImage image = gc.createCompatibleImage(w,h);
Graphics2D g = image.createGraphics();
icon.paintIcon(null,g,0);
g.dispose();
return image;
}
}
@H_502_5@
@H_502_5@
项目:jdk8u-jdk
文件:RenderingToCachedGraphicsTest.java
@H_502_5@
public static void main(String[] args) {
int depth = GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice().getDefaultConfiguration().
getColorModel().getPixelSize();
if (depth < 16) {
System.out.println("Test PASSED (depth < 16bit)");
return;
}
latch = new CountDownLatch(1);
RenderingToCachedGraphicsTest t1 = new RenderingToCachedGraphicstest();
t1.pack();
t1.setSize(300,300);
t1.setVisible(true);
try { latch.await(); } catch (InterruptedException ex) {}
t1.dispose();
if (Failed) {
throw new
RuntimeException("Failed: rendering didn't show up");
}
System.out.println("Test PASSED");
}
@H_502_5@
@H_502_5@
项目:incubator-netbeans
文件:BasicTabdisplayerUI.java
@H_502_5@
@Override
public Image createImageOfTab(int index) {
TabData td = displayer.getModel().getTab(index);
JLabel lbl = new JLabel(td.getText());
int width = lbl.getFontMetrics(lbl.getFont()).stringWidth(td.getText());
int height = lbl.getFontMetrics(lbl.getFont()).getHeight();
width = width + td.getIcon().getIconWidth() + 6;
height = Math.max(height,td.getIcon().getIconHeight()) + 5;
GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice().getDefaultConfiguration();
BufferedImage image = config.createCompatibleImage(width,height);
Graphics2D g = image.createGraphics();
g.setColor(lbl.getForeground());
g.setFont(lbl.getFont());
td.getIcon().paintIcon(lbl,0);
g.drawString(td.getText(),18,height / 2);
return image;
}
@H_502_5@
@H_502_5@
项目:openjdk-jdk10
文件:CheckdisplayModes.java
@H_502_5@
public static void main(String[] args) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
if (!graphicDevice.isdisplayChangeSupported()) {
System.err.println("display mode change is not supported on this host. Test is considered passed.");
return;
}
displayMode defaultdisplayMode = graphicDevice.getdisplayMode();
checkdisplayMode(defaultdisplayMode);
graphicDevice.setdisplayMode(defaultdisplayMode);
displayMode[] displayModes = graphicDevice.getdisplayModes();
boolean isDefaultdisplayModeIncluded = false;
for (displayMode displayMode : displayModes) {
checkdisplayMode(displayMode);
graphicDevice.setdisplayMode(displayMode);
if (defaultdisplayMode.equals(displayMode)) {
isDefaultdisplayModeIncluded = true;
}
}
if (!isDefaultdisplayModeIncluded) {
throw new RuntimeException("Default display mode is not included");
}
}
@H_502_5@
@H_502_5@
项目:incubator-netbeans
文件:NbiDialog.java
@H_502_5@
public void setVisible(boolean visible) {
if (owner == null) {
final GraphicsDevice screen = GraphicsEnvironment.
getLocalGraphicsEnvironment().
getScreenDevices()[0];
final GraphicsConfiguration config = screen.getDefaultConfiguration();
final int screenWidth = config.getBounds().width;
final int screenHeight = config.getBounds().height;
setLocation(
(screenWidth - getSize().width) / 2,(screenHeight - getSize().height) / 2);
} else {
setLocation(
owner.getLocation().x + DIALOG_FRAME_WIDTH_DELTA,owner.getLocation().y + DIALOG_FRAME_WIDTH_DELTA);
}
super.setVisible(visible);
}
@H_502_5@
@H_502_5@
项目:powertext
文件:TipUtil.java
@H_502_5@
/**
* Returns the screen coordinates for the monitor that contains the
* specified point. This is useful for setups with multiple monitors,* to ensure that popup windows are positioned properly.
*
* @param x The x-coordinate,in screen coordinates.
* @param y The y-coordinate,in screen coordinates.
* @return The bounds of the monitor that contains the specified point.
*/
public static Rectangle getScreenBoundsForPoint(int x,int y) {
GraphicsEnvironment env = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice[] devices = env.getScreenDevices();
for (int i=0; i<devices.length; i++) {
GraphicsConfiguration[] configs = devices[i].getConfigurations();
for (int j=0; j<configs.length; j++) {
Rectangle gcBounds = configs[j].getBounds();
if (gcBounds.contains(x,y)) {
return gcBounds;
}
}
}
// If point is outside all monitors,default to default monitor (?)
return env.getMaximumWindowBounds();
}
@H_502_5@
@H_502_5@
项目:jdk8u-jdk
文件:VolatileImageBug.java
@H_502_5@
public static void main(String[] args) {
boolean iaeThrown = false;
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsConfiguration gc = ge.getDefaultScreenDevice().
getDefaultConfiguration();
try {
VolatileImage volatileImage = gc.createCompatibleVolatileImage(0,0);
} catch (IllegalArgumentException iae) {
iaeThrown = true;
}
if (!iaeThrown) {
throw new RuntimeException ("IllegalArgumentException not thrown " +
"for createCompatibleVolatileImage(0,0)");
}
}
@H_502_5@
@H_502_5@
项目:LeagueStats
文件:Assets.java
@H_502_5@
/**
* Initializes the fonts for this application.
*/
private static void initFonts() {
final String extension = ".ttf";
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
try {
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT,new File(FONT_FILE_PATH + CAVIAR_FONT_NAME.replace(" ","") + extension)));
} catch (FontFormatException | IOException e) {
logger.logError("An error occured while trying to register the font: " + CAVIAR_FONT_NAME + extension);
}
NAME_FONT = new Font(CAVIAR_FONT_NAME,Font.BOLD,18);
SMALL_NAME_FONT = new Font(CAVIAR_FONT_NAME,Font.PLAIN,15);
STATS_FONT = new Font(CAVIAR_FONT_NAME,18);
}
@H_502_5@
@H_502_5@
项目:incubator-netbeans
文件:OutlineViewDropSupport.java
@H_502_5@
/** Activates or deactivates Drag support on asociated JTree
* component
* @param active true if the support should be active,false
* otherwise
*/
public void activate(boolean active) {
if (this.active == active) {
return;
}
this.active = active;
if (GraphicsEnvironment.isHeadless()) {
return;
}
getDropTarget().setActive(active);
//we want to support drop into scroll pane's free area and treat it as 'root node drop'
if( null == outerDropTarget ) {
outerDropTarget = new DropTarget(view.getViewport(),view.getAllowedDropActions(),this,false);
}
outerDropTarget.setActive(active);
}
@H_502_5@
@H_502_5@
项目:openjdk-jdk10
文件:VolatileImageBug.java
@H_502_5@
public static void main(String[] args) {
boolean iaeThrown = false;
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsConfiguration gc = ge.getDefaultScreenDevice().
getDefaultConfiguration();
try {
VolatileImage volatileImage = gc.createCompatibleVolatileImage(0,0)");
}
}
@H_502_5@
@H_502_5@
项目:openjdk-jdk10
文件:MultiScreenRobotPosition.java
@H_502_5@
public static void main(String[] args) throws Exception {
GraphicsDevice[] sds = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getScreenDevices();
for (final GraphicsDevice gd : sds) {
fail = true;
Robot robot = new Robot(gd);
robot.setAutoDelay(100);
robot.setAutoWaitForIdle(true);
Frame frame = new Frame(gd.getDefaultConfiguration());
frame.setUndecorated(true);
frame.setSize(400,400);
frame.setVisible(true);
robot.waitForIdle();
frame.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println("e = " + e);
fail = false;
}
});
Rectangle bounds = frame.getBounds();
robot.mouseMove(bounds.x + bounds.width / 2,bounds.y + bounds.height / 2);
robot.mousepress(MouseEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(MouseEvent.BUTTON1_DOWN_MASK);
frame.dispose();
if (fail) {
System.err.println("Frame bounds = " + bounds);
throw new RuntimeException("Click in the wrong location");
}
}
}
@H_502_5@
@H_502_5@
项目:openjdk-jdk10
文件:IsToolkitUseTheMainScreen.java
@H_502_5@
private static void testHeadful() {
GraphicsEnvironment ge
= GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsConfiguration gc
= ge.getDefaultScreenDevice().getDefaultConfiguration();
Dimension gcSize = gc.getBounds().getSize();
ColorModel gcCM = gc.getColorModel();
Dimension toolkitSize = Toolkit.getDefaultToolkit().getScreenSize();
ColorModel toolkitCM = Toolkit.getDefaultToolkit().getColorModel();
if (!gcSize.equals(toolkitSize)) {
System.err.println("Toolkit size = " + toolkitSize);
System.err.println("GraphicsConfiguration size = " + gcSize);
throw new RuntimeException("Incorrect size");
}
if (!gcCM.equals(toolkitCM)) {
System.err.println("Toolkit color model = " + toolkitCM);
System.err.println("GraphicsConfiguration color model = " + gcCM);
throw new RuntimeException("Incorrect color model");
}
}
@H_502_5@
@H_502_5@
项目:openjdk-jdk10
文件:XlibUtil.java
@H_502_5@
/**
* Xinerama-aware version of XlibWrapper.Rootwindow method.
*/
public static long getRootwindow(int screenNumber)
{
XToolkit.awtLock();
try
{
X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (x11ge.runningXinerama())
{
// all the Xinerama windows share the same root window
return XlibWrapper.Rootwindow(XToolkit.getdisplay(),0);
}
else
{
return XlibWrapper.Rootwindow(XToolkit.getdisplay(),screenNumber);
}
}
finally
{
XToolkit.awtUnlock();
}
}
@H_502_5@
@H_502_5@
项目:jdk8u-jdk
文件:Desktop.java
@H_502_5@
/**
* Returns the <code>Desktop</code> instance of the current
* browser context. On some platforms the Desktop API may not be
* supported; use the {@link #isDesktopSupported} method to
* determine if the current desktop is supported.
* @return the Desktop instance of the current browser context
* @throws HeadlessException if {@link
* GraphicsEnvironment#isHeadless()} returns {@code true}
* @throws UnsupportedOperationException if this class is not
* supported on the current platform
* @see #isDesktopSupported()
* @see java.awt.GraphicsEnvironment#isHeadless
*/
public static synchronized Desktop getDesktop(){
if (GraphicsEnvironment.isHeadless()) throw new HeadlessException();
if (!Desktop.isDesktopSupported()) {
throw new UnsupportedOperationException("Desktop API is not " +
"supported on the current platform");
}
sun.awt.AppContext context = sun.awt.AppContext.getAppContext();
Desktop desktop = (Desktop)context.get(Desktop.class);
if (desktop == null) {
desktop = new Desktop();
context.put(Desktop.class,desktop);
}
return desktop;
}
@H_502_5@
@H_502_5@
项目:openjdk-jdk10
文件:displayChangeVITest.java
@H_502_5@
public static void main(String[] args) throws Exception {
displayChangeVITest test = new displayChangeVItest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printstacktrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
@H_502_5@
@H_502_5@
项目:openjdk-jdk10
文件:MultiMonPrintDlgTest.java
@H_502_5@
private void executetest() {
GraphicsDevice defDev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
int x = 0;
Frame f = null;
for (x = 0; x < gd.length; x ++) {
if (gd[x] != defDev) {
secFrame = new Frame("Screen " + x + " - secondary",gd[x].getDefaultConfiguration());
f = secFrame;
} else {
primaryFrame = new Frame("Screen " + x + " - primary",gd[x].getDefaultConfiguration());
f = primaryFrame;
}
Button b = new Button("Print");
b.addActionListener(this);
f.add("South",b);
f.addWindowListener (new WindowAdapter() {
public void windowClosing(WindowEvent we) {
((Window) we.getSource()).dispose();
}
});
f.setSize(200,200);
f.setVisible(true);
}
}
@H_502_5@
@H_502_5@
项目:Pixie
文件:Resize.java
@H_502_5@
/**
* Resize the window to user prefer size. In case the zoomed user preference
* is not set,then resize the width and height to fit the max display size
* In case the provided width and height are smaller than max allowed size
* they will be zoomed in(maximized) to max allowed size. In case the width
* and height are bigger than max allowed size they will be zoomed
* out(minimized) to max allowed size
*
* @param width object's width
* @param height object's height
* @param userZoomedindex user's prefer zoomed index
*/
public Resize(int width,int height,int userZoomedindex) {
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
int widthSc = gd.getdisplayMode().getWidth();
int heightSc = gd.getdisplayMode().getHeight();
double ratioW;
double ratioH;
double cropRatio;
/* did the user saved its zoomed preference? */
if (userZoomedindex == Integer.MAX_VALUE) {
ratioW = (double) width / (widthSc * MAX_SCREEN_PERCENT_RESIZE);
ratioH = (double) height / (heightSc * MAX_SCREEN_PERCENT_RESIZE);
cropRatio = (double) width / (double) height;
} else {
int tmpWidth = Math.abs(width) + userZoomedindex * Math.abs(width / ZOOMING_FACTOR);
int tmpHeight = Math.abs(height) + userZoomedindex * Math.abs(height / ZOOMING_FACTOR);
ratioW = (double) width / (double) tmpWidth;
ratioH = (double) height / (double) tmpHeight;
cropRatio = (double) width / (double) height;
}
computeResizeRatios(ratioW,ratioH,cropRatio,width,height,widthSc,heightSc);
}
@H_502_5@
@H_502_5@
项目:Openjsharp
文件:WGLSurfaceData.java
@H_502_5@
public static WGLGraphicsConfig getGC(WComponentPeer peer) {
if (peer != null) {
return (WGLGraphicsConfig)peer.getGraphicsConfiguration();
} else {
// REMIND: this should rarely (never?) happen,but what if
// default config is not WGL?
GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = env.getDefaultScreenDevice();
return (WGLGraphicsConfig)gd.getDefaultConfiguration();
}
}
@H_502_5@
@H_502_5@
项目:JavaGraph
文件:Icons.java
@H_502_5@
/** Creates a named cursor from a given file. */
static private Cursor createCursor(String name,ImageIcon icon) {
if (GraphicsEnvironment.isHeadless()) {
// The environtment variable disPLAY is not set. We can't call
// createCustomCursor from the awt toolkit because this causes
// a java.awt.HeadlessException. In any case we don't need the
// cursor because we are running without GUI,so we just abort.
return null;
} else {
Toolkit tk = Toolkit.getDefaultToolkit();
Image cursorImage = icon.ge@R_502_5034@();
return tk.createCustomCursor(cursorImage,new Point(0,0),name);
}
}
@H_502_5@
@H_502_5@
项目:SerialPortDemo
文件:MainFrame.java
@H_502_5@
private void initView() {
// 关闭程序
setDefaultCloSEOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
// 禁止窗口最大化
setResizable(false);
// 设置程序窗口居中显示
Point p = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getCenterPoint();
setBounds(p.x - WIDTH / 2,p.y - HEIGHT / 2,WIDTH,HEIGHT);
this.setLayout(null);
setTitle("串口通讯");
}
@H_502_5@
@H_502_5@
项目:openjdk-jdk10
文件:IncorrectAlphaConversionBicubic.java
@H_502_5@
public static void main(final String[] args) {
final GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice gd = ge.getDefaultScreenDevice();
final GraphicsConfiguration gc = gd.getDefaultConfiguration();
final VolatileImage vi =
gc.createCompatibleVolatileImage(SIZE,SIZE,TRANSLUCENT);
final BufferedImage bi = makeUnmanagedBI(gc,TRANSLUCENT);
final int expected = bi.getRGB(2,2);
int attempt = 0;
BufferedImage snapshot;
while (true) {
if (++attempt > 10) {
throw new RuntimeException("Too many attempts: " + attempt);
}
vi.validate(gc);
final Graphics2D g2d = vi.createGraphics();
g2d.setComposite(AlphaComposite.Src);
g2d.scale(2,2);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g2d.drawImage(bi,null);
g2d.dispose();
snapshot = vi.getSnapshot();
if (vi.contentsLost()) {
continue;
}
break;
}
final int actual = snapshot.getRGB(2,2);
if (actual != expected) {
System.err.println("Actual: " + Integer.toHexString(actual));
System.err.println("Expected: " + Integer.toHexString(expected));
throw new RuntimeException("Test Failed");
}
}
@H_502_5@
@H_502_5@
项目:Openjsharp
文件:FontPanel.java
@H_502_5@
static Integer getDefaultLCDContrast() {
if (defaultContrast == null) {
GraphicsConfiguration gc =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice().getDefaultConfiguration();
Graphics2D g2d =
(Graphics2D)(gc.createCompatibleImage(1,1).getGraphics());
defaultContrast = (Integer)
g2d.getRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST);
}
return defaultContrast;
}
@H_502_5@
@H_502_5@
项目:incubator-netbeans
文件:PaletteItemRegistrationProcessorTest.java
@H_502_5@
public void testAnnotatedPackage() throws IOException {
//missing body
clearworkdir();
assertTrue("Headless run",GraphicsEnvironment.isHeadless());
AnnotationProcessorTestUtils.makeSource(getworkdir(),"testa.package-info",VALID_PACKAGE_ANNOTATION
+ "\npackage testa\n;"
+ "import org.netbeans.spi.palette.PaletteItemRegistration;\n");
ByteArrayOutputStream os = new ByteArrayOutputStream();
boolean r = AnnotationProcessorTestUtils.runJavac(getworkdir(),null,getworkdir(),os);
assertTrue("Compilation has to be successfull:\n" + os,r);
}
@H_502_5@
@H_502_5@
项目:incubator-netbeans
文件:StatusLineComponent.java
@H_502_5@
public void hidePopup() {
if (GraphicsEnvironment.isHeadless()) {
return;
}
if (popupWindow != null) {
// popupWindow.getContentPane().removeAll();
popupWindow.setVisible(false);
}
Toolkit.getDefaultToolkit().removeAWTEventListener(hideListener);
WindowManager.getDefault().getMainWindow().removeWindowStateListener(hideListener);
WindowManager.getDefault().getMainWindow().removeComponentListener(hideListener);
showingPopup = false;
}
@H_502_5@
@H_502_5@
项目:incubator-netbeans
文件:ProjectUiModule.java
@H_502_5@
@Override
public void restored() {
if (!GraphicsEnvironment.isHeadless()) {
Hacks.keepCurrentProjectNameUpdated();
}
brokenProjectNotifier.getInstnace().start();
}
@H_502_5@
@H_502_5@
项目:jdk8u-jdk
文件:GLXSurfaceData.java
@H_502_5@
public static GLXGraphicsConfig getGC(X11ComponentPeer peer) {
if (peer != null) {
return (GLXGraphicsConfig)peer.getGraphicsConfiguration();
} else {
// REMIND: this should rarely (never?) happen,but what if
// default config is not GLX?
GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = env.getDefaultScreenDevice();
return (GLXGraphicsConfig)gd.getDefaultConfiguration();
}
}
@H_502_5@
@H_502_5@
项目:owa-notifier
文件:Screen.java
@H_502_5@
private void setupDimensions(boolean spanMultipleMonitors) {
if (spanMultipleMonitors) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
m_width = screenSize.width;
m_height = screenSize.height;
} else {
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
m_width = gd.getdisplayMode().getWidth();
m_height = gd.getdisplayMode().getHeight();
}
}
@H_502_5@
@H_502_5@
项目:incubator-netbeans
文件:PaletteItemRegistrationProcessorTest.java
@H_502_5@
public void testActiveEditorDropAnnotatedWithInvalidResources() throws IOException {
clearworkdir();
assertTrue("Headless run","test.B","import org.netbeans.spi.palette.PaletteItemRegistration;\n"
+ "import org.openide.text.ActiveEditorDrop;\n;import javax.swing.text.JTextComponent;"
+ INVALIDRESOURCE_CLASS_ANNOTATION
+ "public class B implements ActiveEditorDrop {\n"
+ " public boolean handleTransfer(JTextComponent targetComponent) {return true; }"
+ "}\n");
ByteArrayOutputStream os = new ByteArrayOutputStream();
boolean r = AnnotationProcessorTestUtils.runJavac(getworkdir(),os);
assertFalse("Compilation has to fail:\n" + os,r);
}
@H_502_5@
@H_502_5@
项目:Luyten4Forge
文件:JFontChooser.java
@H_502_5@
protected String[] getFontFamilies() {
if (fontFamilyNames == null) {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
fontFamilyNames = env.getAvailableFontFamilyNames();
}
return fontFamilyNames;
}
@H_502_5@
@H_502_5@
项目:incubator-netbeans
文件:NbEvents.java
@H_502_5@
private void notify(String text,boolean warn) {
if (GraphicsEnvironment.isHeadless() || Boolean.getBoolean("netbeans.full.hack")) { // NOI18N
// #21773: interferes with automated GUI testing.
logger.log(Level.WARNING,"{0}\n",text);
} else {
// normal - display dialog.
new Notifier(text,warn).show();
}
}
@H_502_5@
@H_502_5@
项目:powertext
文件:Util.java
@H_502_5@
/**
* Returns the screen coordinates for the monitor that contains the
* specified point. This is useful for setups with multiple monitors,int y) {
GraphicsEnvironment env = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice[] devices = env.getScreenDevices();
for (int i=0; i<devices.length; i++) {
GraphicsConfiguration config = devices[i].getDefaultConfiguration();
Rectangle gcBounds = config.getBounds();
if (gcBounds.contains(x,y)) {
return gcBounds;
}
}
// If point is outside all monitors,default to default monitor (?)
return env.getMaximumWindowBounds();
}
@H_502_5@
@H_502_5@
项目:Openjsharp
文件:DragSource.java
@H_502_5@
private static Cursor load(String name) {
if (GraphicsEnvironment.isHeadless()) {
return null;
}
try {
return (Cursor)Toolkit.getDefaultToolkit().getDesktopProperty(name);
} catch (Exception e) {
e.printstacktrace();
throw new RuntimeException("Failed to load system cursor: " + name + " : " + e.getMessage());
}
}
@H_502_5@
@H_502_5@
项目:BaseClient
文件:minecraftServer.java
@H_502_5@
public void addServerTypetoSnooper(PlayerUsageSnooper playerSnooper)
{
playerSnooper.addStatToSnooper("singleplayer",Boolean.valueOf(this.isSinglePlayer()));
playerSnooper.addStatToSnooper("server_brand",this.getServerModName());
playerSnooper.addStatToSnooper("gui_supported",GraphicsEnvironment.isHeadless() ? "headless" : "supported");
playerSnooper.addStatToSnooper("dedicated",Boolean.valueOf(this.isDedicatedServer()));
}
@H_502_5@
@H_502_5@
项目:incubator-netbeans
文件:DragWindow.java
@H_502_5@
private BufferedImage createTabImage() {
GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice().getDefaultConfiguration();
//the tab rectangle must be painted by top-level window otherwise the transparent
//button icons will be messed up
Window parentwindow = SwingUtilities.getwindowAncestor(container.getComponent());
Rectangle rect = SwingUtilities.convertRectangle(container.getComponent(),tabRectangle,parentwindow);
BufferedImage res = config.createCompatibleImage(tabRectangle.width,tabRectangle.height);
Graphics2D g = res.createGraphics();
g.translate(-rect.x,-rect.y);
g.setClip(rect);
parentwindow.paint(g);
return res;
}
@H_502_5@
@H_502_5@
项目:sbc-qsystem
文件:ABoardFX.java
@H_502_5@
/**
*/
public void showBoard() {
if (0 != cfg.getInt("device",0)) {
GraphicsDevice[] screenDevices = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getScreenDevices();
int i = 1;
for (GraphicsDevice graphicsDevice : screenDevices) {
System.out.println(
"graphicsDevice = " + graphicsDevice.getIDstring() + " " + graphicsDevice
.toString()
+ "\nРазрешение экрана " + graphicsDevice.getDefaultConfiguration()
.getBounds().height + "x" + graphicsDevice.getDefaultConfiguration()
.getBounds().width
+ "\nГлубина цвета " + graphicsDevice.getdisplayMode().getBitDepth()
+ "\nЧастота " + graphicsDevice.getdisplayMode().getRefreshRate()
+ "\nНачало координат " + graphicsDevice.getDefaultConfiguration()
.getBounds().x
+ "-" + graphicsDevice.getDefaultConfiguration().getBounds().y);
if (i == cfg.getInt("device")) {
win_x = graphicsDevice.getDefaultConfiguration().getBounds().x;
win_y = graphicsDevice.getDefaultConfiguration().getBounds().y;
win_w = graphicsDevice.getDefaultConfiguration().getBounds().width;
win_h = graphicsDevice.getDefaultConfiguration().getBounds().height;
}
i++;
}
SwingUtilities.invokelater(() -> {
initAndShowGUI();
});
}
}
@H_502_5@
@H_502_5@
项目:jdk8u-jdk
文件:SurfaceDataProxy.java
@H_502_5@
/**
* This method should be called from subclasses which create
* cached SurfaceData objects that depend on the current
* properties of the display.
*/
protected void activatedisplayListener() {
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
// We Could have a HeadlessGE at this point,so double-check before
// assuming anything.
// Also,no point in listening to display change events if
// the image is never going to be accelerated.
if (ge instanceof SunGraphicsEnvironment) {
((SunGraphicsEnvironment)ge).adddisplayChangedListener(this);
}
}
@H_502_5@
@H_502_5@
项目:incubator-netbeans
文件:PropertyPanel.java
@H_502_5@
/** The constructor all the other constructors call */
private PropertyPanel(Node.Property p,int preferences,PropertyModel mdl) {
if (p == null) {
prop = ModelProperty.toProperty(mdl);
} else {
prop = p;
}
this.preferences = preferences;
initializing = true;
setModel(mdl);
initializing = false;
setopaque(true);
if (!GraphicsEnvironment.isHeadless()) {
//for debugging,allow CTRL-. to dump the state to stderr
getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
Keystroke.getKeystroke(KeyEvent.VK_PERIOD,Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()),"dump"
);
}
getActionMap().put(
"dump",new AbstractAction() { //NOI18N
public void actionPerformed(ActionEvent ae) {
System.err.println(""); //NOI18N
System.err.println(PropertyPanel.this);
System.err.println(""); //NOI18N
}
}
);
//#44226 - Unpretty,but this allows the TreeTableView to invoke a custom editor dialog when
//necessary - with the TTV rewrite,all cell editor infrastructure will be moved to
//org.netbeans.modules.openide.explorer,and they will simply share editor classes. Since that
//involves an API change (some package private methods of PropertyEnv need to be accessible to
//the editor classes),this will have to wait for after 4.0 - Tim
getActionMap().put("invokeCustomEditor",new CustomEditorProxyAction()); //NOI18N
PropertyPanelBridge.register(this,new BridgeAccessor(this));
}
@H_502_5@
@H_502_5@
项目:jdk8u-jdk
文件:WGLSurfaceData.java
@H_502_5@
public static WGLGraphicsConfig getGC(WComponentPeer peer) {
if (peer != null) {
return (WGLGraphicsConfig)peer.getGraphicsConfiguration();
} else {
// REMIND: this should rarely (never?) happen,but what if
// default config is not WGL?
GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = env.getDefaultScreenDevice();
return (WGLGraphicsConfig)gd.getDefaultConfiguration();
}
}
@H_502_5@
@H_502_5@
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。