import java.awt.*; 这个Java代码,运行时候没反应,帮我看看哪里错了,谢谢
importjava.awt.*;这个Java代码,运行时候没反应,帮我看看哪里错了,谢谢importjavax.swing.Icon;importjavax.swing...
import java.awt.*;
这个Java代码,运行时候没反应,帮我看看哪里错了,谢谢
import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
public class DrawIcon implements Icon {
int width;
int heigth;
public DrawIcon(int width,int heigth){
this.width=width;
this.heigth=heigth;
}
public int getIconWidth(){
return width;
}
public int getIconHeight(){
return heigth;
}
public void paintIcon( Component arg0 ,Graphics arg1,int x,int y){
arg1.fillOval(x,y,width,heigth);
}
public static void main(String args){
DrawIcon d =new DrawIcon(15,15);
JLabel jl =new JLabel("ceshi " ,d, SwingConstants.CENTER);
JFrame jf=new JFrame();
Container con=jf.getContentPane();
jf.setVisible(true);
}
}
发自 Windows 邮件 展开
这个Java代码,运行时候没反应,帮我看看哪里错了,谢谢
import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
public class DrawIcon implements Icon {
int width;
int heigth;
public DrawIcon(int width,int heigth){
this.width=width;
this.heigth=heigth;
}
public int getIconWidth(){
return width;
}
public int getIconHeight(){
return heigth;
}
public void paintIcon( Component arg0 ,Graphics arg1,int x,int y){
arg1.fillOval(x,y,width,heigth);
}
public static void main(String args){
DrawIcon d =new DrawIcon(15,15);
JLabel jl =new JLabel("ceshi " ,d, SwingConstants.CENTER);
JFrame jf=new JFrame();
Container con=jf.getContentPane();
jf.setVisible(true);
}
}
发自 Windows 邮件 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询