use of java.awt.event.ItemEvent in project intellij-community by JetBrains.
the class SourcePathsStep method createComponentForEmptyRootCase.
private JComponent createComponentForEmptyRootCase() {
final JPanel panel = new JPanel(new GridBagLayout());
final String text = IdeBundle.message("prompt.please.specify.java.sources.directory");
final JLabel label = new JLabel(text);
label.setUI(new MultiLineLabelUI());
panel.add(label, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(8, 10, 0, 10), 0, 0));
myRbCreateSource = new JRadioButton(IdeBundle.message("radio.create.source.directory"), true);
panel.add(myRbCreateSource, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(8, 10, 0, 10), 0, 0));
myTfSourceDirectoryName = new JTextField(suggestSourceDirectoryName());
final JLabel srcPathLabel = new JLabel(IdeBundle.message("prompt.enter.relative.path.to.module.content.root", File.separator));
panel.add(srcPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(8, 30, 0, 0), 0, 0));
final FileChooserDescriptor chooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
chooserDescriptor.withTreeRootVisible(true);
final FieldPanel fieldPanel = createFieldPanel(myTfSourceDirectoryName, null, new BrowsePathListener(myTfSourceDirectoryName, chooserDescriptor));
panel.add(fieldPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(8, 30, 0, 10), 0, 0));
myRbNoSource = new JRadioButton(IdeBundle.message("radio.do.not.create.source.directory"), true);
panel.add(myRbNoSource, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(8, 10, 0, 10), 0, 0));
final JLabel fullPathLabel = new JLabel(IdeBundle.message("label.source.directory"));
panel.add(fullPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, JBUI.insets(8, 10, 0, 10), 0, 0));
myTfFullPath = new JTextField();
myTfFullPath.setEditable(false);
myTfFullPath.setOpaque(false);
final Insets borderInsets = myTfFullPath.getBorder().getBorderInsets(myTfFullPath);
myTfFullPath.setBorder(BorderFactory.createEmptyBorder(borderInsets.top, borderInsets.left, borderInsets.bottom, borderInsets.right));
panel.add(myTfFullPath, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(8, 10), 0, 0));
ButtonGroup group = new ButtonGroup();
group.add(myRbCreateSource);
group.add(myRbNoSource);
myTfSourceDirectoryName.getDocument().addDocumentListener(new DocumentAdapter() {
public void textChanged(DocumentEvent event) {
updateFullPathField();
}
});
myRbCreateSource.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
final boolean enabled = e.getStateChange() == ItemEvent.SELECTED;
srcPathLabel.setEnabled(enabled);
fieldPanel.setEnabled(enabled);
fullPathLabel.setVisible(enabled);
myTfFullPath.setVisible(enabled);
if (enabled) {
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
IdeFocusManager.getGlobalInstance().requestFocus(myTfSourceDirectoryName, true);
});
}
}
});
return panel;
}
use of java.awt.event.ItemEvent in project intellij-community by JetBrains.
the class MoveInnerDialog method init.
protected void init() {
myClassNameField.setText(myInnerClass.getName());
myClassNameField.selectAll();
if (!myInnerClass.hasModifierProperty(PsiModifier.STATIC)) {
myCbPassOuterClass.setSelected(true);
myCbPassOuterClass.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
myParameterField.setEnabled(myCbPassOuterClass.isSelected());
}
});
} else {
myCbPassOuterClass.setSelected(false);
myCbPassOuterClass.setEnabled(false);
myParameterField.setEnabled(false);
}
if (myCbPassOuterClass.isEnabled()) {
boolean thisNeeded = isThisNeeded(myInnerClass, myOuterClass);
myCbPassOuterClass.setSelected(thisNeeded);
myParameterField.setEnabled(thisNeeded);
}
myCbPassOuterClass.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
boolean selected = myCbPassOuterClass.isSelected();
myParameterField.getComponent().setEnabled(selected);
}
});
if (!(myTargetContainer instanceof PsiDirectory)) {
myPackageNameField.setVisible(false);
myPackageNameLabel.setVisible(false);
}
super.init();
}
use of java.awt.event.ItemEvent in project joda-time by JodaOrg.
the class AgeCalculator method addBottomArea.
private void addBottomArea(Container container) {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
ItemListener listener = new ItemListener() {
public void itemStateChanged(ItemEvent e) {
updateResults();
}
};
iFieldSets = new FieldSet[] { new FieldSet("Month Based", new FieldGroup[] { new FieldGroup(listener, "Years", YEARS), new FieldGroup(listener, "Months", MONTHS), new FieldGroup(listener, "Days", DAYS), new FieldGroup(listener, "Hours", HOURS), new FieldGroup(listener, "Minutes", MINUTES), new FieldGroup(listener, "Seconds", SECONDS) }), new FieldSet("Week Based", new FieldGroup[] { new FieldGroup(listener, "Weekyears", WEEKYEARS), new FieldGroup(listener, "Weeks", WEEKS), new FieldGroup(listener, "Days", DAYS), new FieldGroup(listener, "Hours", HOURS), new FieldGroup(listener, "Minutes", MINUTES), new FieldGroup(listener, "Seconds", SECONDS) }) };
for (int i = 0; i < iFieldSets.length; i++) {
if (i > 0) {
panel.add(Box.createHorizontalStrut(10));
}
iFieldSets[i].addTo(panel);
}
panel.add(Box.createVerticalGlue());
container.add(fixedHeight(panel));
}
use of java.awt.event.ItemEvent in project jadx by skylot.
the class JadxSettingsWindow method makeDecompilationGroup.
private SettingsGroup makeDecompilationGroup() {
JCheckBox fallback = new JCheckBox();
fallback.setSelected(settings.isFallbackMode());
fallback.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
settings.setFallbackMode(e.getStateChange() == ItemEvent.SELECTED);
needReload();
}
});
JCheckBox showInconsistentCode = new JCheckBox();
showInconsistentCode.setSelected(settings.isShowInconsistentCode());
showInconsistentCode.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
settings.setShowInconsistentCode(e.getStateChange() == ItemEvent.SELECTED);
needReload();
}
});
JCheckBox resourceDecode = new JCheckBox();
resourceDecode.setSelected(settings.isSkipResources());
resourceDecode.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
settings.setSkipResources(e.getStateChange() == ItemEvent.SELECTED);
needReload();
}
});
final JSpinner threadsCount = new JSpinner();
threadsCount.setValue(settings.getThreadsCount());
threadsCount.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
settings.setThreadsCount((Integer) threadsCount.getValue());
}
});
JCheckBox autoStartJobs = new JCheckBox();
autoStartJobs.setSelected(settings.isAutoStartJobs());
autoStartJobs.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
settings.setAutoStartJobs(e.getStateChange() == ItemEvent.SELECTED);
}
});
JCheckBox escapeUnicode = new JCheckBox();
escapeUnicode.setSelected(settings.escapeUnicode());
escapeUnicode.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
settings.setEscapeUnicode(e.getStateChange() == ItemEvent.SELECTED);
needReload();
}
});
JCheckBox replaceConsts = new JCheckBox();
replaceConsts.setSelected(settings.isReplaceConsts());
replaceConsts.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
settings.setReplaceConsts(e.getStateChange() == ItemEvent.SELECTED);
needReload();
}
});
SettingsGroup other = new SettingsGroup(NLS.str("preferences.decompile"));
other.addRow(NLS.str("preferences.threads"), threadsCount);
other.addRow(NLS.str("preferences.start_jobs"), autoStartJobs);
other.addRow(NLS.str("preferences.showInconsistentCode"), showInconsistentCode);
other.addRow(NLS.str("preferences.escapeUnicode"), escapeUnicode);
other.addRow(NLS.str("preferences.replaceConsts"), replaceConsts);
other.addRow(NLS.str("preferences.fallback"), fallback);
other.addRow(NLS.str("preferences.skipResourcesDecode"), resourceDecode);
return other;
}
use of java.awt.event.ItemEvent in project gephi by gephi.
the class ReportPanel method initGraphTypeCombo.
private void initGraphTypeCombo(final Container[] containers) {
final String directedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.directed");
final String undirectedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.undirected");
final String mixedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.mixed");
EdgeDirectionDefault edd = null;
for (Container container : containers) {
EdgeDirectionDefault d = container.getUnloader().getEdgeDefault();
if (edd == null) {
edd = d;
} else if (d.equals(EdgeDirectionDefault.UNDIRECTED) && !edd.equals(EdgeDirectionDefault.UNDIRECTED)) {
edd = EdgeDirectionDefault.MIXED;
} else if (d.equals(EdgeDirectionDefault.DIRECTED) && !edd.equals(EdgeDirectionDefault.DIRECTED)) {
edd = EdgeDirectionDefault.MIXED;
}
}
final EdgeDirectionDefault dir = edd;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
DefaultComboBoxModel comboModel = new DefaultComboBoxModel();
switch(dir) {
case DIRECTED:
comboModel.addElement(directedStr);
comboModel.addElement(undirectedStr);
comboModel.addElement(mixedStr);
comboModel.setSelectedItem(directedStr);
break;
case UNDIRECTED:
comboModel.addElement(undirectedStr);
comboModel.addElement(mixedStr);
comboModel.setSelectedItem(undirectedStr);
break;
case MIXED:
comboModel.addElement(directedStr);
comboModel.addElement(undirectedStr);
comboModel.addElement(mixedStr);
comboModel.setSelectedItem(mixedStr);
break;
}
graphTypeCombo.setModel(comboModel);
}
});
graphTypeCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
Object g = e.getItem();
if (g.equals(directedStr)) {
for (Container container : containers) {
container.getLoader().setEdgeDefault(EdgeDirectionDefault.DIRECTED);
}
} else if (g.equals(undirectedStr)) {
for (Container container : containers) {
container.getLoader().setEdgeDefault(EdgeDirectionDefault.UNDIRECTED);
}
} else if (g.equals(mixedStr)) {
for (Container container : containers) {
container.getLoader().setEdgeDefault(EdgeDirectionDefault.MIXED);
}
}
}
}
});
}
Aggregations