use of javax.swing.event.AncestorEvent in project intellij-community by JetBrains.
the class StudyNewProjectPanel method initListeners.
private void initListeners() {
myRefreshButton.addActionListener(new RefreshActionListener());
myCoursesComboBox.addActionListener(new CourseSelectedListener());
setupBrowseButton();
addAncestorListener(new AncestorListenerAdapter() {
@Override
public void ancestorMoved(AncestorEvent event) {
if (!isComboboxInitialized && isVisible()) {
isComboboxInitialized = true;
initCoursesCombobox();
}
CourseInfo selectedCourse = (CourseInfo) myCoursesComboBox.getSelectedItem();
if (selectedCourse == null || selectedCourse.equals(CourseInfo.INVALID_COURSE)) {
setError(CONNECTION_ERROR);
}
}
});
}
use of javax.swing.event.AncestorEvent in project android by JetBrains.
the class SdkUpdaterConfigurable method createComponent.
@Nullable
@Override
public JComponent createComponent() {
myChannelChangedCallback = new Runnable() {
@Override
public void run() {
Channel channel = StudioSettingsController.getInstance().getChannel();
if (myCurrentChannel == null) {
myCurrentChannel = channel;
}
if (!Objects.equal(channel, myCurrentChannel)) {
myCurrentChannel = channel;
myPanel.refresh();
}
}
};
myPanel = new SdkUpdaterConfigPanel(myChannelChangedCallback, new StudioDownloader(), StudioSettingsController.getInstance(), this);
JComponent component = myPanel.getComponent();
component.addAncestorListener(new AncestorListenerAdapter() {
@Override
public void ancestorAdded(AncestorEvent event) {
myChannelChangedCallback.run();
}
});
return myPanel.getComponent();
}
use of javax.swing.event.AncestorEvent in project smile by haifengl.
the class PlotCanvas method initContextMenauAndToolBar.
/**
* Initialize context menu and toolbar.
*/
private void initContextMenauAndToolBar() {
toolbar = new JToolBar();
toolbar.add(new Button(saveAction));
toolbar.add(new Button(printAction));
toolbar.addSeparator();
toolbar.add(new Button(zoomInAction));
toolbar.add(new Button(zoomOutAction));
toolbar.add(new Button(resetAction));
toolbar.addSeparator();
toolbar.add(new Button(enlargePlotAreaAction));
toolbar.add(new Button(shrinkPlotAreaAction));
toolbar.add(new Button(increaseHeightAction));
toolbar.add(new Button(decreaseHeightAction));
toolbar.add(new Button(increaseWidthAction));
toolbar.add(new Button(decreaseWidthAction));
toolbar.addSeparator();
toolbar.add(new Button(propertyAction));
decreaseHeightAction.setEnabled(false);
decreaseWidthAction.setEnabled(false);
//Initialize popup menu.
popup = new JPopupMenu();
popup.add(new JMenuItem(saveAction));
popup.add(new JMenuItem(printAction));
popup.addSeparator();
popup.add(new JMenuItem(zoomInAction));
popup.add(new JMenuItem(zoomOutAction));
popup.add(new JMenuItem(resetAction));
popup.addSeparator();
popup.add(new JMenuItem(enlargePlotAreaAction));
popup.add(new JMenuItem(shrinkPlotAreaAction));
popup.add(new JMenuItem(increaseHeightAction));
popup.add(new JMenuItem(decreaseHeightAction));
popup.add(new JMenuItem(increaseWidthAction));
popup.add(new JMenuItem(decreaseWidthAction));
popup.addSeparator();
popup.add(new JMenuItem(propertyAction));
AncestorListener ancestorListener = new AncestorListener() {
@Override
public void ancestorAdded(AncestorEvent ae) {
boolean inScrollPane = false;
Container parent = getParent();
while (parent != null) {
if (parent instanceof JScrollPane) {
inScrollPane = true;
scrollPane = (JScrollPane) parent;
break;
}
parent = parent.getParent();
}
increaseHeightAction.setEnabled(inScrollPane);
increaseWidthAction.setEnabled(inScrollPane);
}
@Override
public void ancestorRemoved(AncestorEvent ae) {
}
@Override
public void ancestorMoved(AncestorEvent ae) {
}
};
addAncestorListener(ancestorListener);
}
use of javax.swing.event.AncestorEvent in project intellij-elixir by KronicDeth.
the class ElixirCompilerOptionsConfigurable method setupUiListeners.
private void setupUiListeners() {
myConfigureMixButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DataContext context = DataManager.getInstance().getDataContext(myConfigureMixButton);
Settings settings = ObjectUtils.assertNotNull(Settings.KEY.getData(context));
Configurable configurable = settings.find(ElixirExternalToolsConfigurable.ELIXIR_RELATED_TOOLS);
if (configurable != null) {
settings.select(configurable);
}
}
});
myRootPanel.addAncestorListener(new AncestorAdapter() {
@Override
public void ancestorAdded(AncestorEvent event) {
reset();
}
});
}
Aggregations