package com.vci.ubcs.codeapply; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Frame; 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); } }