Topic: 在JButton上图个小图标!(done)

  Print this page

1.在JButton上图个小图标!(done) Copy to clipboard
Posted by: joelwx
Posted on: 2004-08-25 16:28

ImageIcon icon=new ImageIcon(URL);
icon.paint(Component,Graphics,int x,int y)
Graphics应该写什么??
或者有其他办法?

2.Re:在JButton上图个小图标! [Re: joelwx] Copy to clipboard
Posted by: rolove
Posted on: 2004-08-25 16:44

JButton button =new JButton("查找");
ImageIcon icon= new ImageIcon("12.gif");
button.setIcon(icon);
这个不是画的了。

3.Re:在JButton上图个小图标! [Re: joelwx] Copy to clipboard
Posted by: joelwx
Posted on: 2004-08-25 21:01

it does not work!!!!

4.Re:在JButton上图个小图标!(done) [Re: joelwx] Copy to clipboard
Posted by: joelwx
Posted on: 2004-08-25 21:19

solved

5.Re:在JButton上图个小图标!(done) [Re: joelwx] Copy to clipboard
Posted by: flywithmoon
Posted on: 2004-08-26 09:23

如何在JButton上画一个图形。比如说一个圆。

6.Re:在JButton上图个小图标!(done) [Re: joelwx] Copy to clipboard
Posted by: ljy0000
Posted on: 2004-08-26 10:45

/*
* Copyright Coffee 2004 Your Corporation. All Rights Reserved.
*/

import javax.swing.*;
import java.awt.*;

/**
* @author <a href="mailto:youmail@yourdomain.com">yourname</a> Date: 2004-8-26
*/
public class myIocn implements Icon
{

public int getIconHeight()
{
return 50;
}

public int getIconWidth()
{
return 50;
}

public void paintIcon(Component c, Graphics g, int x, int y)
{
g.setColor(Color.red);
g.drawArc(25,25,25,25,0,360);
}
}

7.Re:在JButton上图个小图标!(done) [Re: joelwx] Copy to clipboard
Posted by: flywithmoon
Posted on: 2004-08-27 15:34

图标都是一个接口,可以自己定义,受教了。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923