@NotNull private static JComponent createInformationPanel(@NotNull final String adapterHomePageUrl) { JLabel label1 = new JLabel("See"); HyperlinkLabel hyperlink = SwingHelper.createWebHyperlink(adapterHomePageUrl); JLabel label2 = new JLabel("for details."); JPanel panel = SwingHelper.newHorizontalPanel( Component.BOTTOM_ALIGNMENT, SwingHelper.newLeftAlignedVerticalPanel(label1, Box.createVerticalStrut(2)), hyperlink, Box.createHorizontalStrut(5), SwingHelper.newLeftAlignedVerticalPanel(label2, Box.createVerticalStrut(2))); return SwingHelper.wrapWithoutStretch(panel); }
public AddAdapterSupportDialog( @NotNull Project project, @NotNull PsiFile psiFileRequestor, @NotNull String assertionFrameworkName, @NotNull List<VirtualFile> adapterSourceFiles, @Nullable String adapterHomePageUrl) { super(project); myProject = project; myAssertFrameworkName = assertionFrameworkName; myAdapterSourceFiles = adapterSourceFiles; myFileRequestor = psiFileRequestor.getVirtualFile(); setModal(true); setTitle("Add " + getAssertFrameworkAdapterName()); myDirectoryTextField = new JTextField(); VirtualFile initialDir = findInitialDir(psiFileRequestor); if (initialDir != null) { myDirectoryTextField.setText(FileUtil.toSystemDependentName(initialDir.getPath())); } // widen preferred size to fit dialog's title myDirectoryTextField.setPreferredSize( new Dimension(350, myDirectoryTextField.getPreferredSize().height)); List<Component> components = Lists.newArrayList(); components.add(createFilesViewPanel(adapterSourceFiles)); components.add(Box.createVerticalStrut(10)); components.add(createSelectDirectoryPanel(project, myDirectoryTextField)); if (adapterHomePageUrl != null) { components.add(Box.createVerticalStrut(10)); components.add(createInformationPanel(adapterHomePageUrl)); } myContent = SwingHelper.newLeftAlignedVerticalPanel(components); setOKButtonText("Add"); super.init(); }