protected JPanel createConnectionPanel(final ConnectionDetails cd, final String text) { JPanel cP = new JPanel(); cP.setLayout(new BoxLayout(cP, BoxLayout.X_AXIS)); JLabel lab1 = new JLabel(text + ": "); JTextField conField = new JTextField(25); conField.setText(cd.getUser() + "@" + cd.getHost()); conField.setEditable(false); conField.setFocusable(false); conField.setBackground(lab1.getBackground()); cP.add(lab1); cP.add(conField); return cP; }
protected void init(JPanel customPanel) { setTitle(LanguageBundle.getInstance().getMessage("label.copy")); setModal(true); setResizable(false); JPanel optionPanel = createOptionPanel(); // generic panels JPanel conPanel1 = createConnectionPanel( details1, LanguageBundle.getInstance().getMessage("copy.confirm.source")); JPanel conPanel2 = createConnectionPanel( details2, LanguageBundle.getInstance().getMessage("copy.confirm.target")); JPanel sourceP = createPathPanel(details1.getCurrentPath()); JPanel toP = createToPanel(); JPanel targetP = createPathPanel(details2.getCurrentPath()); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); addLeftToPanel(mainPanel, customPanel); mainPanel.add(Box.createVerticalStrut(3)); addLeftToPanel(mainPanel, conPanel1); addLeftToPanel(mainPanel, sourceP); mainPanel.add(Box.createVerticalStrut(3)); addLeftToPanel(mainPanel, toP); mainPanel.add(Box.createVerticalStrut(3)); addLeftToPanel(mainPanel, conPanel2); addLeftToPanel(mainPanel, targetP); addLeftToPanel(mainPanel, optionPanel); mainPanel.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(2, 5, 2, 5), BorderFactory.createCompoundBorder( BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5)))); JPanel buttonPanel = createButtonPanel(); getContentPane().add(mainPanel, BorderLayout.CENTER); getContentPane().add(buttonPanel, BorderLayout.SOUTH); pack(); setLocationRelativeTo(parent); okB.requestFocus(); }