?? cdquery.java
字號:
//package vivo.mediamanager;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class CdQuery extends JDialog {
public String key;
public int type;
JTextField text;
CdQuery(Frame owner,String title,boolean modal){
super(owner,title,modal);
key=null;
type=0;
setLocation(350,300);
setSize(new Dimension(500,130));
setResizable(false);
Container pane=this.getContentPane();
pane.setLayout(new FlowLayout());
JLabel label1 = new JLabel("需要查詢的關鍵字");
JLabel label2 = new JLabel("關鍵字歸屬的類型");
text = new JTextField(61);
JRadioButton button0 = new JRadioButton("名稱");
button0.setSelected(true);
button0.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
CdQuery.this.type=0;
}
}
);
JRadioButton button1 = new JRadioButton("藝術家");
button1.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
CdQuery.this.type=1;
}
}
);
JRadioButton button2 = new JRadioButton("出版社");
button2.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
CdQuery.this.type=2;
}
}
);
JRadioButton button3 = new JRadioButton("價格");
button3.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
CdQuery.this.type=3;
}
}
);
JRadioButton button4 = new JRadioButton("發行公司");
button4.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
CdQuery.this.type=4;
}
}
);
JRadioButton button5 = new JRadioButton("ISRC");
button5.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
CdQuery.this.type=5;
}
}
);
JPanel radioPane = new JPanel();
radioPane.add(button0);
radioPane.add(button1);
radioPane.add(button2);
radioPane.add(button3);
radioPane.add(button4);
radioPane.add(button5);
ButtonGroup group = new ButtonGroup();
group.add(button0);
group.add(button1);
group.add(button2);
group.add(button3);
group.add(button4);
group.add(button5);
JButton ok = new JButton("確定查詢(O)");
ok.setMnemonic('O');
JButton cancel = new JButton("放棄查詢(C)");
cancel.setMnemonic('C');
ok.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
CdQuery.this.key = CdQuery.this.text.getText();
CdQuery.this.setVisible(false);
}
}
);
cancel.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
CdQuery.this.setVisible(false);
}
}
);
pane.add(label1);
pane.add(text);
pane.add(label2);
pane.add(radioPane);
pane.add(ok);
pane.add(cancel);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -