?? menu3_2.java
字號:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.table.*;
public class Menu3_2 extends JFrame implements ActionListener
{
JRadioButton ebox_1=new JRadioButton("近一周");
JRadioButton ebox_2=new JRadioButton("近半月");
JRadioButton ebox_3=new JRadioButton("近一月");
ButtonGroup bg=new ButtonGroup();
JTable tb;
JTabbedPane tab=new JTabbedPane();
String col[]={"編號","書名","作者","出版社","出版日期","價格"};
String rows[][]=new String[15][6];
JScrollPane jsp;
JButton btn_1=new JButton("查詢");
JButton btn_2=new JButton("退出");
public Menu3_2()
{
init();
//-------------------添加監聽者-----------------------------
btn_2.setEnabled(false);//-------------先注掉更新按鈕
btn_1.addActionListener(this);
btn_2.addActionListener(this);
}
public void init()
{
this.setTitle("新書通報");
JPanel jp_1=new JPanel();
bg.add(ebox_1);
bg.add(ebox_2);
bg.add(ebox_3);
jp_1.add(ebox_1);
jp_1.add(ebox_2);
jp_1.add(ebox_3);
JPanel jp_2=new JPanel();
jp_2.add(btn_1);
jp_2.add(btn_2);
JPanel jp_3=new JPanel();
tb=new JTable(rows,col);
jsp=new JScrollPane(tb);
jp_3.setLayout(new BorderLayout());
jp_3.add(jp_1,BorderLayout.NORTH);
jp_3.add(jsp,BorderLayout.CENTER);
jp_3.add(jp_2,BorderLayout.SOUTH);
this.getContentPane().add(jp_3);
this.setLocation(200,00);
this.setSize(400,300);
this.setVisible(true);
JFrame.setDefaultLookAndFeelDecorated(true);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==btn_1)
this.search_NewBook();
if(e.getSource()==btn_2)
this.dispose();
}
public void search_NewBook()
{
}
public static void main(String arg[])
{
JFrame.setDefaultLookAndFeelDecorated(true);
Menu3_2 frm=new Menu3_2();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -