谢
解决方案 »
- java的垃圾回收机制是完全不可控的,但调用System.gc()后不就会清理内存了吗
- 看看这道多线程程序
- 如何用jdbc存取一个普通对象?
- 关于java oracle 连接池的问题!
- 求下面小题目的代码。
- 求try与return的用法
- 请问这里编码的兄弟,当你解手一个新模块的时候,你是先打好一个框架,把jsp写好,大概的java类实现,还是先把java的功能类的方法写好,
- 如何用java在局域网中得到某电脑的共享目录
- 请问java 修改主机ip的方法
- java 中能不能查找一个表名是中文的的表?
- 怎样开发socket公共调用类
- 在环境变量中如何将我的工作目录设为java编译时寻找原文件的默认路径?
然后你可以在这个类中重写paintComponent,paintBorder等方法
就可以实现你自己喜欢的按钮的类型了
import javax.swing.*;
import com.incors.plaf.alloy.AlloyLookAndFeel;
import java.awt.event.*;class MyFrame extends JFrame{
JButton BB1 = new JButton("button1");
JButton BB2 = new JButton("button2");
public MyFrame(String title){
super(title);
try {
AlloyLookAndFeel.setProperty("alloy.isLookAndFeelFrameDecoration", "true");
LookAndFeel alloyLnF = new AlloyLookAndFeel();
JFrame.setDefaultLookAndFeelDecorated(true);
UIManager.setLookAndFeel(alloyLnF);
} catch (UnsupportedLookAndFeelException ex) {
// You may handle the exception here
}
UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader());
BB1.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e){
JOptionPane.showMessageDialog(MyFrame.this, "BB1 Click!","Info",JOptionPane.INFORMATION_MESSAGE);
}
});
setLayout(null);
add(BB1);
BB1.setBounds(0, 0, 100, 50);
add(BB2);
BB2.setBounds(100, 0, 100, 50);
}
}public class Haluo{
public static void main(String args[]){
MyFrame KK = new MyFrame("hello");
KK.setBounds(100, 100, 400, 300);
KK.setVisible(true);
KK.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}