📄 setoption.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SetOption extends JFrame{
private JRadioButton table1,table2,table3,table4;
private ButtonGroup radioGroup;
private String tableName;
private JButton button1;
public SetOption()
{
super("设置要操作的数据表");
tableName=new String("authorisbn");
Container c=getContentPane();
c.setLayout(new FlowLayout());
button1=new JButton("确定");
c.add(button1);
button1.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e)
{
if (table1.isSelected())
{
tableName="authorisbn";
System.out.println("a");
}
else if (table2.isSelected())
{
tableName="authors";
System.out.println("b");
}
else if (table3.isSelected())
{
tableName="publisher";
System.out.println("c");
}
else
{ tableName="titles";
System.out.println("d");
}
// setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dispose();
}
}
);
table1=new JRadioButton("authorisbn",true);
c.add(table1);
table1.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e)
{
tableName="authorisbn";
}
}
);
table2=new JRadioButton("authors",false);
c.add(table2);
table2.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e)
{
tableName="authors";
}
}
);
table3=new JRadioButton("publishers",false);
c.add(table3);
table4=new JRadioButton("titles",false);
c.add(table4);
radioGroup=new ButtonGroup();
radioGroup.add(table1);
radioGroup.add(table2);
radioGroup.add(table3);
radioGroup.add(table4);
// System.out.println(tableName);
setSize(400,400);
show();
}
public void showSetOption()
{
setSize(400,400);
show();
}
public String getTableName()
{
return tableName;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -