use of org.kse.utilities.asn1.Asn1Dump in project keystore-explorer by kaikramer.
the class DViewAsn1Dump method initComponents.
private void initComponents() throws Asn1Exception, IOException {
jbCopy = new JButton(res.getString("DViewAsn1Dump.jbCopy.text"));
PlatformUtil.setMnemonic(jbCopy, res.getString("DViewAsn1Dump.jbCopy.mnemonic").charAt(0));
jbCopy.setToolTipText(res.getString("DViewAsn1Dump.jbCopy.tooltip"));
jbCopy.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DViewAsn1Dump.this);
copyPressed();
} finally {
CursorUtil.setCursorFree(DViewAsn1Dump.this);
}
}
});
jbOK = new JButton(res.getString("DViewAsn1Dump.jbOK.text"));
jbOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
okPressed();
}
});
jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, null, jbCopy, true);
jpAsn1Dump = new JPanel(new BorderLayout());
jpAsn1Dump.setBorder(new EmptyBorder(5, 5, 5, 5));
Asn1Dump asn1Dump = new Asn1Dump();
if (certificate != null) {
jtaAsn1Dump = new JTextArea(asn1Dump.dump(certificate));
} else if (crl != null) {
jtaAsn1Dump = new JTextArea(asn1Dump.dump(crl));
} else if (extension != null) {
jtaAsn1Dump = new JTextArea(asn1Dump.dump(extension));
} else if (privateKey != null) {
jtaAsn1Dump = new JTextArea(asn1Dump.dump(privateKey));
} else if (publicKey != null) {
jtaAsn1Dump = new JTextArea(asn1Dump.dump(publicKey));
} else if (pkcs10Csr != null) {
jtaAsn1Dump = new JTextArea(asn1Dump.dump(pkcs10Csr.getEncoded()));
} else {
jtaAsn1Dump = new JTextArea(asn1Dump.dump(spkac.getEncoded()));
}
jtaAsn1Dump.setCaretPosition(0);
jtaAsn1Dump.setEditable(false);
jtaAsn1Dump.setFont(new Font(Font.MONOSPACED, Font.PLAIN, LnfUtil.getDefaultFontSize()));
// JGoodies - keep uneditable color same as editable
jtaAsn1Dump.putClientProperty("JTextArea.infoBackground", Boolean.TRUE);
jspAsn1Dump = PlatformUtil.createScrollPane(jtaAsn1Dump, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jspAsn1Dump.setPreferredSize(new Dimension(500, 300));
jpAsn1Dump.add(jspAsn1Dump, BorderLayout.CENTER);
getContentPane().add(jpAsn1Dump, BorderLayout.CENTER);
getContentPane().add(jpButtons, BorderLayout.SOUTH);
setResizable(true);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
closeDialog();
}
});
getRootPane().setDefaultButton(jbOK);
pack();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
jbOK.requestFocus();
}
});
}
Aggregations