android_sdk_tools/src/com/qy/ui/TextToDalog.java
2019-12-31 17:36:28 +08:00

62 lines
1.4 KiB
Java
Executable File

package com.qy.ui;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JButton;
import javax.swing.JTextArea;
import com.qy.Interfaces.DalogAbs;
import javax.swing.JFrame;
import javax.swing.UIManager;
public class TextToDalog extends JFrame {
/**
*
*/
DalogAbs abs;
private static final long serialVersionUID = 1L;
public TextToDalog(String title,String text,DalogAbs abs) {
super(title);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.abs=abs;
initView(text);
}
/**
* @wbp.parser.constructor
*/
public TextToDalog(String title,String text) {
// TODO Auto-generated constructor stub
new TextToDalog(title, text,null);
}
public void initView(String text) {
// TODO Auto-generated constructor stub
setSize(636, 231);
getContentPane().setLayout(null);
JTextArea lblNewLabel = new JTextArea(text);
lblNewLabel.setBackground(UIManager.getColor("Label.background"));
lblNewLabel.setEditable(false);
lblNewLabel.setLineWrap(true);
lblNewLabel.setBounds(42, 37, 438, 106);
getContentPane().add(lblNewLabel);
JButton btnOk = new JButton("ok");
btnOk.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
TextToDalog.this.dispose();
if(abs!=null) {
abs.onSuccess();
}
}
});
btnOk.setBounds(491, 144, 113, 27);
getContentPane().add(btnOk);
setVisible(true);
}
}