|
如何使用JSSE实现SSL安全连接(8) JPanel pLabel=new JPanel(new BorderLayout()); Icon icon = UIManager.getIcon("OptionPane.warningIcon"); pLabel.add(new JLabel(icon),BorderLayout.WEST); JTextArea label=new JTextArea("The certificate sent by the server is unknown and not trustable!\n"+ "Do you want to continue creating a SSL connection to that server ?\n\n"+ "Note: If you answer 'Yes' the certificate will be stored in the file\n\n"+ keyStorePath+"\n\n"+ "and the next time treated trustable automatically. If you want to remove\n"+ "the certificate delete the file or use keytool to remove certificates\n"+ "selectively."); label.setEditable(false); label.setBackground(cont.getBackground()); label.setFont(label.getFont().deriveFont(Font.BOLD)); pLabel.add(label,BorderLayout.EAST); GridBagConstraints gc=new GridBagConstraints(); gc.fill=GridBagConstraints.HORIZONTAL; gl.setConstraints(pLabel,gc); pLabel.setBorder(new EmptyBorder(4,4,4,4)); cont.add(pLabel);
Vector choices=new Vector(); for(int i=0; i<chain.length ; i++) { choices.add((i+1)+". certificate of chain"); }
certChain = new JComboBox(choices); certChain.setBackground(cont.getBackground()); certChain.setFont(label.getFont().deriveFont(Font.BOLD)); certChain.addActionListener(this); JPanel pChoice=new JPanel(new BorderLayout()); pChoice.add(certChain); gc=new GridBagConstraints(); gc.fill=GridBagConstraints.HORIZONTAL; gc.insets=new Insets(4,4,4,4); gc.gridy=1; gl.setConstraints(pChoice,gc);
|