use of javax.swing.JSpinner in project libgdx by libgdx.
the class NumericPanel method initializeComponents.
protected void initializeComponents() {
super.initializeComponents();
JPanel contentPanel = getContentPanel();
{
JLabel label = new JLabel("Value:");
contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
}
{
valueSpinner = new JSpinner(new SpinnerNumberModel(new Float(0), new Float(-99999), new Float(99999), new Float(0.1f)));
contentPanel.add(valueSpinner, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
}
valueSpinner.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent event) {
NumericPanel.this.value.setValue((Float) valueSpinner.getValue());
}
});
}
use of javax.swing.JSpinner in project binnavi by google.
the class PointerTypePanel method createControls.
private void createControls() {
setLayout(new BorderLayout());
final JPanel contentPanel = new JPanel();
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
add(contentPanel, BorderLayout.CENTER);
final GridBagLayout gbl_m_contentPanel = new GridBagLayout();
gbl_m_contentPanel.columnWidths = new int[] { 0, 0, 0 };
gbl_m_contentPanel.rowHeights = new int[] { 0, 0, 0, 0, 0 };
gbl_m_contentPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
gbl_m_contentPanel.rowWeights = new double[] { 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE };
contentPanel.setLayout(gbl_m_contentPanel);
final JLabel lblBaseType = new JLabel("Base type:");
final GridBagConstraints gbc_lblBaseType = new GridBagConstraints();
gbc_lblBaseType.anchor = GridBagConstraints.WEST;
gbc_lblBaseType.insets = new Insets(0, 0, 5, 5);
gbc_lblBaseType.gridx = 0;
gbc_lblBaseType.gridy = 0;
contentPanel.add(lblBaseType, gbc_lblBaseType);
baseTypes = new TypeComboBox(new TypeListModel(typeManager.getTypes(), Predicates.and(new TypeListModel.ArrayTypesFilter(), new TypeListModel.PrototypesFilter())));
baseTypes.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
updatePreview();
}
});
final GridBagConstraints gbc_baseTypes = new GridBagConstraints();
gbc_baseTypes.insets = new Insets(0, 0, 5, 0);
gbc_baseTypes.fill = GridBagConstraints.HORIZONTAL;
gbc_baseTypes.gridx = 1;
gbc_baseTypes.gridy = 0;
contentPanel.add(baseTypes, gbc_baseTypes);
final JLabel lblNewLabel_1 = new JLabel("Pointer level:");
final GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
gbc_lblNewLabel_1.anchor = GridBagConstraints.EAST;
gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
gbc_lblNewLabel_1.gridx = 0;
gbc_lblNewLabel_1.gridy = 1;
contentPanel.add(lblNewLabel_1, gbc_lblNewLabel_1);
pointerLevel = new JSpinner(new SpinnerNumberModel(1, 1, 10, 1));
pointerLevel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
updatePreview();
}
});
final GridBagConstraints gbc_m_pointerLevel = new GridBagConstraints();
gbc_m_pointerLevel.anchor = GridBagConstraints.WEST;
gbc_m_pointerLevel.insets = new Insets(0, 0, 5, 0);
gbc_m_pointerLevel.gridx = 1;
gbc_m_pointerLevel.gridy = 1;
contentPanel.add(pointerLevel, gbc_m_pointerLevel);
final JLabel lblPreview = new JLabel("Preview:");
final GridBagConstraints gbc_lblPreview = new GridBagConstraints();
gbc_lblPreview.insets = new Insets(0, 0, 5, 5);
gbc_lblPreview.gridx = 0;
gbc_lblPreview.gridy = 2;
contentPanel.add(lblPreview, gbc_lblPreview);
preview = new JTextArea();
preview.setEditable(false);
final GridBagConstraints gbc_preview = new GridBagConstraints();
gbc_preview.insets = new Insets(0, 0, 5, 0);
gbc_preview.fill = GridBagConstraints.BOTH;
gbc_preview.gridx = 1;
gbc_preview.gridy = 2;
contentPanel.add(preview, gbc_preview);
}
use of javax.swing.JSpinner in project ats-framework by Axway.
the class SwingElementLocator method findFixture.
public static ComponentFixture<? extends Component> findFixture(UiElement uiElement) {
SwingDriverInternal driver = (SwingDriverInternal) uiElement.getUiDriver();
ContainerFixture<?> containerFixture = (ContainerFixture<?>) driver.getActiveContainerFixture();
Class<? extends Component> componentClass = componentsMap.get(uiElement.getClass());
try {
if (componentClass.equals(JButton.class)) {
return (ComponentFixture<? extends Component>) new JButtonFixture(containerFixture.robot, (JButton) findElement(uiElement));
} else if (componentClass.equals(JTextComponent.class)) {
return (ComponentFixture<? extends Component>) new JTextComponentFixture(containerFixture.robot, (JTextComponent) findElement(uiElement));
} else if (componentClass.equals(JMenuItem.class)) {
if (uiElement.getElementProperty("path") != null) {
return containerFixture.menuItemWithPath(uiElement.getElementProperty("path").split("[\\,\\/]+"));
} else {
return (ComponentFixture<? extends Component>) new JMenuItemFixture(containerFixture.robot, (JMenuItem) findElement(uiElement));
}
} else if (componentClass.equals(JPopupMenu.class)) {
return (ComponentFixture<? extends Component>) new JPopupMenuFixture(containerFixture.robot, (JPopupMenu) findElement(uiElement));
} else if (componentClass.equals(JTree.class)) {
return (ComponentFixture<? extends Component>) new JTreeFixture(containerFixture.robot, (JTree) findElement(uiElement));
} else if (componentClass.equals(JList.class)) {
return (ComponentFixture<? extends Component>) new JListFixture(containerFixture.robot, (JList) findElement(uiElement));
} else if (componentClass.equals(JCheckBox.class)) {
return (ComponentFixture<? extends Component>) new JCheckBoxFixture(containerFixture.robot, (JCheckBox) findElement(uiElement));
} else if (componentClass.equals(JToggleButton.class)) {
return (ComponentFixture<? extends Component>) new JToggleButtonFixture(containerFixture.robot, (JToggleButton) findElement(uiElement));
} else if (componentClass.equals(JComboBox.class)) {
return (ComponentFixture<? extends Component>) new JComboBoxFixture(containerFixture.robot, (JComboBox) findElement(uiElement));
} else if (componentClass.equals(JRadioButton.class)) {
return (ComponentFixture<? extends Component>) new JRadioButtonFixture(containerFixture.robot, (JRadioButton) findElement(uiElement));
} else if (componentClass.equals(JTable.class)) {
return (ComponentFixture<? extends Component>) new JTableFixture(containerFixture.robot, (JTable) findElement(uiElement));
} else if (componentClass.equals(JSpinner.class)) {
return (ComponentFixture<? extends Component>) new JSpinnerFixture(containerFixture.robot, (JSpinner) findElement(uiElement));
} else if (componentClass.equals(JTabbedPane.class)) {
return (ComponentFixture<? extends Component>) new JTabbedPaneFixture(containerFixture.robot, (JTabbedPane) findElement(uiElement));
} else if (componentClass.equals(JOptionPane.class)) {
return (ComponentFixture<? extends Component>) containerFixture.optionPane();
} else if (componentClass.equals(JLabel.class)) {
return (ComponentFixture<? extends Component>) new JLabelFixture(containerFixture.robot, (JLabel) findElement(uiElement));
} else if (componentClass.equals(Component.class)) {
return new ComponentFixture<Component>(containerFixture.robot, findElement(uiElement)) {
};
} else if (componentClass.equals(JFileChooser.class)) {
// TODO - might be searched by name too
return containerFixture.fileChooser(Timeout.timeout(UiEngineConfigurator.getInstance().getElementStateChangeDelay()));
} else {
throw new ElementNotFoundException(uiElement.toString() + " not found. No such Fixture");
}
} catch (ComponentLookupException cle) {
throw new ElementNotFoundException(uiElement.toString() + " not found.", cle);
} catch (WaitTimedOutError exc) {
// thrown for OptionPane search, wait for Window (BasicRobot.waitForWindow), AbstractJTableCellWriter, JTreeDriver.waitForChildrenToShowUp, each Pause wait
throw new ElementNotFoundException(uiElement.toString() + " not found.", exc);
}
}
use of javax.swing.JSpinner in project jadx by skylot.
the class JadxSettingsWindow method makeDeobfuscationGroup.
private SettingsGroup makeDeobfuscationGroup() {
JCheckBox deobfOn = new JCheckBox();
deobfOn.setSelected(settings.isDeobfuscationOn());
deobfOn.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
settings.setDeobfuscationOn(e.getStateChange() == ItemEvent.SELECTED);
needReload();
}
});
JCheckBox deobfForce = new JCheckBox();
deobfForce.setSelected(settings.isDeobfuscationForceSave());
deobfForce.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
settings.setDeobfuscationForceSave(e.getStateChange() == ItemEvent.SELECTED);
needReload();
}
});
final JSpinner minLen = new JSpinner();
minLen.setValue(settings.getDeobfuscationMinLength());
minLen.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
settings.setDeobfuscationMinLength((Integer) minLen.getValue());
needReload();
}
});
final JSpinner maxLen = new JSpinner();
maxLen.setValue(settings.getDeobfuscationMaxLength());
maxLen.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
settings.setDeobfuscationMaxLength((Integer) maxLen.getValue());
needReload();
}
});
JCheckBox deobfSourceAlias = new JCheckBox();
deobfSourceAlias.setSelected(settings.useSourceNameAsClassAlias());
deobfSourceAlias.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
settings.setUseSourceNameAsClassAlias(e.getStateChange() == ItemEvent.SELECTED);
needReload();
}
});
SettingsGroup deobfGroup = new SettingsGroup(NLS.str("preferences.deobfuscation"));
deobfGroup.addRow(NLS.str("preferences.deobfuscation_on"), deobfOn);
deobfGroup.addRow(NLS.str("preferences.deobfuscation_force"), deobfForce);
deobfGroup.addRow(NLS.str("preferences.deobfuscation_min_len"), minLen);
deobfGroup.addRow(NLS.str("preferences.deobfuscation_max_len"), maxLen);
deobfGroup.addRow(NLS.str("preferences.deobfuscation_source_alias"), deobfSourceAlias);
deobfGroup.end();
return deobfGroup;
}
use of javax.swing.JSpinner in project ACS by ACS-Community.
the class BeanGrouper method getFreqSpinner.
/**
* Initializes the TextField that will allow to input the desired Frequency for the Sampling Group.<br>
* By default the value is 10 Hz.<br>
* Also checks for its correctness when the value changes.
* @return javax.swing.JTextField Reference to the Text Field containing the number.
*/
private JSpinner getFreqSpinner() {
if (freqSpinner == null) {
freqSpinner = new JSpinner();
freqSpinner.setToolTipText("How often, in herz, will the sampling occur.");
freqSpinner.setModel(new SpinnerNumberModel(1, 0.1, 20.0, 0.1));
freqSpinner.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
for (DataPrinter dp : samplers) {
double freq = ((SpinnerNumberModel) freqSpinner.getModel()).getNumber().doubleValue();
dp.setFrequency(freq);
}
}
});
}
return freqSpinner;
}
Aggregations