導航:首頁 > 編程語言 > javaimage類

javaimage類

發布時間:2023-01-14 06:29:44

java里Image數據類型怎麼傳參數給他

傳Image對象
獲取Image對象方式有很多如以下
Image img = Toolkit.getDefaultToolkit.createImage(String filename);
Image img = Toolkit.getDefaultToolkit.createImage(URL url);
Image img = ImageIO.read(File file);
Image img = ImageIO.read(URL url);

② java中BufferedImage圖像有哪幾種類型

Java的BufferedImage類是Image類的子類。屬於一種類型,它是用來處理和操作的圖像數據。

③ java中ImageIcon和Image的區別是什麼

ImageIcon和Image的區別:

ImageIcon:

ImageIcon位於javax.swing包中。可以根據Image繪制Icon(這句話很關鍵),可以使用MediaTracker預載圖像(Image也可以)

構造方法不少,舉幾個常用的:

ImageIcon(Image image);

ImageIcon(String name);

ImageIcon(URL url);

Image:

來自於java.awt包中,抽象類Image是表示圖形圖像的所有類的超類,必須以特定於平台的方式獲取圖像。

它的主要方法是:

Image getScaledInstance(int width,int height,int hints)

④ java.awt.Image類的setScaleInstance()方法是怎樣定義的,參數是什麼

public Image getImage(URL url, String name)

返回能被繪制到屏幕上的 Image 對象。url 參數必須指定絕對 URL。name 參數是相對於 url 參數的說明符。

不管圖像存在與否,此方法總是立刻返回。當此 applet 試圖在屏幕上繪制圖像時,數據將被載入。繪制圖像的圖形圖元將逐漸繪制到屏幕上。

參數:

url - 給出圖像基本位置的絕對 URL。

name - 相對於 url 參數的圖象位置。

返回:

指定 URL 處的圖像。

public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer)

繪制指定圖像中當前可用的圖像。圖像的左上角位於該圖形上下文坐標空間的 (x, y)。圖像中的透明像素不影響該處已存在的像素。

此方法在任何情況下都立刻返回,甚至在圖像尚未完整載入,並且還沒有針對當前輸出設備完成抖動和轉換的情況下也是如此。

如果圖像已經完整載入,並且其像素不再發生更改,則 drawImage 返回 true。否則,drawImage 返回 false,並且隨著更多的圖像可用或者到了繪制動畫另一幀的時候,載入圖像的進程將通知指定的圖像觀察者。

⑤ java如何為image類型賦值

image數據類型是sqlserver中用來存貯變長的二進制數據,取值范圍在跟int數據類型一樣,所以在java中對應的數據類型可以是int,因為是二進制,也可以試試byte[],具體是int還是byte[]好,我沒用過,你可以試試。

⑥ Java:Image和BufferedImage的區別是什麼

Image是一個抽象類,BufferedImage是Image的實現類。
Image和BufferedImage的主要作用就是將一副圖片載入到內存中。
BufferedImage 子類描述具有可訪問圖像數據緩沖區的 Image。BufferedImage 由圖像數據的 ColorModel 和 Raster 組成。Raster 的 SampleModel 中 band 的數量和類型必須與 ColorModel 所要求的數量和類型相匹配,以表示其顏色和 alpha 分量。所有 BufferedImage 對象的左上角坐標都為 (0, 0)。因此,用來構造 BufferedImage 的任何 Raster 都必須滿足:minX=0 且 minY=0。

Java將一副圖片載入到內存中的方法是:

String imgPath = "D://demo.bmp";
BufferedImage image = ImageIO.read(new FileInputStream(imgPath));

該方法BufferedImage 可以獲得圖片的詳細信息,例如:獲得圖片的寬度:image.getWidth(null);圖片只有載入內存中才能對圖片進行進一步的處理。

⑦ 關於java里image的用法

先要設置圖片路徑,我們將一將背景圖片back.jpg放到C盤的img目錄下,調用語句如下:
ImageIcon icon=new ImageIcon("C:\\img\\back.jpg),一定要是雙反斜杠
然後分別在JComponent里添加圖片
JFrame
利用JFrame的一個方法setIconImage(Image image);
由於要用到Image類,所以還得把上面定義的ImageIcon對象轉換成Image對象:
Image image=icon.getImage();
然後就可以調用JFrame的setIconImage(image)方法了。

還要注意一點的是,由於有些圖片的格式JVM不能識別,所以要轉格式,一般為jpg,gif.如把.bmp格式的轉換為.jpg,不能簡單的把後綴名改了就行,這樣照樣不能顯示。方法很簡單,直接用WINDOWS自帶的畫圖工具打開圖片,然後另存為時改為.jpg或.gif格式就可以了。
附源代碼
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.JTree;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import java.awt.FlowLayout;

public class ImageTest extends JFrame{
ImageIcon icon=new ImageIcon("c:\\img\\system.jpg");
Image image=icon.getImage();
public ImageTest()
{
JMenuBar mb=new JMenuBar();
this.setJMenuBar(mb);
JMenu menu=new JMenu("system");
menu.setIcon(icon);
//JMenuItem item=new JMenuItem("exit",icon);
JMenuItem item=new JMenuItem(icon);
item.setIcon(icon);
JLabel label=new JLabel(icon);
//label.setIcon(icon);
menu.add(item);
mb.add(menu);

DefaultMutableTreeNode root=new DefaultMutableTreeNode();
DefaultMutableTreeNode node1=new DefaultMutableTreeNode();
DefaultMutableTreeNode node11=new DefaultMutableTreeNode();
DefaultMutableTreeNode node12=new DefaultMutableTreeNode();
DefaultMutableTreeNode node2=new DefaultMutableTreeNode();
DefaultMutableTreeNode node21=new DefaultMutableTreeNode();
root.add(node1);
root.add(node2);
node1.add(node11);
node1.add(node12);
node2.add(node21);

JTree jTree1 = new javax.swing.JTree(root);
DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
renderer.setOpenIcon(new ImageIcon("C:\\img\\down.jpg")); //展開時節點圖標
renderer.setClosedIcon(new ImageIcon("C:\\img\\file.jpg")); //折疊時節點圖標
renderer.setLeafIcon(new ImageIcon("C:\\img\\man_small.jpg")); //葉子節點圖標
jTree1.setCellRenderer(renderer);
this.add(label);
this.setIconImage(image);

this.add(jTree1);
this.setDefaultCloseOperation(3);
this.setLocation(300,400);
this.pack();
this.setVisible(true);
}
public static void main(String[] args)
{
new ImageTest();
}
}

⑧ image類型怎麼初始化java

ava image類初始化
java image類初始化,無法初始化類javax.imageio.ImageIO

科普君冷知識
轉載
關注
0點贊·753人閱讀
我試圖將一個

spring web應用程序部署到運行在

windows azure上的生產環境中的tomcat 7(嘗試過ubuntu和windows datacenter vm).
遺憾的是,我在生成與

ImageIo一起使用的縮略圖時檢索到錯誤(下面的堆棧跟蹤).
在開發過程中,我也使用了tomcat 7,所以我真的不明白,生產網路伺服器有什麼不同.

當我嘗試通過「ImageIO.scanForPlugins();」載入模塊時exakt同樣的事情發生了.是不是ImageIO或javax.awt通常包含在標準的java7 jre中?

我想在META-INF / services / javax.io中設置一個子文件夾或者在堆模式下運行jvm,但沒有解決下面的問題.我想我現在真的走在牆上,因為我不知道如何解決這個問題.在本地開發環境(Windows 8,Java7 64B,Tomcat7)上,我沒有對上面的這些提示做任何事情(堆模式或類文件),並且一切都運行完美.有這樣的事情,應用程序是在沒有GPU或類似的伺服器上運行的嗎?

感謝您提前回復=)

HTTP Status 500 - Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIOException report

Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:972)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)

javax.servlet.http.HttpServlet.service(HttpServlet.java:646)

javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.servletapi..doFilter(.java:54)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication..doFilter(.java:183)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context..doFilter(.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO

ch.yooapps.resman.service.data.FileServiceImpl.createFile(FileServiceImpl.java:63)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:606)

org.springframework.aop.support.AopUtils.(AopUtils.java:319)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

com.sun.proxy.$Proxy171.createFile(Unknown Source)

ch.yooapps.resman.application.controllers.rest.FileController.attacheFile(FileController.java:61)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:606)

org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)

org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)

org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)

org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)

javax.servlet.http.HttpServlet.service(HttpServlet.java:646)

javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.servletapi..doFilter(.java:54)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication..doFilter(.java:183)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context..doFilter(.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

來自Tomcatlog的Stacktrace:

SEVERE: Servlet.service() for servlet [mvc-dispatcher] in context with path [/rp] threw exception [Handler processing failed; nested exception is java.lang.ExceptionInInitializerError] with root cause

java.lang.NullPointerException

at javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:155)

at javax.imageio.ImageIO.(ImageIO.java:65)

at ch.yooapps.resman.service.data.FileServiceImpl.createFile(FileServiceImpl.java:63)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.aop.support.AopUtils.(AopUtils.java:319)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

at com.sun.proxy.$Proxy47.createFile(Unknown Source)

at ch.yooapps.resman.application.controllers.rest.FileController.attacheFile(FileController.java:61)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)

at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)

at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.servletapi..doFilter(.java:54)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication..doFilter(.java:183)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context..doFilter(.java:87)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:744)

⑨ 在java的image圖片類中畫線怎麼畫

importjava.awt.*;
classMyCanvasextendsCanvas{
publicvoidpaint(Graphicsg){
g.setFont(newFont("華文行楷",Font.PLAIN,20));
g.setColor(Color.RED);
g.drawString("繪圖測試!",20,20);
g.drawLine(30,60,100,60);
g.setColor(Color.BLUE);
g.draw3DRect(60,50,70,30,false);
g.setColor(Color.BLUE);
g.fillArc(0,60,65,65,40,80);
g.setFont(newFont("華文彩雲",Font.PLAIN,30));
g.setColor(Color.PINK);
g.drawString("彩雲之南",20,120);
}
}

publicclassAWTDrawing{
publicstaticvoidmain(Stringargs[]){
Framef=newFrame("AWT繪圖");
MyCanvasp=newMyCanvas();
f.add(p);
f.setSize(170,170);
f.setBackground(newColor(160,220,220));
f.setVisible(true);
}
}


效果圖(該網站bug315上面還有很多java相關的知識,你可以去學習一下呵呵):

⑩ java.awt.Image類

public Image getImage(URL url, String name)

返回能被繪制到屏幕上的 Image 對象。url 參數必須指定絕對 URL。name 參數是相對於 url 參數的說明符。
不管圖像存在與否,此方法總是立刻返回。當此 applet 試圖在屏幕上繪制圖像時,數據將被載入。繪制圖像的圖形圖元將逐漸繪制到屏幕上。

參數:
url - 給出圖像基本位置的絕對 URL。
name - 相對於 url 參數的圖象位置。
返回:
指定 URL 處的圖像。
public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer)
繪制指定圖像中當前可用的圖像。圖像的左上角位於該圖形上下文坐標空間的 (x, y)。圖像中的透明像素不影響該處已存在的像素。
此方法在任何情況下都立刻返回,甚至在圖像尚未完整載入,並且還沒有針對當前輸出設備完成抖動和轉換的情況下也是如此。
如果圖像已經完整載入,並且其像素不再發生更改,則 drawImage 返回 true。否則,drawImage 返回 false,並且隨著更多的圖像可用或者到了繪制動畫另一幀的時候,載入圖像的進程將通知指定的圖像觀察者。

參數:
img - 要繪制的指定圖像。如果 img 為 null,則此方法不執行任何操作。
x - x 坐標。
y - y 坐標。
observer - 轉換了更多圖像時要通知的對象。
返回:
如果圖像像素仍在更改,則返回 false;否則返回 true。

閱讀全文

與javaimage類相關的資料

熱點內容
怎樣把文件夾解壓到磁碟 瀏覽:826
java十進制十六進制轉換 瀏覽:404
安卓手機怎麼關閉識別物品 瀏覽:693
單片機通用燒錄器 瀏覽:55
如何設置catia伺服器開機運行 瀏覽:421
編程術語知多少 瀏覽:347
android模板代碼下載 瀏覽:766
數據與程序員的區別 瀏覽:379
張勤編譯青鳥 瀏覽:989
演出app哪個好 瀏覽:864
鳳凰app推廣開戶哪個好 瀏覽:823
租伺服器要關注什麼 瀏覽:215
shell命令vi 瀏覽:673
javaem演算法 瀏覽:588
閃送app哪裡下載 瀏覽:654
java語言編譯器詞法分析 瀏覽:379
22歲程序員圖片大全 瀏覽:954
ibm如何查看伺服器raid 瀏覽:678
程序員那麼可愛葉子是誰 瀏覽:716
gcc82編譯器入口地址 瀏覽:693