mshd.net
当前位置:首页 >> JAvA的imAgEIO读取图片后,怎么把他显示在pAnEl上呢? >>

JAvA的imAgEIO读取图片后,怎么把他显示在pAnEl上呢?

您好:读取bmp文件到BufferedImage中 File file2 = new File("c:\\testimages\\tttt" + ".bmp"); // BufferedImage bi = backstore.getBufferedImage(); try { output = ImageIO.read(file2); } catch (IOException e) { e.printStackTrace(); }...

p4=new JPanel(new BorderLayout()); p2=new JPanel(new CardLayout()); //处理p2,p3,p4 p2_lab1=new JLabel(new ImageIcon("image/21.jpg")); p2_lab2=new JLabel(new ImageIcon("image/22.jpg")); //把以上俩加入到P2中 p2.add(p2_lab1,"0");...

java中获取Panel上某个像素点的像素颜色,代码如下: public static void main(String[] args) {//创建一个150*150,RGB高彩图,类型可自定BufferedImage img=new BufferedImage(150, 150, BufferedImage.TYPE_INT_rgb);//取得图形Graphics g=im...

看看这个是不是你想要的; JPanel jpanel = new JPanel(); BufferedImage image = new BufferedImage(jpanel.getWidth(),jpanel.getHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); jpanel.paint(g2); ImageIO...

g.setColor(Color.BLACK);g.fllRect(0,0,getWidth(),getHeight());

public class GifComponent extends JComponent { private static final long serialVersionUID = 1L; private GifBean[] gifBeans; private Map gifBeanMap = new HashMap(); private int index = 0; private int delayFactor; private Timer t...

根据窗口大小显示图象 import java.awt.*; import java.io.*; import javax.imageio.*; import javax.swing.*; public class ImageTest { public static void main(String[] args) { ImageFrame frame = new ImageFrame(); frame.setDefaultClos...

.setBackground(Color.yourChoseColor); 直接设置小块的背景色不就行了。

不知道这个对你是否有帮助。 public void paintComponent(Graphics g) { int x=0,y=0; java.net.URL imgURL=getClass().getResource("test.jpg"); //test.jpg是测试图片,与Demo.java放在同一目录下 ImageIcon icon=new ImageIcon(imgURL); g.dr...

private static Toolkit tk = Toolkit.getDefaultToolkit(); private static Image im=E.class.getResource("images/6.gif");//E指当前所在类images/6.gif目录 void draw(Graphics g) { Color c = g.getColor(); g.setColor(Color.BLUE); g.draw...

网站首页 | 网站地图
All rights reserved Powered by www.mshd.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com