圆角矩形jlist(带标题) 如题,小弟界面需要这个,请诸位前辈指教,有人解决立刻给分,要源代码。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 package program;import java.awt.Color;import java.awt.Dimension;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.Shape;import java.awt.geom.RoundRectangle2D;import javax.swing.JButton;public class MyButton extends JButton { private Shape shape = null; public int width,height; public MyButton(String text) { super(text); Dimension size = getPreferredSize(); setPreferredSize(size); width=height=size.width = size.height =65; shape = new RoundRectangle2D.Float(0, 0, width-5, height-15, 25, 25); setContentAreaFilled(false); }protected void paintComponent(Graphics g){ Graphics2D g2d = (Graphics2D) g; if (getModel().isArmed()) { g2d.setColor(Color.blue); } else { g2d.setColor(Color.black); } g2d.draw( shape); super.paintComponent(g2d); }protected void paintBorder(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.draw(shape); }public boolean contains(int x, int y) { return shape.contains(x, y); } }在你的程序中生成MyButton的实例,看看是不是你要的 呵呵,楼上给的是按钮,我需要list形势的,谢谢 就是一个圆角矩形那种形状的jlist,其他和普通的list没有区别,这个list的标题在控件的左上,字体稍大。list背景用一种颜色填充,就像一个单一颜色的圆角矩形一样。 Struts json 怎么同时返回 map 和list 值 Vector的removeAllElements() 的工作原理,求高手解答 各位达人,请问我怎么能够从JVM中读取加载的某个包的结构,谢谢! 刷新后如何保留数据? 【高手来帮忙2个问题】jni加载dll文件后,程序中能否手动代码卸载???另外如何让程序代码运行n个小时候退出,1分钟后再重启程序 弱弱的问个菜鸟的继承问题?? 调用顶层类方法? 内部类的问题 怎么在事件响应的时候响应消息? 江湖救急:JBUILDER4.0的注册号和KEY!!多谢了!!! JDK安装一直错误,~~~~~~~~~~~~ 超级难题一道
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.RoundRectangle2D;
import javax.swing.JButton;public class MyButton extends JButton {
private Shape shape = null;
public int width,height; public MyButton(String text) {
super(text);
Dimension size = getPreferredSize();
setPreferredSize(size);
width=height=size.width = size.height =65;
shape = new RoundRectangle2D.Float(0, 0, width-5, height-15, 25, 25);
setContentAreaFilled(false);
}protected void paintComponent(Graphics g){
Graphics2D g2d = (Graphics2D) g;
if (getModel().isArmed()) {
g2d.setColor(Color.blue);
} else {
g2d.setColor(Color.black);
}
g2d.draw( shape);
super.paintComponent(g2d);
}protected void paintBorder(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.draw(shape);
}public boolean contains(int x, int y) {
return shape.contains(x, y);
}
}在你的程序中生成MyButton的实例,看看是不是你要的