用swing实现类似win2000打开文件窗口左边一个竖排的按钮组import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
//import javax.event.*;public class MyApp extends JFrame
{
public MyApp()
{
JButton b1 = new JButton("AAAAAAAA");
JButton b2 = new JButton("AAAAAAAA");
JButton b3 = new JButton("AAAAAAAA");
JButton b4 = new JButton("AAAAAAAA");
JPanel p = new JPanel();
GridLayout g = new GridLayout(4,1);
p.setLayout(g);
g.setVgap(20);
p.add(b1);
p.add(b2);
p.add(b3);
p.add(b4);
getContentPane().add(p,BorderLayout.WEST);
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
dispose();
System.exit(0);
}
});
}
public static void main(String args[])
{
MyApp m = new MyApp();
m.setSize(400,400);
m.show();
}
}
打开文件窗口
看看FileDialog 类
import java.awt.event.*;
import javax.swing.*;
//import javax.event.*;public class MyApp extends JFrame
{
public MyApp()
{
JButton b1 = new JButton("AAAAAAAA");
JButton b2 = new JButton("AAAAAAAA");
JButton b3 = new JButton("AAAAAAAA");
JButton b4 = new JButton("AAAAAAAA");
JPanel p = new JPanel();
GridLayout g = new GridLayout(4,1);
p.setLayout(g);
g.setVgap(20);
p.add(b1);
p.add(b2);
p.add(b3);
p.add(b4);
getContentPane().add(p,BorderLayout.WEST);
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
dispose();
System.exit(0);
}
});
}
public static void main(String args[])
{
MyApp m = new MyApp();
m.setSize(400,400);
m.show();
}
}
打开文件窗口
看看FileDialog 类
可是你注意到没有,jbuilder5的打开文件窗口,按钮是可以保持选取状态的,而且鼠标划过时有浮动效果.
你说的
"
打开文件窗口
看看FileDialog 类"
是什么意思?有帮助吗?我试试。?