use of javax.swing.event.ChangeEvent in project JMRI by JMRI.
the class AudioBufferFrame method layoutFrame.
@Override
@SuppressWarnings("UnnecessaryBoxing")
public void layoutFrame() {
super.layoutFrame();
JPanel p;
JPanel p2;
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
p.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Bundle.getMessage("LabelSample")), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
p2 = new JPanel();
p2.setLayout(new FlowLayout());
p2.add(urlLabel);
p2.add(url);
buttonBrowse.addActionListener(this::browsePressed);
buttonBrowse.setToolTipText(Bundle.getMessage("ToolTipButtonBrowse"));
p2.add(buttonBrowse);
p.add(p2);
p2 = new JPanel();
p2.setLayout(new FlowLayout());
p2.add(stream);
p.add(p2);
// p2 = new JPanel(); p2.setLayout(new FlowLayout());
// p2.add(formatLabel);
// p2.add(format);
// p.add(p2);
main.add(p);
// p = new JPanel();
// p.setBorder(BorderFactory.createCompoundBorder(
// BorderFactory.createTitledBorder("Waveforms"),
// BorderFactory.createEmptyBorder(5, 5, 5, 5)));
//
// JLabel label = new JLabel("Whole sample");
// label.setUI(new VerticalLabelUI());
// p.add(label);
//
// waveForm.setPreferredSize(new Dimension(400, 120));
// p.add(waveForm);
//
// label = new JLabel("Loop-point detail");
// label.setUI(new VerticalLabelUI());
// p.add(label);
//
// AudioWaveFormPanel waveFormLoop = new AudioWaveFormPanel();
// waveFormLoop.setPreferredSize(new Dimension(80, 120));
// p.add(waveFormLoop);
//
// main.add(p);
//
p = new JPanel();
p.setLayout(new FlowLayout());
p.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Bundle.getMessage("LabelLoopPoints")), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
p.add(loopStartLabel);
loopStart.setPreferredSize(new JTextField(8).getPreferredSize());
loopStart.setModel(new SpinnerNumberModel(Long.valueOf(0), Long.valueOf(0), Long.valueOf(Long.MAX_VALUE), Long.valueOf(1)));
loopStart.addChangeListener((ChangeEvent e) -> {
loopEnd.setValue(((Long) loopStart.getValue() < (Long) loopEnd.getValue()) ? loopEnd.getValue() : loopStart.getValue());
});
p.add(loopStart);
p.add(loopEndLabel);
loopEnd.setPreferredSize(new JTextField(8).getPreferredSize());
loopEnd.setModel(new SpinnerNumberModel(Long.valueOf(0), Long.valueOf(0), Long.valueOf(Long.MAX_VALUE), Long.valueOf(1)));
loopEnd.addChangeListener((ChangeEvent e) -> {
loopStart.setValue(((Long) loopEnd.getValue() < (Long) loopStart.getValue()) ? loopEnd.getValue() : loopStart.getValue());
});
p.add(loopEnd);
main.add(p);
p = new JPanel();
JButton apply;
p.add(apply = new JButton(Bundle.getMessage("ButtonApply")));
apply.addActionListener((ActionEvent e) -> {
applyPressed(e);
});
JButton ok;
p.add(ok = new JButton(Bundle.getMessage("ButtonOK")));
ok.addActionListener((ActionEvent e) -> {
applyPressed(e);
frame.dispose();
});
JButton cancel;
p.add(cancel = new JButton(Bundle.getMessage("ButtonCancel")));
cancel.addActionListener((ActionEvent e) -> {
frame.dispose();
});
frame.getContentPane().add(p);
}
use of javax.swing.event.ChangeEvent in project JMRI by JMRI.
the class MemoryIconCoordinateEdit method initSetXY.
@Override
public void initSetXY() {
oldX = pl.getOriginalX();
oldY = pl.getOriginalY();
textX = new javax.swing.JLabel();
textX.setText("X: " + pl.getOriginalX());
textX.setVisible(true);
textY = new javax.swing.JLabel();
textY.setText("Y: " + pl.getOriginalY());
textY.setVisible(true);
SpinnerNumberModel model = new SpinnerNumberModel(0, 0, 10000, 1);
ChangeListener listener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int x = ((Number) spinX.getValue()).intValue();
int y = ((Number) spinY.getValue()).intValue();
pl.setLocation(x, y);
textX.setText(" X: " + pl.getOriginalX());
textY.setText(" Y: " + pl.getOriginalY());
}
};
spinX = new javax.swing.JSpinner(model);
spinX.setValue(Integer.valueOf(pl.getOriginalX()));
spinX.setToolTipText(Bundle.getMessage("EnterXcoord"));
spinX.setMaximumSize(new Dimension(spinX.getMaximumSize().width, spinX.getPreferredSize().height));
spinX.addChangeListener(listener);
model = new javax.swing.SpinnerNumberModel(0, 0, 10000, 1);
spinY = new javax.swing.JSpinner(model);
spinY.setValue(Integer.valueOf(pl.getOriginalY()));
spinY.setToolTipText(Bundle.getMessage("EnterYcoord"));
spinY.setMaximumSize(new Dimension(spinY.getMaximumSize().width, spinY.getPreferredSize().height));
spinY.addChangeListener(listener);
getContentPane().setLayout(new GridBagLayout());
addSpinItems(true);
okButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
int x = ((Number) spinX.getValue()).intValue();
int y = ((Number) spinY.getValue()).intValue();
pl.setLocation(x, y);
textX.setText(" X: " + pl.getOriginalX());
textY.setText(" Y: " + pl.getOriginalY());
dispose();
}
});
okButton.getRootPane().setDefaultButton(okButton);
cancelButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
pl.setLocation(oldX, oldY);
dispose();
}
});
// make large enough to easily move
setMinimumSize(new Dimension(250, 175));
pack();
}
use of javax.swing.event.ChangeEvent in project intellij-plugins by JetBrains.
the class JstdServerSettingsTab method listenForChanges.
private void listenForChanges() {
myPortField.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
update();
}
});
myBrowserTimeoutSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
update();
}
});
myRunnerModeComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
update();
}
});
}
use of javax.swing.event.ChangeEvent in project JMRI by JMRI.
the class VSDManagerFrame method initGUI.
/**
* Build the GUI components
*/
public void initGUI() {
log.debug("initGUI");
this.setTitle(Bundle.getMessage("VSDManagerFrameTitle"));
this.buildMenu();
this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.PAGE_AXIS));
decoderPane = new JPanel();
decoderPane.setLayout(new BoxLayout(decoderPane, BoxLayout.PAGE_AXIS));
decoderBlank = VSDControl.generateBlank();
decoderPane.add(decoderBlank);
volumePane = new JPanel();
volumePane.setLayout(new BoxLayout(volumePane, BoxLayout.LINE_AXIS));
JToggleButton muteButton = new JToggleButton(Bundle.getMessage("MuteButtonLabel"));
JButton addButton = new JButton(Bundle.getMessage("AddButtonLabel"));
JButton closeButton = new JButton(Bundle.getMessage("ButtonClose"));
JSlider volume = new JSlider(0, 100);
volume.setMinorTickSpacing(10);
volume.setPaintTicks(true);
volume.setValue(80);
volume.setPreferredSize(new Dimension(200, 20));
volume.setToolTipText(Bundle.getMessage("MgrVolumeToolTip"));
volume.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
volumeChange(e);
}
});
volumePane.add(new JLabel(Bundle.getMessage("VolumePaneLabel")));
volumePane.add(volume);
volumePane.add(muteButton);
muteButton.setToolTipText(Bundle.getMessage("MgrMuteToolTip"));
muteButton.setMnemonic(Mnemonics.get("MuteButton"));
muteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
muteButtonPressed(e);
}
});
volumePane.add(addButton);
addButton.setToolTipText(Bundle.getMessage("MgrAddButtonToolTip"));
addButton.setMnemonic(Mnemonics.get("AddButton"));
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addButtonPressed(e);
}
});
volumePane.add(closeButton);
closeButton.setToolTipText(Bundle.getMessage("MgrCloseButtonToolTip"));
closeButton.setMnemonic(Mnemonics.get("CloseButton"));
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
closeButtonPressed(e);
}
});
this.add(decoderPane);
this.add(volumePane);
log.debug("pane size + " + decoderPane.getPreferredSize());
this.pack();
this.setVisible(true);
log.debug("done...");
}
use of javax.swing.event.ChangeEvent in project JMRI by JMRI.
the class EcosLocoTableTabAction method createModel.
@Override
protected void createModel() {
dataPanel = new JPanel();
dataTabs = new JTabbedPane();
dataPanel.setLayout(new BorderLayout());
java.util.List<EcosSystemConnectionMemo> list = jmri.InstanceManager.getList(EcosSystemConnectionMemo.class);
if (list != null) {
for (EcosSystemConnectionMemo eMemo : list) {
//We only want to add connections that have an active loco address manager
if (eMemo.getLocoAddressManager() != null) {
TabbedTableItem itemModel = new TabbedTableItem(eMemo.getUserName(), true, eMemo.getLocoAddressManager(), getNewTableAction(eMemo.getUserName(), eMemo));
tabbedTableArray.add(itemModel);
}
}
}
if (tabbedTableArray.size() == 1) {
EcosLocoTableAction table = (EcosLocoTableAction) tabbedTableArray.get(0).getAAClass();
table.addToPanel(this);
dataPanel.add(tabbedTableArray.get(0).getPanel(), BorderLayout.CENTER);
} else {
for (int x = 0; x < tabbedTableArray.size(); x++) {
EcosLocoTableAction table = (EcosLocoTableAction) tabbedTableArray.get(x).getAAClass();
table.addToPanel(this);
dataTabs.addTab(tabbedTableArray.get(x).getItemString(), null, tabbedTableArray.get(x).getPanel(), null);
}
dataTabs.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
setMenuBar(f);
}
});
dataPanel.add(dataTabs, BorderLayout.CENTER);
}
init = true;
}
Aggregations