java.awt.Image 的使用

2024-04-03 21:38
文章标签 java 使用 image awt

本文主要是介绍java.awt.Image 的使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

使用 Image 的软件包
java.applet提供创建 applet 所必需的类和 applet 用来与其 applet 上下文通信的类。 
java.awt包含用于创建用户界面和绘制图形图像的所有类。 
java.awt.dndDrag 和 Drop 是一种直接操作动作,在许多图形用户界面系统中都会遇到它,它提供了一种机制,能够在两个与 GUI 中显示元素逻辑相关的实体之间传输信息。 
java.awt.font提供与字体相关的类和接口。 
java.awt.im.spi提供启用可以与 Java 运行时环境一起使用的输入方法开发的接口。 
java.awt.image提供创建和修改图像的各种类。 
java.beans包含与开发 beans 有关的类,即基于 JavaBeansTM 架构的组件。 
javax.swing提供一组“轻量级”(全部是 Java 语言)组件,尽量让这些组件在所有平台上的工作方式都相同。 
javax.swing.text.html提供类 HTMLEditorKit 和创建 HTML 文本编辑器的支持类。 
 

java.applet 中 Image 的使用
 
返回 Image 的 java.applet 中的方法
 ImageAppletContext.getImage(URL url) 
          返回能被绘制到屏幕上的 Image 对象。
 ImageApplet.getImage(URL url) 
          返回能被绘制到屏幕上的 Image 对象。
 ImageApplet.getImage(URL url, String name) 
          返回能被绘制到屏幕上的 Image 对象。
 

java.awt 中 Image 的使用
 
声明为 Image 的 java.awt 中的字段
protected  ImageComponent.FlipBufferStrategy.drawBuffer 
          绘制缓冲区。
 
返回 Image 的 java.awt 中的方法
 ImageToolkit.createImage(byte[] imagedata) 
          创建一幅图像,该图像对存储在指定字节数组中的图像进行解码。
abstract  ImageToolkit.createImage(byte[] imagedata, int imageoffset, int imagelength) 
          创建一幅图像,该图像对存储在指定字节数组中指定偏移量和长度处的图像进行解码。
abstract  ImageToolkit.createImage(ImageProducer producer) 
          使用指定的图像生成器创建一幅图像。
 ImageComponent.createImage(ImageProducer producer) 
          根据指定的图像生成器创建一幅图像。
 ImageComponent.createImage(int width, int height) 
          创建一幅用于双缓冲的、可在屏幕外绘制的图像。
abstract  ImageToolkit.createImage(String filename) 
          返回从指定文件获取像素数据的图像。
abstract  ImageToolkit.createImage(URL url) 
          返回一幅图像,该图像从指定 URL 获取像素数据。
protected  ImageComponent.FlipBufferStrategy.getBackBuffer() 
           
 ImageFrame.getIconImage() 
          返回要作为此窗体图标显示的图像。
 ImageTrayIcon.getImage() 
          返回用于此 TrayIcon 的当前图像。
abstract  ImageToolkit.getImage(String filename) 
          返回一幅图像,该图像从指定文件中获取像素数据,图像格式可以是 GIF、JPEG 或 PNG。
abstract  ImageToolkit.getImage(URL url) 
          返回一幅图像,该图像从指定 URL 获取像素数据。
 ImageImage.getScaledInstance(int width, int height, int hints) 
          创建此图像的缩放版本。
 
返回变量类型为 Image 的类型的 java.awt 中的方法
 List<Image>Window.getIconImages() 
          返回要作为此窗口的图标显示的图像序列。
 
参数类型为 Image 的 java.awt 中的方法
 voidMediaTracker.addImage(Image image, int id) 
          向此媒体跟踪器正在跟踪的图像列表添加一个图像。
 voidMediaTracker.addImage(Image image, int id, int w, int h) 
          向此媒体跟踪器正在跟踪的图像列表添加一个经过缩放的图像。
 intComponent.checkImage(Image image, ImageObserver observer) 
          返回指定图像屏幕表示的构造状态。
abstract  intToolkit.checkImage(Image image, int width, int height, ImageObserver observer) 
          指示正准备显示的指定图像的构造状态。
 intComponent.checkImage(Image image, int width, int height, ImageObserver observer) 
          返回指定图像屏幕表示的构造状态。
 CursorToolkit.createCustomCursor(Image cursor, Point hotSpot, String name) 
          创建一个新的自定义光标对象。
abstract  booleanGraphics2D.drawImage(Image img, AffineTransform xform, ImageObserver obs) 
          呈现一个图像,在绘制前进行从图像空间到用户空间的转换。
abstract  booleanGraphics.drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) 
          绘制指定图像中当前可用的图像。
abstract  booleanGraphics.drawImage(Image img, int x, int y, ImageObserver observer) 
          绘制指定图像中当前可用的图像。
abstract  booleanGraphics.drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) 
          绘制指定图像中已缩放到适合指定矩形内部的图像。
abstract  booleanGraphics.drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) 
          绘制指定图像中已缩放到适合指定矩形内部的图像。
abstract  booleanGraphics.drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) 
          绘制当前可用的指定图像的指定区域,动态地缩放图像使其符合目标绘制表面的指定区域。
abstract  booleanGraphics.drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) 
          绘制当前可用的指定图像的指定区域,动态地缩放图像使其符合目标绘制表面的指定区域。
 booleanComponent.imageUpdate(Image img, int infoflags, int x, int y, int w, int h) 
          图像已改变时重绘组件。
 booleanComponent.prepareImage(Image image, ImageObserver observer) 
          准备一幅在此组件上呈现的图像。
abstract  booleanToolkit.prepareImage(Image image, int width, int height, ImageObserver observer) 
          准备一个用于呈现的图像。
 booleanComponent.prepareImage(Image image, int width, int height, ImageObserver observer) 
          以指定的宽度和高度准备一幅在此组件上呈现的图像。
 voidMediaTracker.removeImage(Image image) 
          从此媒体跟踪器移除指定的图像。
 voidMediaTracker.removeImage(Image image, int id) 
          从此媒体跟踪器的指定跟踪 ID 中移除指定的图像。
 voidMediaTracker.removeImage(Image image, int id, int width, int height) 
          从此媒体跟踪器移除具有指定宽度、高度和 ID 的指定图像。
 voidFrame.setIconImage(Image image) 
          设置要作为此窗口图标显示的图像。
 voidWindow.setIconImage(Image image) 
          设置要作为此窗口图标显示的图像。
 voidTrayIcon.setImage(Image image) 
          设置此 TrayIcon 的图像。
 
类型变量类型为 Image 的 java.awt 中的方法参数
 voidWindow.setIconImages(List<? extends Image> icons) 
          设置要作为此窗口的图标显示的图像序列。
 
参数类型为 Image 的 java.awt 中的构造方法
TrayIcon(Image image) 
          创建带有指定图像的 TrayIcon
TrayIcon(Image image, String tooltip) 
          创建带有指定图像和工具提示文本的 TrayIcon
TrayIcon(Image image, String tooltip, PopupMenu popup) 
          创建带指定图像、工具提示和弹出菜单的 TrayIcon
 

java.awt.dnd 中 Image 的使用
 
参数类型为 Image 的 java.awt.dnd 中的方法
protected  DragSourceContextDragSource.createDragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp, DragGestureEvent dgl, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable t,DragSourceListener dsl) 
          创建处理此拖动的 DragSourceContext
 voidDragGestureEvent.startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl) 
          在给定要显示的初始 Cursor、拖动 ImageImage 的偏移量、Transferable 对象和要使用的 DragSourceListener 的情况下开始拖动。
 voidDragSource.startDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point dragOffset, Transferable transferable, DragSourceListener dsl) 
          在给定发起拖动的 DragGestureEvent、使用的初始 Cursor、要拖动的 ImageImage 原点距离触发时 Cursor 热点的偏移量、拖动的目标数据和DragSourceListener 的情况下开始拖动。
 voidDragSource.startDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl, FlavorMap flavorMap) 
          在给定发起拖动的 DragGestureEvent、使用的初始 Cursor、要拖动的 ImageImage 原点距离触发时 Cursor 热点的偏移量、拖动的 Transferable 目标数据、DragSourceListener 和 FlavorMap 的情况下开始拖动。
 
参数类型为 Image 的 java.awt.dnd 中的构造方法
DragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp, DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point offset, Transferable t, DragSourceListener dsl) 
          从 DragSource 调用,此构造方法创建一个新 DragSourceContext,使其具有为此 Drag 指定的 DragSourceContextPeer、触发该 Drag 的 DragGestureEvent、用于该 Drag 的初始 Cursor、进行 Drag 时显示的 Image(可选)、Image 原点与触发事件时距离热点的偏移量、Transferable 目标数据、Drag 和 Drop 操作期间使用的 DragSourceListener
 

java.awt.font 中 Image 的使用
 
参数类型为 Image 的 java.awt.font 中的构造方法
ImageGraphicAttribute(Image image, int alignment) 
          根据指定的 Image 构造一个 ImageGraphicAttribute
ImageGraphicAttribute(Image image, int alignment, float originX, float originY) 
          根据指定的 Image 构造一个 ImageGraphicAttribute
 

java.awt.im.spi 中 Image 的使用
 
返回 Image 的 java.awt.im.spi 中的方法
 ImageInputMethodDescriptor.getInputMethodIcon(Locale inputLocale) 
          返回相应输入方法的图标。
 

java.awt.image 中 Image 的使用
 
java.awt.image 中 Image 的子类
 classBufferedImage 
          BufferedImage 子类描述具有可访问图像数据缓冲区的 Image
 classVolatileImage 
          VolatileImage 是一种图像,它可以在不受应用程序控制的情形下(例如,由操作系统或其他应用程序引起的情况)随时丢失其内容。
 
参数类型为 Image 的 java.awt.image 中的方法
 booleanImageObserver.imageUpdate(Image img, int infoflags, int x, int y, int width, int height) 
          当以前使用异步接口所请求的图像的信息变得可用时就调用此方法。
 
参数类型为 Image 的 java.awt.image 中的构造方法
PixelGrabber(Image img, int x, int y, int w, int h, boolean forceRGB) 
          创建一个 PixelGrabber 对象,以从指定的图像中抓取像素矩形部分 (x, y, w, h)。
PixelGrabber(Image img, int x, int y, int w, int h, int[] pix, int off, int scansize) 
          创建一个 PixelGrabber 对象,以从指定图像将像素矩形部分 (x, y, w, h) 抓取到给定的数组中。
 

java.beans 中 Image 的使用
 
返回 Image 的 java.beans 中的方法
 ImageBeanInfo.getIcon(int iconKind) 
          此方法返回一个图像对象,可用该对象表示工具框、工具栏等中的 bean。
 ImageSimpleBeanInfo.getIcon(int iconKind) 
          声明没有可用的图标。
 ImageSimpleBeanInfo.loadImage(String resourceName) 
          这是帮助加载图标图像的实用工具方法。
 

javax.swing 中 Image 的使用
 
声明为 Image 的 javax.swing 中的字段
protected  ImageJViewport.backingStoreImage 
          用于后备存储的视图图像。
 
返回 Image 的 javax.swing 中的方法
static ImageGrayFilter.createDisabledImage(Image i) 
          创建一个禁用图像
 ImageImageIcon.getImage() 
          返回此图标的 Image
 ImageRepaintManager.getOffscreenBuffer(Component c, int proposedWidth, int proposedHeight) 
          返回屏幕外缓冲区,它应用作带有组件 c 的双缓冲区。
 ImageRepaintManager.getVolatileOffscreenBuffer(Component c, int proposedWidth, int proposedHeight) 
          返回可变屏幕外缓冲区,它应用作带有指定组件 c 的双缓冲区。
 
参数类型为 Image 的 javax.swing 中的方法
static ImageGrayFilter.createDisabledImage(Image i) 
          创建一个禁用图像
 booleanDebugGraphics.drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) 
          重写 Graphics.drawImage
 booleanDebugGraphics.drawImage(Image img, int x, int y, ImageObserver observer) 
          重写 Graphics.drawImage
 booleanDebugGraphics.drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) 
          重写 Graphics.drawImage
 booleanDebugGraphics.drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) 
          重写 Graphics.drawImage
 booleanDebugGraphics.drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) 
          重写 Graphics.drawImage
 booleanDebugGraphics.drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) 
          重写 Graphics.drawImage
 booleanAbstractButton.imageUpdate(Image img, int infoflags, int x, int y, int w, int h) 
          重写的此方法在当前 Icon 的 Image 不等于传入的 Image img 时返回 false。
 booleanJLabel.imageUpdate(Image img, int infoflags, int x, int y, int w, int h) 
          如果当前图标的图像不等于传入的图像 img,则重写此方法以返回 false。
protected  voidImageIcon.loadImage(Image image) 
          加载图像,并且只在图像已加载时返回。
 voidJFrame.setIconImage(Image image) 
          设置要作为此窗口图标显示的图像。
 voidImageIcon.setImage(Image image) 
          设置由此图标显示的图像。
 
参数类型为 Image 的 javax.swing 中的构造方法
ImageIcon(Image image) 
          根据图像对象创建一个 ImageIcon。
ImageIcon(Image image, String description) 
          根据图像创建一个 ImageIcon。
 

javax.swing.text.html 中 Image 的使用
 
返回 Image 的 javax.swing.text.html 中的方法
 ImageImageView.getImage() 
          返回要呈现的图像。

这篇关于java.awt.Image 的使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/874049

相关文章

SpringBoot集成Milvus实现数据增删改查功能

《SpringBoot集成Milvus实现数据增删改查功能》milvus支持的语言比较多,支持python,Java,Go,node等开发语言,本文主要介绍如何使用Java语言,采用springboo... 目录1、Milvus基本概念2、添加maven依赖3、配置yml文件4、创建MilvusClient

浅析Java中如何优雅地处理null值

《浅析Java中如何优雅地处理null值》这篇文章主要为大家详细介绍了如何结合Lambda表达式和Optional,让Java更优雅地处理null值,感兴趣的小伙伴可以跟随小编一起学习一下... 目录场景 1:不为 null 则执行场景 2:不为 null 则返回,为 null 则返回特定值或抛出异常场景

SpringMVC获取请求参数的方法

《SpringMVC获取请求参数的方法》:本文主要介绍SpringMVC获取请求参数的方法,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下... 目录1、通过ServletAPI获取2、通过控制器方法的形参获取请求参数3、@RequestParam4、@

shell编程之函数与数组的使用详解

《shell编程之函数与数组的使用详解》:本文主要介绍shell编程之函数与数组的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录shell函数函数的用法俩个数求和系统资源监控并报警函数函数变量的作用范围函数的参数递归函数shell数组获取数组的长度读取某下的

使用Python开发一个带EPUB转换功能的Markdown编辑器

《使用Python开发一个带EPUB转换功能的Markdown编辑器》Markdown因其简单易用和强大的格式支持,成为了写作者、开发者及内容创作者的首选格式,本文将通过Python开发一个Markd... 目录应用概览代码结构与核心组件1. 初始化与布局 (__init__)2. 工具栏 (setup_t

SpringBoot应用中出现的Full GC问题的场景与解决

《SpringBoot应用中出现的FullGC问题的场景与解决》这篇文章主要为大家详细介绍了SpringBoot应用中出现的FullGC问题的场景与解决方法,文中的示例代码讲解详细,感兴趣的小伙伴可... 目录Full GC的原理与触发条件原理触发条件对Spring Boot应用的影响示例代码优化建议结论F

springboot项目中常用的工具类和api详解

《springboot项目中常用的工具类和api详解》在SpringBoot项目中,开发者通常会依赖一些工具类和API来简化开发、提高效率,以下是一些常用的工具类及其典型应用场景,涵盖Spring原生... 目录1. Spring Framework 自带工具类(1) StringUtils(2) Coll

Python虚拟环境终极(含PyCharm的使用教程)

《Python虚拟环境终极(含PyCharm的使用教程)》:本文主要介绍Python虚拟环境终极(含PyCharm的使用教程),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,... 目录一、为什么需要虚拟环境?二、虚拟环境创建方式对比三、命令行创建虚拟环境(venv)3.1 基础命令3

Python Transformer 库安装配置及使用方法

《PythonTransformer库安装配置及使用方法》HuggingFaceTransformers是自然语言处理(NLP)领域最流行的开源库之一,支持基于Transformer架构的预训练模... 目录python 中的 Transformer 库及使用方法一、库的概述二、安装与配置三、基础使用:Pi

关于pandas的read_csv方法使用解读

《关于pandas的read_csv方法使用解读》:本文主要介绍关于pandas的read_csv方法使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录pandas的read_csv方法解读read_csv中的参数基本参数通用解析参数空值处理相关参数时间处理相关