use of com.intellij.util.ui.GridBag in project intellij-community by JetBrains.
the class CustomFileTypeEditor method createCenterPanel.
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new BorderLayout());
JPanel fileTypePanel = new JPanel(new BorderLayout());
JPanel info = FormBuilder.createFormBuilder().addLabeledComponent(IdeBundle.message("editbox.customfiletype.name"), myFileTypeName).addLabeledComponent(IdeBundle.message("editbox.customfiletype.description"), myFileTypeDescr).getPanel();
info.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
fileTypePanel.add(info, BorderLayout.NORTH);
JPanel highlighterPanel = new JPanel();
highlighterPanel.setBorder(IdeBorderFactory.createTitledBorder(IdeBundle.message("group.customfiletype.syntax.highlighting"), false));
highlighterPanel.setLayout(new BorderLayout());
JPanel commentsAndNumbersPanel = new JPanel();
commentsAndNumbersPanel.setLayout(new GridBagLayout());
JPanel _panel1 = new JPanel(new BorderLayout());
GridBag gb = new GridBag().setDefaultFill(GridBagConstraints.HORIZONTAL).setDefaultAnchor(GridBagConstraints.WEST).setDefaultInsets(1, 5, 1, 5);
commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.line.comment")), gb.nextLine().next());
commentsAndNumbersPanel.add(myLineComment, gb.next());
commentsAndNumbersPanel.add(myCommentAtLineStart, gb.next().coverLine(2));
commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.block.comment.start")), gb.nextLine().next());
commentsAndNumbersPanel.add(myBlockCommentStart, gb.next());
commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.block.comment.end")), gb.next());
commentsAndNumbersPanel.add(myBlockCommentEnd, gb.next());
commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.hex.prefix")), gb.nextLine().next());
commentsAndNumbersPanel.add(myHexPrefix, gb.next());
commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.number.postfixes")), gb.next());
commentsAndNumbersPanel.add(myNumPostfixes, gb.next());
commentsAndNumbersPanel.add(mySupportBraces, gb.nextLine().next().coverLine(2));
commentsAndNumbersPanel.add(mySupportBrackets, gb.next().next().coverLine(2));
commentsAndNumbersPanel.add(mySupportParens, gb.nextLine().next().coverLine(2));
commentsAndNumbersPanel.add(mySupportEscapes, gb.next().next().coverLine(2));
_panel1.add(commentsAndNumbersPanel, BorderLayout.WEST);
highlighterPanel.add(_panel1, BorderLayout.NORTH);
TabbedPaneWrapper tabbedPaneWrapper = new TabbedPaneWrapper(this);
tabbedPaneWrapper.getComponent().setBorder(IdeBorderFactory.createTitledBorder(IdeBundle.message("listbox.customfiletype.keywords"), false));
tabbedPaneWrapper.addTab(" 1 ", createKeywordsPanel(0));
tabbedPaneWrapper.addTab(" 2 ", createKeywordsPanel(1));
tabbedPaneWrapper.addTab(" 3 ", createKeywordsPanel(2));
tabbedPaneWrapper.addTab(" 4 ", createKeywordsPanel(3));
highlighterPanel.add(tabbedPaneWrapper.getComponent(), BorderLayout.CENTER);
highlighterPanel.add(myIgnoreCase, BorderLayout.SOUTH);
fileTypePanel.add(highlighterPanel, BorderLayout.CENTER);
panel.add(fileTypePanel);
for (int i = 0; i < myKeywordsLists.length; i++) {
final int idx = i;
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
edit(idx);
return true;
}
}.installOn(myKeywordsLists[i]);
}
return panel;
}
use of com.intellij.util.ui.GridBag in project intellij-community by JetBrains.
the class ConstructorCountInspection method createOptionsPanel.
@Override
public JComponent createOptionsPanel() {
final JLabel label = new JLabel(getConfigurationLabel());
final JFormattedTextField valueField = prepareNumberEditor("m_limit");
final CheckBox includeCheckBox = new CheckBox(InspectionGadgetsBundle.message("too.many.constructors.ignore.deprecated.option"), this, "ignoreDeprecatedConstructors");
final GridBag bag = new GridBag();
bag.setDefaultInsets(0, 0, 0, UIUtil.DEFAULT_HGAP);
bag.setDefaultAnchor(GridBagConstraints.WEST);
final JPanel panel = new JPanel(new GridBagLayout());
panel.add(label, bag.nextLine().next());
panel.add(valueField, bag.next().weightx(1.0));
panel.add(includeCheckBox, bag.nextLine().next().coverLine().weighty(1.0).anchor(GridBagConstraints.NORTHWEST));
return panel;
}
use of com.intellij.util.ui.GridBag in project intellij-community by JetBrains.
the class GitUserNameNotDefinedDialog method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT);
JLabel description = new JLabel(getMessageText());
myNameTextField = new JTextField(20);
JBLabel nameLabel = new JBLabel("Name: ");
nameLabel.setDisplayedMnemonic('n');
nameLabel.setLabelFor(myNameTextField);
myEmailTextField = new JTextField(20);
JBLabel emailLabel = new JBLabel("E-mail: ");
emailLabel.setDisplayedMnemonic('e');
emailLabel.setLabelFor(myEmailTextField);
if (myProposedValues != null) {
myNameTextField.setText(myProposedValues.getFirst());
myEmailTextField.setText(myProposedValues.getSecond());
} else {
myNameTextField.setText(SystemProperties.getUserName());
}
myGlobalCheckbox = new JBCheckBox("Set properties globally", mySettings.shouldSetUserNameGlobally());
myGlobalCheckbox.setMnemonic('g');
JPanel rootPanel = new JPanel(new GridBagLayout());
GridBag g = new GridBag().setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP)).setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultFill(GridBagConstraints.HORIZONTAL);
rootPanel.add(description, g.nextLine().next().coverLine(3).pady(DEFAULT_HGAP));
rootPanel.add(icon, g.nextLine().next().coverColumn(3));
rootPanel.add(nameLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
rootPanel.add(myNameTextField, g.next());
rootPanel.add(emailLabel, g.nextLine().next().next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
rootPanel.add(myEmailTextField, g.next());
rootPanel.add(myGlobalCheckbox, g.nextLine().next().next().coverLine(2));
return rootPanel;
}
use of com.intellij.util.ui.GridBag in project intellij-community by JetBrains.
the class GitDefineRemoteDialog method createCenterPanel.
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel defineRemoteComponent = new JPanel(new GridBagLayout());
GridBag gb = new GridBag().setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultInsets(UIUtil.DEFAULT_VGAP, UIUtil.DEFAULT_HGAP, 0, 0);
defineRemoteComponent.add(new JBLabel("Name:"), gb.nextLine().next().anchor(GridBagConstraints.EAST));
defineRemoteComponent.add(myRemoteName, gb.next());
defineRemoteComponent.add(new JBLabel("URL: "), gb.nextLine().next().anchor(GridBagConstraints.EAST).insets(0, UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP, 0));
defineRemoteComponent.add(myRemoteUrl, gb.next());
return defineRemoteComponent;
}
use of com.intellij.util.ui.GridBag in project intellij-community by JetBrains.
the class GitNewResetDialog method createCenterPanel.
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new GridBagLayout());
GridBag gb = new GridBag().setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultInsets(0, UIUtil.DEFAULT_HGAP, UIUtil.LARGE_VGAP, 0);
String description = prepareDescription(myProject, myCommits);
panel.add(new JBLabel(XmlStringUtil.wrapInHtml(description)), gb.nextLine().next().coverLine());
String explanation = "This will reset the current branch head to the selected commit, <br/>" + "and update the working tree and the index according to the selected mode:";
panel.add(new JBLabel(XmlStringUtil.wrapInHtml(explanation), UIUtil.ComponentStyle.SMALL), gb.nextLine().next().coverLine());
for (GitResetMode mode : GitResetMode.values()) {
JBRadioButton button = new JBRadioButton(mode.getName());
button.setMnemonic(mode.getName().charAt(0));
myButtonGroup.add(button);
panel.add(button, gb.nextLine().next());
panel.add(new JBLabel(XmlStringUtil.wrapInHtml(mode.getDescription()), UIUtil.ComponentStyle.SMALL), gb.next());
}
myEnumModel = RadioButtonEnumModel.bindEnum(GitResetMode.class, myButtonGroup);
myEnumModel.setSelected(myDefaultMode);
return panel;
}
Aggregations