use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.
the class Java15APIUsageInspection method createOptionsPanel.
@Override
public JComponent createOptionsPanel() {
final JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5, true, false));
panel.add(new JLabel("Forbid API usages:"));
final JRadioButton projectRb = new JRadioButton("Respecting to project language level settings");
panel.add(projectRb);
final JRadioButton customRb = new JRadioButton("Higher than:");
panel.add(customRb);
final ButtonGroup gr = new ButtonGroup();
gr.add(projectRb);
gr.add(customRb);
final DefaultComboBoxModel cModel = new DefaultComboBoxModel();
for (LanguageLevel level : LanguageLevel.values()) {
//noinspection unchecked
cModel.addElement(level);
}
@SuppressWarnings("unchecked") final JComboBox llCombo = new JComboBox(cModel) {
@Override
public void setEnabled(boolean b) {
if (b == customRb.isSelected()) {
super.setEnabled(b);
}
}
};
llCombo.setSelectedItem(myEffectiveLanguageLevel != null ? myEffectiveLanguageLevel : LanguageLevel.JDK_1_3);
//noinspection unchecked
llCombo.setRenderer(new ListCellRendererWrapper<LanguageLevel>() {
@Override
public void customize(JList list, LanguageLevel value, int index, boolean selected, boolean hasFocus) {
if (value != null) {
setText(value.getPresentableText());
}
}
});
llCombo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
myEffectiveLanguageLevel = (LanguageLevel) llCombo.getSelectedItem();
}
});
final JPanel comboPanel = new JPanel(new BorderLayout());
comboPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
comboPanel.add(llCombo, BorderLayout.WEST);
panel.add(comboPanel);
final ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (projectRb.isSelected()) {
myEffectiveLanguageLevel = null;
} else {
myEffectiveLanguageLevel = (LanguageLevel) llCombo.getSelectedItem();
}
UIUtil.setEnabled(comboPanel, !projectRb.isSelected(), true);
}
};
projectRb.addActionListener(actionListener);
customRb.addActionListener(actionListener);
projectRb.setSelected(myEffectiveLanguageLevel == null);
customRb.setSelected(myEffectiveLanguageLevel != null);
UIUtil.setEnabled(comboPanel, !projectRb.isSelected(), true);
return panel;
}
use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.
the class UpdateCopyrightAction method getAdditionalActionSettings.
@Nullable
@Override
protected JComponent getAdditionalActionSettings(Project project, BaseAnalysisActionDialog dialog) {
final JPanel panel = new JPanel(new VerticalFlowLayout());
panel.add(new TitledSeparator());
myUpdateExistingCopyrightsCb = new JCheckBox("Update existing copyrights", PropertiesComponent.getInstance().getBoolean(UPDATE_EXISTING_COPYRIGHTS, true));
panel.add(myUpdateExistingCopyrightsCb);
return panel;
}
use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.
the class ExtractIncludeDialog method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new VerticalFlowLayout());
JLabel nameLabel = new JLabel();
panel.add(nameLabel);
myNameField = new JTextField();
nameLabel.setLabelFor(myNameField);
myNameField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
validateOKButton();
}
});
panel.add(myNameField);
nameLabel.setText(getNameLabel());
myTargetDirLabel = new JLabel();
panel.add(myTargetDirLabel);
myTargetDirectoryField = new TextFieldWithBrowseButton();
myTargetDirectoryField.setText(myCurrentDirectory.getVirtualFile().getPresentableUrl());
myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"), RefactoringBundle.message("select.target.directory.description"), null, FileChooserDescriptorFactory.createSingleFolderDescriptor());
myTargetDirLabel.setText(RefactoringBundle.message("extract.to.directory"));
panel.add(myTargetDirectoryField);
myTargetDirectoryField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
public void textChanged(DocumentEvent event) {
validateOKButton();
}
});
validateOKButton();
return panel;
}
use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.
the class EditorConfigConfigurable method createComponent.
@Nullable
@Override
public JComponent createComponent() {
myEnabled = new JBCheckBox("Enable EditorConfig support");
final JPanel result = new JPanel();
result.setLayout(new BoxLayout(result, BoxLayout.LINE_AXIS));
final JPanel panel = new JPanel(new VerticalFlowLayout());
result.setBorder(IdeBorderFactory.createTitledBorder("EditorConfig", false));
panel.add(myEnabled);
final JLabel warning = new JLabel("EditorConfig may override the IDE code style settings");
warning.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
warning.setBorder(IdeBorderFactory.createEmptyBorder(0, 20, 0, 0));
panel.add(warning);
panel.setAlignmentY(Component.TOP_ALIGNMENT);
result.add(panel);
final JButton export = new JButton("Export");
export.addActionListener((event) -> {
final Component parent = UIUtil.findUltimateParent(result);
if (parent instanceof IdeFrame) {
Utils.export(((IdeFrame) parent).getProject());
}
});
export.setAlignmentY(Component.TOP_ALIGNMENT);
result.add(export);
return result;
}
use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.
the class RestoreReferencesDialog method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
final JPanel panel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));
myList = new JBList(myNamedElements);
myList.setCellRenderer(new FQNameCellRenderer());
panel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER);
panel.add(new JBLabel(myContainsClassesOnly ? CodeInsightBundle.message("dialog.paste.on.import.text") : CodeInsightBundle.message("dialog.paste.on.import.text2"), SMALL, BRIGHTER), BorderLayout.NORTH);
final JPanel buttonPanel = new JPanel(new VerticalFlowLayout());
final JButton okButton = new JButton(CommonBundle.getOkButtonText());
getRootPane().setDefaultButton(okButton);
buttonPanel.add(okButton);
final JButton cancelButton = new JButton(CommonBundle.getCancelButtonText());
buttonPanel.add(cancelButton);
panel.setPreferredSize(JBUI.size(500, 400));
return panel;
}
Aggregations