import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import javax.swing.JFrame;
import com.lovo.netCRM.component.LovoButton;
import com.lovo.netCRM.component.LovoTxt;
import com.lovo.netCRM.component.LovoTxtArea;
public class MyFrame extends JFrame {
static Properties pro = new Properties();
static {
try {
pro.load(new FileReader("info"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private LovoTxt txt = new LovoTxt("", 30, 50, this);
private LovoButton b = new LovoButton("搜索", 300, 50, this);
private LovoTxtArea c = new LovoTxtArea("", 30, 200, 100, 100, this);
public MyFrame() {
this.setLayout(null);
this.setTitle("有道词典");
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
String g = txt.getText();
String y = pro.getProperty(g);
c.setText(y);
if (y != null) {
c.setText(y);
} else {
c.setText("没有!!!");
}
}
});
this.setSize(500, 400);
this.setVisible(true);
this.setDefaultCloseOperation(3);
this.setLocationRelativeTo(null);
}
public static void main(String[] args) {
MyFrame x = new MyFrame();
}
}
import java.awt.event.ActionListener;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import javax.swing.JFrame;
import com.lovo.netCRM.component.LovoButton;
import com.lovo.netCRM.component.LovoTxt;
import com.lovo.netCRM.component.LovoTxtArea;
public class MyFrame extends JFrame {
static Properties pro = new Properties();
static {
try {
pro.load(new FileReader("info"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private LovoTxt txt = new LovoTxt("", 30, 50, this);
private LovoButton b = new LovoButton("搜索", 300, 50, this);
private LovoTxtArea c = new LovoTxtArea("", 30, 200, 100, 100, this);
public MyFrame() {
this.setLayout(null);
this.setTitle("有道词典");
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
String g = txt.getText();
String y = pro.getProperty(g);
c.setText(y);
if (y != null) {
c.setText(y);
} else {
c.setText("没有!!!");
}
}
});
this.setSize(500, 400);
this.setVisible(true);
this.setDefaultCloseOperation(3);
this.setLocationRelativeTo(null);
}
public static void main(String[] args) {
MyFrame x = new MyFrame();
}
}