private JComponent createHeader() { final JPanel panel = new JPanel(new GridBagLayout()); final JLabel headerLabel = new JLabel(toDisplayPath(getContentEntry().getUrl())); headerLabel.setFont(headerLabel.getFont().deriveFont(Font.BOLD)); headerLabel.setOpaque(false); if (getContentEntry().getFile() == null) { headerLabel.setForeground(JBColor.RED); } final IconActionComponent deleteIconComponent = new IconActionComponent(AllIcons.Modules.DeleteContentRoot, AllIcons.Modules.DeleteContentRootRollover, ProjectBundle.message("module.paths.remove.content.tooltip"), new Runnable() { @Override public void run() { myCallback.deleteContentEntry(); } }); final ResizingWrapper wrapper = new ResizingWrapper(headerLabel); panel.add(wrapper, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 0, 0), 0, 0)); panel.add(deleteIconComponent, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 2), 0, 0)); FilePathClipper.install(headerLabel, wrapper); return panel; }
private JComponent createHeader() { final JPanel panel = new JPanel(new GridBagLayout()); final JLabel headerLabel = new JLabel(toDisplayPath(getContentEntry().getUrl())); headerLabel.setFont(headerLabel.getFont().deriveFont(Font.BOLD)); headerLabel.setOpaque(false); if (getContentEntry().getFile() == null) { headerLabel.setForeground(Color.RED); } final IconActionComponent deleteIconComponent = new IconActionComponent(AllIcons.Modules.DeleteContentRoot, AllIcons.Modules.DeleteContentRootRollover, ProjectBundle.message("module.paths.remove.content.tooltip"), new Runnable() { @Override public void run() { myCallback.deleteContentEntry(); } }); final ResizingWrapper wrapper = new ResizingWrapper(headerLabel); panel.add(wrapper, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 0, 0), 0, 0)); panel.add(deleteIconComponent, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 2), 0, 0)); FilePathClipper.install(headerLabel, wrapper); return panel; }
public UnderlinedPathLabel(JLabel wrappedComponent) { super(wrappedComponent); FilePathClipper.install(wrappedComponent, this); }