xiejun
2025-01-23 618caa4a9f759fbc871085eca90791e869151bdc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.vci.rmip.code.client.codeapply.Apply410;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
 
import com.vci.base.ui.swing.components.VCIJDialog;
 
public class DescViewDialog extends VCIJDialog {
 
    /**
     *
     */
    private static final long serialVersionUID = 1L;
 
    private JPanel topPanel;
    private JTextArea reasonTextArea = new JTextArea(5,5);
    private JButton cancelBtn = new JButton("关闭");
    private String desc;
    private CodeApplyFor410MainPanel owner = null;
 
    public DescViewDialog(CodeApplyFor410MainPanel owner,String desc){
//        super(frame,true);
        this.owner = owner;
        this.desc = desc;
        this.setModal(true);
    }
 
    public void bulidDialog() {
        init ();
    }
 
    private void init(){
        int width = 550,height = 250;
        int px = (int)(this.owner.getLocationOnScreen().getX());
        int py = (int)(this.owner.getLocationOnScreen().getY());
        int pWidth = this.owner.getBounds().width;
        int pHeight = this.owner.getBounds().height;
        this.setLocation(px + (pWidth - width) / 2, py + (pHeight - height) / 2);
 
        this.setSize(new Dimension(550, 250));
//        this.initDialogSize(600, 250);
        this.setResizable(false);
        this.setTitle("码段码值的详细描述信息");
 
        initUI();
 
        JPanel bottomPanel = new JPanel();
        bottomPanel.add(cancelBtn);
        cancelBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                close();
            }
        });
        this.setLayout(new BorderLayout());
        this.add(topPanel,BorderLayout.CENTER);
        this.add(bottomPanel,BorderLayout.SOUTH);
 
    }
 
    private void close() {
        this.setDialogResult(DialogResult.CANCEL);
        this.setVisible(false);
    }
 
    private void initUI() {
        topPanel = new JPanel();
        topPanel.setLayout(new BorderLayout());
        reasonTextArea.setText(desc);
 
        reasonTextArea.setAutoscrolls(true);
        reasonTextArea.setLineWrap(true);
        JScrollPane scrollPanel = new JScrollPane();
        scrollPanel.setViewportView(reasonTextArea);
        scrollPanel.setAutoscrolls(true);
        topPanel.add(scrollPanel,BorderLayout.CENTER);
    }
 
}