java.awt.Canvas Java Examples
The following examples show how to use
java.awt.Canvas.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Display.java From New-Beginner-Java-Game-Programming-Src with Creative Commons Zero v1.0 Universal | 6 votes |
private void createDisplay(){ frame = new JFrame(title); frame.setSize(width, height); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); canvas = new Canvas(); canvas.setPreferredSize(new Dimension(width, height)); canvas.setMaximumSize(new Dimension(width, height)); canvas.setMinimumSize(new Dimension(width, height)); canvas.setFocusable(false); frame.add(canvas); frame.pack(); }
Example #2
Source File: BarcodeDatamatrix.java From gcs with Mozilla Public License 2.0 | 6 votes |
/** * Creates a <CODE>java.awt.Image</CODE>. A successful call to the method * <CODE>generate()</CODE> before calling this method is required. * * @param foreground the color of the bars * @param background the color of the background * @return the image */ public java.awt.Image createAwtImage(Color foreground, Color background) { if (image == null) { return null; } int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); int w = width + 2 * ws; int h = height + 2 * ws; int pix[] = new int[w * h]; int stride = (w + 7) / 8; int ptr = 0; for (int k = 0; k < h; ++k) { int p = k * stride; for (int j = 0; j < w; ++j) { int b = image[p + j / 8] & 0xff; b <<= j % 8; pix[ptr++] = (b & 0x80) == 0 ? g : f; } } java.awt.Image img = canvas.createImage(new MemoryImageSource(w, h, pix, 0, w)); return img; }
Example #3
Source File: Utils.java From BlindWatermark with Apache License 2.0 | 6 votes |
public static Mat drawNonAscii(String watermark) { Font font = new Font("Default", Font.PLAIN, 64); FontMetrics metrics = new Canvas().getFontMetrics(font); int width = metrics.stringWidth(watermark); int height = metrics.getHeight(); BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); Graphics2D graphics = bufferedImage.createGraphics(); graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); graphics.setFont(font); graphics.setColor(Color.WHITE); graphics.drawString(watermark, 0, metrics.getAscent()); graphics.dispose(); byte[] pixels = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()).getData(); Mat res = new Mat(bufferedImage.getHeight(), bufferedImage.getWidth(), CV_8U); res.put(0, 0, pixels); return res; }
Example #4
Source File: bug8032667.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Override public void init() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final Image image1 = getImage(getCheckBox("Deselected", false)); final Image image2 = getImage(getCheckBox("Selected", true)); Canvas canvas = new Canvas() { @Override public void paint(Graphics g) { super.paint(g); g.drawImage(image1, 0, 0, scaledWidth, scaledHeight, this); g.drawImage(image2, 0, scaledHeight + 5, scaledWidth, scaledHeight, this); } }; getContentPane().add(canvas, BorderLayout.CENTER); } }); }
Example #5
Source File: Display.java From New-Beginner-Java-Game-Programming-Src with Creative Commons Zero v1.0 Universal | 6 votes |
private void createDisplay(){ frame = new JFrame(title); frame.setSize(width, height); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); canvas = new Canvas(); canvas.setPreferredSize(new Dimension(width, height)); canvas.setMaximumSize(new Dimension(width, height)); canvas.setMinimumSize(new Dimension(width, height)); frame.add(canvas); frame.pack(); }
Example #6
Source File: Display.java From New-Beginner-Java-Game-Programming-Src with Creative Commons Zero v1.0 Universal | 6 votes |
private void createDisplay(){ frame = new JFrame(title); frame.setSize(width, height); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); canvas = new Canvas(); canvas.setPreferredSize(new Dimension(width, height)); canvas.setMaximumSize(new Dimension(width, height)); canvas.setMinimumSize(new Dimension(width, height)); canvas.setFocusable(false); frame.add(canvas); frame.pack(); }
Example #7
Source File: Display.java From New-Beginner-Java-Game-Programming-Src with Creative Commons Zero v1.0 Universal | 6 votes |
private void createDisplay(){ frame = new JFrame(title); frame.setSize(width, height); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); canvas = new Canvas(); canvas.setPreferredSize(new Dimension(width, height)); canvas.setMaximumSize(new Dimension(width, height)); canvas.setMinimumSize(new Dimension(width, height)); canvas.setFocusable(false); frame.add(canvas); frame.pack(); }
Example #8
Source File: bug8032667.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public void init() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final Image image1 = getImage(getCheckBox("Deselected", false)); final Image image2 = getImage(getCheckBox("Selected", true)); Canvas canvas = new Canvas() { @Override public void paint(Graphics g) { super.paint(g); g.drawImage(image1, 0, 0, scaledWidth, scaledHeight, this); g.drawImage(image2, 0, scaledHeight + 5, scaledWidth, scaledHeight, this); } }; getContentPane().add(canvas, BorderLayout.CENTER); } }); }
Example #9
Source File: CefBrowser_N.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * Create a new browser as dev tools */ protected final void createDevTools(CefBrowser parent, CefClientHandler clientHandler, long windowHandle, boolean transparent, Canvas canvas) { if (getNativeRef("CefBrowser") == 0 && !isPending_) { try { isPending_ = N_CreateDevTools(parent, clientHandler, windowHandle, transparent, canvas); } catch (UnsatisfiedLinkError err) { err.printStackTrace(); } } }
Example #10
Source File: Display.java From New-Beginner-Java-Game-Programming-Src with Creative Commons Zero v1.0 Universal | 6 votes |
private void createDisplay(){ frame = new JFrame(title); frame.setSize(width, height); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); canvas = new Canvas(); canvas.setPreferredSize(new Dimension(width, height)); canvas.setMaximumSize(new Dimension(width, height)); canvas.setMinimumSize(new Dimension(width, height)); canvas.setFocusable(false); frame.add(canvas); frame.pack(); }
Example #11
Source File: bug8032667.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public void init() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final Image image1 = getImage(getCheckBox("Deselected", false)); final Image image2 = getImage(getCheckBox("Selected", true)); Canvas canvas = new Canvas() { @Override public void paint(Graphics g) { super.paint(g); g.drawImage(image1, 0, 0, scaledWidth, scaledHeight, this); g.drawImage(image2, 0, scaledHeight + 5, scaledWidth, scaledHeight, this); } }; getContentPane().add(canvas, BorderLayout.CENTER); } }); }
Example #12
Source File: Display.java From New-Beginner-Java-Game-Programming-Src with Creative Commons Zero v1.0 Universal | 5 votes |
private void createDisplay(){ frame = new JFrame(title); frame.setSize(width, height); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); canvas = new Canvas(); canvas.setPreferredSize(new Dimension(width, height)); canvas.setMaximumSize(new Dimension(width, height)); canvas.setMinimumSize(new Dimension(width, height)); canvas.setFocusable(false); frame.add(canvas); frame.pack(); }
Example #13
Source File: BarcodePDF417.java From itext2 with GNU Lesser General Public License v3.0 | 5 votes |
/** Creates a <CODE>java.awt.Image</CODE>. * @param foreground the color of the bars * @param background the color of the background * @return the image */ public java.awt.Image createAwtImage(Color foreground, Color background) { int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); paintCode(); int h = (int)yHeight; int pix[] = new int[bitColumns * codeRows * h]; int stride = (bitColumns + 7) / 8; int ptr = 0; for (int k = 0; k < codeRows; ++k) { int p = k * stride; for (int j = 0; j < bitColumns; ++j) { int b = outBits[p + (j / 8)] & 0xff; b <<= j % 8; pix[ptr++] = (b & 0x80) == 0 ? g : f; } for (int j = 1; j < h; ++j) { System.arraycopy(pix, ptr - bitColumns, pix, ptr + bitColumns * (j - 1), bitColumns); } ptr += bitColumns * (h - 1); } java.awt.Image img = canvas.createImage(new MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns)); return img; }
Example #14
Source File: KeyboardFocusManagerPeerImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") public static boolean shouldFocusOnClick(Component component) { boolean acceptFocusOnClick = false; // A component is generally allowed to accept focus on click // if its peer is focusable. There're some exceptions though. // CANVAS & SCROLLBAR accept focus on click if (component instanceof Canvas || component instanceof Scrollbar) { acceptFocusOnClick = true; // PANEL, empty only, accepts focus on click } else if (component instanceof Panel) { acceptFocusOnClick = (((Panel)component).getComponentCount() == 0); // Other components } else { ComponentPeer peer = (component != null ? component.getPeer() : null); acceptFocusOnClick = (peer != null ? peer.isFocusable() : false); } return acceptFocusOnClick && AWTAccessor.getComponentAccessor().canBeFocusOwner(component); }
Example #15
Source File: KeyboardFocusManagerPeerImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") public static boolean shouldFocusOnClick(Component component) { boolean acceptFocusOnClick = false; // A component is generally allowed to accept focus on click // if its peer is focusable. There're some exceptions though. // CANVAS & SCROLLBAR accept focus on click if (component instanceof Canvas || component instanceof Scrollbar) { acceptFocusOnClick = true; // PANEL, empty only, accepts focus on click } else if (component instanceof Panel) { acceptFocusOnClick = (((Panel)component).getComponentCount() == 0); // Other components } else { ComponentPeer peer = (component != null ? component.getPeer() : null); acceptFocusOnClick = (peer != null ? peer.isFocusable() : false); } return acceptFocusOnClick && AWTAccessor.getComponentAccessor().canBeFocusOwner(component); }
Example #16
Source File: BarcodeCodabar.java From itext2 with GNU Lesser General Public License v3.0 | 5 votes |
/** Creates a <CODE>java.awt.Image</CODE>. This image only * contains the bars without any text. * @param foreground the color of the bars * @param background the color of the background * @return the image */ public java.awt.Image createAwtImage(Color foreground, Color background) { int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); String fullCode = code; if (generateChecksum && checksumText) fullCode = calculateChecksum(code); if (!startStopText) fullCode = fullCode.substring(1, fullCode.length() - 1); byte bars[] = getBarsCodabar(generateChecksum ? calculateChecksum(code) : code); int wide = 0; for (int k = 0; k < bars.length; ++k) { wide += bars[k]; } int narrow = bars.length - wide; int fullWidth = narrow + wide * (int)n; boolean print = true; int ptr = 0; int height = (int)barHeight; int pix[] = new int[fullWidth * height]; for (int k = 0; k < bars.length; ++k) { int w = (bars[k] == 0 ? 1 : (int)n); int c = g; if (print) c = f; print = !print; for (int j = 0; j < w; ++j) pix[ptr++] = c; } for (int k = fullWidth; k < pix.length; k += fullWidth) { System.arraycopy(pix, 0, pix, k, fullWidth); } Image img = canvas.createImage(new MemoryImageSource(fullWidth, height, pix, 0, fullWidth)); return img; }
Example #17
Source File: bug8032667.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void init() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final Image image1 = getImage(getCheckBox("Deselected", false)); final Image image2 = getImage(getCheckBox("Selected", true)); Canvas canvas = new Canvas() { @Override public void paint(Graphics g) { super.paint(g); g.drawImage(image1, 0, 0, scaledWidth, scaledHeight, this); g.drawImage(image2, 0, scaledHeight + 5, scaledWidth, scaledHeight, this); } }; getContentPane().add(canvas, BorderLayout.CENTER); } }); }
Example #18
Source File: WideComboBox.java From openAGV with Apache License 2.0 | 5 votes |
@Override public void doLayout() { try { layingOut = true; int tmpPopupWidth = 1; Canvas c = new Canvas(); FontMetrics fontMetrics = c.getFontMetrics(this.getFont()); for (int i = 0; i < super.getItemCount(); i++) { String item = super.getItemAt(i); tmpPopupWidth = Integer.max(fontMetrics.stringWidth(item), tmpPopupWidth); } tmpPopupWidth += 15; this.popupWidth = Optional.of(tmpPopupWidth); super.doLayout(); } finally { layingOut = false; } }
Example #19
Source File: bug8032667.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public void init() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final Image image1 = getImage(getCheckBox("Deselected", false)); final Image image2 = getImage(getCheckBox("Selected", true)); Canvas canvas = new Canvas() { @Override public void paint(Graphics g) { super.paint(g); g.drawImage(image1, 0, 0, scaledWidth, scaledHeight, this); g.drawImage(image2, 0, scaledHeight + 5, scaledWidth, scaledHeight, this); } }; getContentPane().add(canvas, BorderLayout.CENTER); } }); }
Example #20
Source File: Mickey.java From ThinkJavaCode with MIT License | 5 votes |
public static void main(String[] args) { JFrame frame = new JFrame("Mickey Mouse"); Canvas canvas = new Mickey(); canvas.setSize(400, 400); canvas.setBackground(Color.white); frame.add(canvas); frame.pack(); frame.setVisible(true); }
Example #21
Source File: PlatformWin32VKCanvas.java From lwjgl3-awt with MIT License | 5 votes |
public long create(Canvas canvas, VKData data) throws AWTException { MemoryStack stack = MemoryStack.stackGet(); int ptr = stack.getPointer(); JAWTDrawingSurface ds = JAWT_GetDrawingSurface(canvas, awt.GetDrawingSurface()); try { int lock = JAWT_DrawingSurface_Lock(ds, ds.Lock()); if ((lock & JAWT_LOCK_ERROR) != 0) throw new AWTException("JAWT_DrawingSurface_Lock() failed"); try { JAWTDrawingSurfaceInfo dsi = JAWT_DrawingSurface_GetDrawingSurfaceInfo(ds, ds.GetDrawingSurfaceInfo()); try { JAWTWin32DrawingSurfaceInfo dsiWin = JAWTWin32DrawingSurfaceInfo.create(dsi.platformInfo()); long hwnd = dsiWin.hwnd(); VkWin32SurfaceCreateInfoKHR sci = VkWin32SurfaceCreateInfoKHR.callocStack(stack) .sType(VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR) .hinstance(WinBase.GetModuleHandle((ByteBuffer) null)) .hwnd(hwnd); long surfaceAddr = stack.nmalloc(8, 8); int err = nvkCreateWin32SurfaceKHR(data.instance, sci.address(), 0L, surfaceAddr); long surface = MemoryUtil.memGetLong(surfaceAddr); stack.setPointer(ptr); if (err != VK_SUCCESS) { throw new AWTException("Calling vkCreateWin32SurfaceKHR failed with error: " + err); } return surface; } finally { JAWT_DrawingSurface_FreeDrawingSurfaceInfo(dsi, ds.FreeDrawingSurfaceInfo()); } } finally { JAWT_DrawingSurface_Unlock(ds, ds.Unlock()); } } finally { JAWT_FreeDrawingSurface(ds, awt.FreeDrawingSurface()); } }
Example #22
Source File: KeyboardFocusManagerPeerImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") public static boolean shouldFocusOnClick(Component component) { boolean acceptFocusOnClick = false; // A component is generally allowed to accept focus on click // if its peer is focusable. There're some exceptions though. // CANVAS & SCROLLBAR accept focus on click if (component instanceof Canvas || component instanceof Scrollbar) { acceptFocusOnClick = true; // PANEL, empty only, accepts focus on click } else if (component instanceof Panel) { acceptFocusOnClick = (((Panel)component).getComponentCount() == 0); // Other components } else { ComponentPeer peer = (component != null ? component.getPeer() : null); acceptFocusOnClick = (peer != null ? peer.isFocusable() : false); } return acceptFocusOnClick && AWTAccessor.getComponentAccessor().canBeFocusOwner(component); }
Example #23
Source File: CardTable.java From ThinkJavaCode with MIT License | 5 votes |
public static void main(String[] args) { // make the frame JFrame frame = new JFrame("Card Table"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // add the CardTable String cardset = "cardset-oxymoron"; Canvas canvas = new CardTable(cardset); frame.getContentPane().add(canvas); // show the frame frame.pack(); frame.setVisible(true); }
Example #24
Source File: bug8032667.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public void init() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final Image image1 = getImage(getCheckBox("Deselected", false)); final Image image2 = getImage(getCheckBox("Selected", true)); Canvas canvas = new Canvas() { @Override public void paint(Graphics g) { super.paint(g); g.drawImage(image1, 0, 0, scaledWidth, scaledHeight, this); g.drawImage(image2, 0, scaledHeight + 5, scaledWidth, scaledHeight, this); } }; getContentPane().add(canvas, BorderLayout.CENTER); } }); }
Example #25
Source File: CardTable.java From Think-Java-Exercises with GNU General Public License v3.0 | 5 votes |
public static void main(String[] args) { // make the frame JFrame frame = new JFrame("Card Table"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // add the CardTable String cardset = "cardset-oxymoron"; Canvas canvas = new CardTable(cardset); frame.getContentPane().add(canvas); // show the frame frame.pack(); frame.setVisible(true); }
Example #26
Source File: Barcode39.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** Creates a <CODE>java.awt.Image</CODE>. This image only * contains the bars without any text. * @param foreground the color of the bars * @param background the color of the background * @return the image */ public java.awt.Image createAwtImage(Color foreground, Color background) { int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); String bCode = code; if (extended) bCode = getCode39Ex(code); if (generateChecksum) bCode += getChecksum(bCode); int len = bCode.length() + 2; int nn = (int)n; int fullWidth = len * (6 + 3 * nn) + (len - 1); byte bars[] = getBarsCode39(bCode); boolean print = true; int ptr = 0; int height = (int)barHeight; int pix[] = new int[fullWidth * height]; for (int k = 0; k < bars.length; ++k) { int w = (bars[k] == 0 ? 1 : nn); int c = g; if (print) c = f; print = !print; for (int j = 0; j < w; ++j) pix[ptr++] = c; } for (int k = fullWidth; k < pix.length; k += fullWidth) { System.arraycopy(pix, 0, pix, k, fullWidth); } Image img = canvas.createImage(new MemoryImageSource(fullWidth, height, pix, 0, fullWidth)); return img; }
Example #27
Source File: BarcodePDF417.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** * Creates a <CODE>java.awt.Image</CODE>. * * @param foreground the color of the bars * @param background the color of the background * @return the image */ public java.awt.Image createAwtImage(Color foreground, Color background) { int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); paintCode(); int h = (int) yHeight; int pix[] = new int[bitColumns * codeRows * h]; int stride = (bitColumns + 7) / 8; int ptr = 0; for (int k = 0; k < codeRows; ++k) { int p = k * stride; for (int j = 0; j < bitColumns; ++j) { int b = outBits[p + j / 8] & 0xff; b <<= j % 8; pix[ptr++] = (b & 0x80) == 0 ? g : f; } for (int j = 1; j < h; ++j) { System.arraycopy(pix, ptr - bitColumns, pix, ptr + bitColumns * (j - 1), bitColumns); } ptr += bitColumns * (h - 1); } java.awt.Image img = canvas.createImage(new MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns)); return img; }
Example #28
Source File: AppletGameContainer.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see java.applet.Applet#init() */ public void init() { removeAll(); setLayout(new BorderLayout()); setIgnoreRepaint(true); try { Game game = (Game) Class.forName(getParameter("game")).newInstance(); container = new Container(game); canvas = new ContainerPanel(container); displayParent = new Canvas() { public final void addNotify() { super.addNotify(); startLWJGL(); } public final void removeNotify() { destroyLWJGL(); super.removeNotify(); } }; displayParent.setSize(getWidth(), getHeight()); add(displayParent); displayParent.setFocusable(true); displayParent.requestFocus(); displayParent.setIgnoreRepaint(true); setVisible(true); } catch (Exception e) { Log.error(e); throw new RuntimeException("Unable to create game container"); } }
Example #29
Source File: AbstractWordXmlWriter.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * function emulate the overflow hidden behavior on table cell * * @param text * String to check * @param style * style of the text * @param fontFamily * fond of the text * @param cellWidth * the width of the container in points * @return String with truncated words that surpasses the cell width */ public String cropOverflowString( String text, IStyle style, String fontFamily, int cellWidth ) {// TODO: retrieve font type and replace plain with corresponding Font font = new Font( fontFamily, Font.PLAIN, WordUtil.parseFontSize( PropertyUtil.getDimensionValue( style .getProperty( StyleConstants.STYLE_FONT_SIZE ) ) ) ); Canvas c = new Canvas( ); FontMetrics fm = c.getFontMetrics( font ); // conversion from point to advancement point from sample linear // regression: int cellWidthInPointAdv = ( cellWidth * (int) WordUtil.PT_TWIPS - 27 ) / 11; StringBuilder sb = new StringBuilder( text.length( ) + 1 ); int wordEnd = INDEX_NOTFOUND; do { wordEnd = text.indexOf( SPACE ); if ( wordEnd != INDEX_NOTFOUND ) // space found { String word = text.substring( 0, wordEnd ); word = cropOverflowWord( word, fm, cellWidthInPointAdv ); sb.append( word ); sb.append( SPACE ); text = text.substring( wordEnd + 1 ); } } while ( wordEnd != INDEX_NOTFOUND && !EMPTY_STRING.equals( text ) ); sb.append( cropOverflowWord( text, fm, cellWidthInPointAdv ) ); return sb.toString( ); }
Example #30
Source File: ModifierRobotKeyTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void initializeGUI() { frame = new Frame("Test frame"); canvas = new Canvas(); canvas.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent event) { focusGained = true; } }); canvas.addKeyListener(this); frame.setLayout(new BorderLayout()); frame.add(canvas); frame.setSize(200, 200); frame.setVisible(true); }