📄 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 + -