use of java.awt.event.ItemEvent in project intellij-plugins by JetBrains.
the class RegistrationForm method setupFormActionsAndLF.
private void setupFormActionsAndLF() {
myUseExisting.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
boolean useExisting = myUseExisting.isSelected();
JComponent[] hideableFields = new JComponent[] { myNickname, myNicknameLabel, myFirstName, myFirstNameLabel, myLastName, myLastNameLabel, myPasswordAgain, myPasswordAgainLabel };
for (JComponent hideableField : hideableFields) {
hideableField.setVisible(!useExisting);
}
Window window = SwingUtilities.getWindowAncestor(myPanel);
if (window != null) {
window.pack();
}
}
});
UIUtil.traverse(myPanel, new UIUtil.TraverseAction() {
public boolean executeAndContinue(Component c) {
if (c instanceof JTextComponent) {
JTextComponent textComponent = (JTextComponent) c;
textComponent.getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent e) {
myErrorLabel.setText(null);
}
});
}
return true;
}
});
}
use of java.awt.event.ItemEvent in project beast-mcmc by beast-dev.
the class HierarchicalPriorDialog method showDialog.
public int showDialog(final java.util.List<Parameter> parameterList) {
this.parameterList = parameterList;
this.parameter = parameterList.get(0);
PriorType priorType = parameter.priorType;
// Set-up combo box depending on parameters
priorCombo.removeAllItems();
if (parameter.isNonNegative) {
priorCombo.addItem(PriorType.LOGNORMAL_HPM_PRIOR);
}
priorCombo.addItem(PriorType.NORMAL_HPM_PRIOR);
priorCombo.setSelectedItem(priorType);
double lower = Double.NEGATIVE_INFINITY;
double upper = Double.POSITIVE_INFINITY;
if (parameter.isZeroOne) {
lower = 0.0;
upper = 1.0;
} else if (parameter.isNonNegative) {
lower = 0.0;
}
initialField.setRange(lower, upper);
initialField.setValue(parameter.getInitial());
panel = new JPanel(new GridBagLayout());
setupComponents();
JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setBorder(null);
scrollPane.getViewport().setOpaque(false);
JOptionPane optionPane = new JOptionPane(scrollPane, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null, null);
optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
final JDialog dialog = optionPane.createDialog(frame, "Phylogenetic Hierarchical Model Setup");
priorCombo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
setupComponents();
dialog.validate();
dialog.repaint();
dialog.pack();
}
});
for (PriorOptionsPanel optionsPanel : optionsPanels.values()) {
optionsPanel.addListener(new PriorOptionsPanel.Listener() {
public void optionsPanelChanged() {
setupChart();
dialog.validate();
dialog.repaint();
}
});
}
dialog.pack();
if (OSType.isMac()) {
dialog.setMinimumSize(new Dimension(dialog.getBounds().width, 300));
} else {
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
if (d.height < 700 && panel.getHeight() > 450) {
dialog.setSize(new Dimension(panel.getWidth() + 100, 550));
} else {
// setSize because optionsPanel is shrunk in dialog
dialog.setSize(new Dimension(panel.getWidth() + 100, panel.getHeight() + 100));
}
// System.out.println("panel width = " + panel.getWidth());
// System.out.println("panel height = " + panel.getHeight());
}
dialog.setResizable(true);
dialog.setVisible(true);
int result = JOptionPane.CANCEL_OPTION;
Integer value = (Integer) optionPane.getValue();
if (value != null && value != -1) {
result = value;
}
return result;
}
use of java.awt.event.ItemEvent in project beast-mcmc by beast-dev.
the class PriorSettingsPanel method setParameter.
/**
* Set the parameter to be controlled
* q
* @param parameter
*/
public void setParameter(final Parameter parameter) {
this.parameter = parameter;
priorCombo = new JComboBox();
for (PriorType priorType : PriorType.getPriorTypes(parameter)) {
priorCombo.addItem(priorType);
}
if (parameter.priorType != null) {
priorCombo.setSelectedItem(parameter.priorType);
}
// setArguments here
setupComponents();
priorCombo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
setupComponents();
dialog.pack();
dialog.repaint();
}
});
for (PriorOptionsPanel optionsPanel : optionsPanels.values()) {
optionsPanel.removeAllListeners();
optionsPanel.addListener(new PriorOptionsPanel.Listener() {
public void optionsPanelChanged() {
setupChart();
dialog.pack();
dialog.repaint();
}
});
}
}
use of java.awt.event.ItemEvent in project processdash by dtuma.
the class DashHierarchy method fireDataFileChange.
// Notify all listeners that have registered interest for
// notification on this event type. The event instance
// is created using the parameters passed into the fire method.
// For the moment, the only events that will generate these events are:
// setChildKey/move(CHANGE), copyFrom(CREATE), removeChildKey/remove(DELETE)
protected void fireDataFileChange(PendingDataChange item) {
// Guaranteed to return a non-null array
Object[] listeners = ell.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
ItemEvent fooEvent = new ItemEvent(this, 0, item, 0);
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ItemListener.class) {
((ItemListener) listeners[i + 1]).itemStateChanged(fooEvent);
}
}
}
use of java.awt.event.ItemEvent in project JMRI by JMRI.
the class GuiLafConfigPane method doClickSelection.
void doClickSelection(JPanel panel) {
panel.setLayout(new FlowLayout());
mouseEvent = new JCheckBox(ConfigBundle.getMessage("GUIButtonNonStandardRelease"));
mouseEvent.setSelected(SwingSettings.getNonStandardMouseEvent());
mouseEvent.addItemListener((ItemEvent e) -> {
InstanceManager.getDefault(GuiLafPreferencesManager.class).setNonStandardMouseEvent(mouseEvent.isSelected());
});
panel.add(mouseEvent);
}
Aggregations