老问题:Button 的效果? 呵呵,没有弹性就不叫Button了:P关注 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果是在JBuilder中可以設置button的border屬性,在代碼中可以用jbutton1.setBorder(border). 如果你是不想它下陷,就干脆不用button嘛,用个JLabel,然后处理它的click事件也行呀。如果是想平的按钮,那用jToggleButton1.setBorderPainted(false);即可。 jToggleButton1.setBorderPainted(false); 如果不行的话,你可以自己定做一个button这样就不会有下陷的效果了反正也挺简单的 我试了一下 jToggleButton1.setBorderPainted(false);我觉得用用jbutton做的效果更加好。不妨试一试!jButton1.setBorderPainted(false);你一定会做好的。 import java.awt.*;import javax.swing.*;public class JButtonTest{ public static void main(String[] args) { JFrame frame=new JFrame("--JButtonTest--"); Container con=frame.getContentPane(); frame.setBounds(100,100,100,80); con.setLayout(new FlowLayout()); frame.setResizable(false); JButton btn=new JButton("JButton_1"); btn.setBorderPainted(false);//*** btn.setFocusPainted(false);//*** btn.setContentAreaFilled(false);//*** con.add(btn); frame.show(); }} 大家帮忙看看程序哈,不会改啊 关于GridLayout的问题 fop格式控制问题 关于使用ScrollPane类创建树形菜单的问题 关于Java调用打印机的问题 请问克隆和赋值的区别(见源码) 使用jbuilder中的一个问题 请大家帮我找找错,Thank you! 如何制作对话框!如:dialog box 图片与servlet的关系 关于jb6.0的问题急急!!请看看 Jbuilder新手问题:可视化设计不按我的要求布局显示!有的甚至不显示,如JList
在代碼中可以用jbutton1.setBorder(border).
jToggleButton1.setBorderPainted(false);
这样就不会有下陷的效果了
反正也挺简单的
jButton1.setBorderPainted(false);你一定会做好的。
import javax.swing.*;
public class JButtonTest
{
public static void main(String[] args)
{
JFrame frame=new JFrame("--JButtonTest--");
Container con=frame.getContentPane();
frame.setBounds(100,100,100,80);
con.setLayout(new FlowLayout());
frame.setResizable(false);
JButton btn=new JButton("JButton_1");
btn.setBorderPainted(false);//***
btn.setFocusPainted(false);//***
btn.setContentAreaFilled(false);//***
con.add(btn);
frame.show();
}
}