上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 50 下一页
摘要: This example demonstrates a 3x3 kernel that embosses an image. 阅读全文
posted @ 2018-09-02 21:46 borter 阅读(245) 评论(0) 推荐(0) 编辑
摘要: This example demonstrates how to create a filter that can modify any of the RGB pixel values in an image. Here's some code that uses the filter: 阅读全文
posted @ 2018-09-02 21:46 borter 阅读(257) 评论(0) 推荐(0) 编辑
摘要: To draw on a buffered image, create a graphics context on the buffered image. If the buffered image supports transparency, (see e661 确定图像中是否有透明像素), pi 阅读全文
posted @ 2018-09-02 21:45 borter 阅读(179) 评论(0) 推荐(0) 编辑
摘要: AffineTransform tx = new AffineTransform(); tx.scale(scalex, scaley); tx.shear(shiftx, shifty); tx.translate(x, y); tx.rotate(radians, bufferedImage.getWidth()/2, bufferedImage.getHei... 阅读全文
posted @ 2018-09-02 21:44 borter 阅读(113) 评论(0) 推荐(0) 编辑
摘要: // From an Image image = createImage(new FilteredImageSource(image.getSource(), new CropImageFilter(x, y, w, h))); // From a BufferedImage bufferedImage = bufferedImage.getSubimage... 阅读全文
posted @ 2018-09-02 21:44 borter 阅读(104) 评论(0) 推荐(0) 编辑
摘要: // This method returns an Image object from a buffered image public static Image toImage(BufferedImage bufferedImage) { return Toolkit.getDefaultToolkit().createImage(bufferedImage.g... 阅读全文
posted @ 2018-09-02 21:43 borter 阅读(105) 评论(0) 推荐(0) 编辑
摘要: A buffered image is a type of image whose pixels can be modified. For example, you can draw on a buffered image and then draw the resulting buffered i 阅读全文
posted @ 2018-09-02 21:43 borter 阅读(224) 评论(0) 推荐(0) 编辑
摘要: This example demonstrates how to brighten or darken an RGB buffered image by scaling the red, green, and blue values in the image. If the image is not 阅读全文
posted @ 2018-09-02 21:42 borter 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Shape line = new Line2D.Float(x1, y1, x2, y2); Shape arc = new Arc2D.Float(x, y, w, h, start, extent, type); Shape oval = new Ellipse2D.Float(x, y, w, h); Shape rectangle = new Rectangle2D... 阅读全文
posted @ 2018-09-02 21:38 borter 阅读(110) 评论(0) 推荐(0) 编辑
摘要: AffineTransform tx = new AffineTransform(); tx.scale(scalex, scaley); tx.shear(shiftx, shifty); tx.translate(x, y); tx.rotate(radians); Shape newShape = tx.createTransformedShape(... 阅读全文
posted @ 2018-09-02 21:38 borter 阅读(156) 评论(0) 推荐(0) 编辑
摘要: GeneralPath shape = new GeneralPath(); shape.moveTo(x, y); shape.lineTo(x, y); shape.quadTo(controlPointX, controlPointY, x, y); shape.curveTo(controlPointX1, controlPointY1, controlP... 阅读全文
posted @ 2018-09-02 21:37 borter 阅读(274) 评论(0) 推荐(0) 编辑
摘要: Area shape = new Area(shape1); shape.add(new Area(shape2)); shape.subtract(new Area(shape3)); shape.intersect(new Area(shape4)); shape.exclusiveOr(new Area(shape5)); Related Exa... 阅读全文
posted @ 2018-09-02 21:36 borter 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Shape getTextShape(Graphics2D g2d, String str, Font font) { FontRenderContext frc = g2d.getFontRenderContext(); TextLayout tl = new TextLayout(str, font, frc); return tl.getOut... 阅读全文
posted @ 2018-09-02 21:34 borter 阅读(191) 评论(0) 推荐(0) 编辑
摘要: This example applies a new font and background color to a part of the text. You can apply styles to as many parts of the text as you need. See TextAtt 阅读全文
posted @ 2018-09-02 21:34 borter 阅读(109) 评论(0) 推荐(0) 编辑
摘要: A font family refers to a set of font faces with a related typographic design. For example, the font faces in the family Lucida Sans Typewriter might 阅读全文
posted @ 2018-09-02 21:33 borter 阅读(149) 评论(0) 推荐(0) 编辑
摘要: To create a Font object to draw text, it is necessary to specify the font face name. This example demonstrates how to retrieve all the font face names 阅读全文
posted @ 2018-09-02 21:33 borter 阅读(103) 评论(0) 推荐(0) 编辑
摘要: In order to change the font of the text, you need to supply an attributed string to the LineBreakMeasurer. See e655 混合风格的文本 for an example. 阅读全文
posted @ 2018-09-02 21:30 borter 阅读(127) 评论(0) 推荐(0) 编辑
摘要: component.addMouseListener(new MyMouseListener()); public class MyMouseListener extends MouseAdapter { public void mouseClicked(MouseEvent evt) { if (evt.getClickCoun... 阅读全文
posted @ 2018-09-02 21:29 borter 阅读(145) 评论(0) 推荐(0) 编辑
摘要: You can get the key that was pressed either as a key character (which is a Unicode character) or as a key code (a special value representing a particu 阅读全文
posted @ 2018-09-02 21:28 borter 阅读(93) 评论(0) 推荐(0) 编辑
摘要: component.addMouseMotionListener(new MyMouseMotionListener()); public class MyMouseMotionListener extends MouseMotionAdapter { public void mouseMoved(MouseEvent evt) { ... 阅读全文
posted @ 2018-09-02 21:28 borter 阅读(170) 评论(0) 推荐(0) 编辑
摘要: component.addMouseListener(new MyMouseListener()); public class MyMouseListener extends MouseAdapter { public void mouseClicked(MouseEvent evt) { if ((evt.getModifier... 阅读全文
posted @ 2018-09-02 21:28 borter 阅读(219) 评论(0) 推荐(0) 编辑
摘要: If an event handler is specific to a component (that is, not shared by other components), there is no need to declare a class to handle the event. The 阅读全文
posted @ 2018-09-02 21:24 borter 阅读(146) 评论(0) 推荐(0) 编辑
摘要: An object wishing to fire item events must implement ItemSelectable. This example shows typical code that an object must implement to fire item events 阅读全文
posted @ 2018-09-02 21:24 borter 阅读(129) 评论(0) 推荐(0) 编辑
摘要: component.addFocusListener(new MyFocusListener()); public class MyFocusListener extends FocusAdapter { public void focusGained(FocusEvent evt) { // The component gain... 阅读全文
posted @ 2018-09-02 21:23 borter 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Action events are fired by subclasses of AbstractButton and includes buttons, checkboxes, and menus. 阅读全文
posted @ 2018-09-02 21:14 borter 阅读(234) 评论(0) 推荐(0) 编辑
摘要: public class DropTargetComponent extends JComponent implements DropTargetListener { public DropTargetComponent() { new DropTarget(this, this); } public void dragE... 阅读全文
posted @ 2018-09-02 21:13 borter 阅读(282) 评论(0) 推荐(0) 编辑
摘要: This example demonstrates the code needed to make a component draggable. The object being transferred in this example is a string. 阅读全文
posted @ 2018-09-02 21:12 borter 阅读(141) 评论(0) 推荐(0) 编辑
摘要: The drop target in this example only accepts dropped String objects. A drop target must implement DropTargetListener and supply an implementation for 阅读全文
posted @ 2018-09-02 21:12 borter 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Setting an image on the system clipboard requires a custom Transferable object to hold the image while on the clipboard. 阅读全文
posted @ 2018-09-02 21:11 borter 阅读(306) 评论(0) 推荐(0) 编辑
摘要: This examples defines methods for getting and setting text on the system clipboard. 阅读全文
posted @ 2018-09-02 21:10 borter 阅读(237) 评论(0) 推荐(0) 编辑
摘要: See also e551 精简的Applet. 阅读全文
posted @ 2018-09-02 21:08 borter 阅读(145) 评论(0) 推荐(0) 编辑
摘要: // See also e551 精简的Applet applet.showStatus("Your Message Here"); Related Examples 阅读全文
posted @ 2018-09-02 21:08 borter 阅读(112) 评论(0) 推荐(0) 编辑
摘要: // See also e551 精简的Applet public void init() { // Load audio clip AudioClip ac = getAudioClip(getDocumentBase(), "http://hostname.com/audio.au"); // Play audio clip... 阅读全文
posted @ 2018-09-02 21:07 borter 阅读(144) 评论(0) 推荐(0) 编辑
摘要: try { URL url = new URL("http://hostname/audio.au"); AudioClip ac = Applet.newAudioClip(url); ac.play(); } catch (MalformedURLException e) { } Related Examples ... 阅读全文
posted @ 2018-09-02 21:06 borter 阅读(156) 评论(0) 推荐(0) 编辑
摘要: An applet can be configured through the use of applet parameters. For example, the contents for a news ticker applet could be specified through an app 阅读全文
posted @ 2018-09-02 21:05 borter 阅读(218) 评论(0) 推荐(0) 编辑
摘要: // See also e551 精简的Applet try { URL url = new URL(getDocumentBase(), "http://hostname.com/page.html"); applet.getAppletContext().showDocument(url); } catch (Malformed... 阅读全文
posted @ 2018-09-02 21:05 borter 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Every applet must subclass Applet. Here is an example of an HTML file that will cause the browser to load and start the applet: 阅读全文
posted @ 2018-09-02 21:04 borter 阅读(127) 评论(0) 推荐(0) 编辑
摘要: This is the simplest applet to animate an array of images. In practice, you should use double-buffering (which this example does not use) to eliminate 阅读全文
posted @ 2018-09-02 21:03 borter 阅读(137) 评论(0) 推荐(0) 编辑
摘要: The try/catch statement encloses some code and is used to handle errors and exceptions that might occur in that code. Here is the general syntax of th 阅读全文
posted @ 2018-09-02 21:01 borter 阅读(98) 评论(0) 推荐(0) 编辑
摘要: The if statement encloses some code which is executed only if a condition is true. The general syntax of the if statement is: The if statement has two 阅读全文
posted @ 2018-09-02 20:59 borter 阅读(163) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 50 下一页