📄 dialogprogress.java
字号:
package net.aetherial.gis.surface;
import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.event.*;
public class DialogProgress
extends JDialog {
JPanel panel1 = new JPanel();
public JLabel jLabel1 = new JLabel();
public JTextField jTextField1 = new JTextField();
XYLayout xYLayout1 = new XYLayout();
public DialogProgress(Frame frame, String title, boolean modal) {
super(frame, title, modal);
try {
jbInit();
// pack();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public DialogProgress() {
this(null, "", false);
}
/**
* 替换JComponent的show()方法
*/
public void show(){
if (ItemValue.getShowDialogMessage()) {
super.show();
}
}
private void jbInit() throws Exception {
this.setTitle("GPS数据读取进度");
Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
this.setSize(new Dimension(500, 100));
this.toFront();
//this.setModal(true);
this.setLocation(
(screenDim.width - 500) / 2,
(screenDim.height - 100) / 2
);
// this.setIconImage(ItemValue.getImage("HSDIlogo.gif"));
this.addWindowFocusListener(new DialogToFront_this_windowFocusAdapter(this));
this.setResizable(false);
panel1.setLayout(xYLayout1);
jLabel1.setText("正在读取数据...,这将花费一段时间。");
jTextField1.setText("正在读取数据:....");
jTextField1.setEditable(false);
this.setDefaultCloseOperation(javax.swing.WindowConstants.
DO_NOTHING_ON_CLOSE);
getContentPane().add(panel1, BorderLayout.CENTER);
panel1.add(jLabel1, new XYConstraints(21, 14, 258, -1));
panel1.add(jTextField1, new XYConstraints(22, 47, 393, -1));
}
public static void main(String[] args) {
DialogProgress dp = new DialogProgress();
dp.show();
}
}
class DialogToFront_this_windowFocusAdapter
implements java.awt.event.WindowFocusListener {
JDialog adaptee;
DialogToFront_this_windowFocusAdapter(JDialog adaptee) {
this.adaptee = adaptee;
}
public void windowGainedFocus(WindowEvent e) {
}
public void windowLostFocus(WindowEvent e) {
adaptee.toFront();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -