76 lines
1.9 KiB
Java
76 lines
1.9 KiB
Java
package org.hwo.pulscounter.ui;
|
|
|
|
import javax.swing.JPanel;
|
|
import java.awt.GridBagLayout;
|
|
import javax.swing.JComboBox;
|
|
import java.awt.GridBagConstraints;
|
|
import java.awt.Insets;
|
|
import javax.swing.JSpinner;
|
|
|
|
public class SimpleScriptAddressEditor extends JPanel {
|
|
|
|
AddressRange[] addressRanges = new AddressRange[]{
|
|
new AddressRange("Zähler", 0, 32),
|
|
new AddressRange("Analogspannung", 32, 8),
|
|
new AddressRange("Merker", 40, 24),
|
|
new AddressRange("PullUp Status", 64, 32),
|
|
new AddressRange("Ausgang", 96, 32),
|
|
new AddressRange("Inverter", 128, 32),
|
|
new AddressRange("Variable", 160, 96)
|
|
};
|
|
|
|
/**
|
|
* Create the panel.
|
|
*/
|
|
public SimpleScriptAddressEditor() {
|
|
GridBagLayout gridBagLayout = new GridBagLayout();
|
|
gridBagLayout.columnWidths = new int[]{0, 0, 0};
|
|
gridBagLayout.rowHeights = new int[]{0, 0};
|
|
gridBagLayout.columnWeights = new double[]{1.0, 1.0, Double.MIN_VALUE};
|
|
gridBagLayout.rowWeights = new double[]{1.0, Double.MIN_VALUE};
|
|
setLayout(gridBagLayout);
|
|
|
|
JComboBox comboBox = new JComboBox();
|
|
GridBagConstraints gbc_comboBox = new GridBagConstraints();
|
|
gbc_comboBox.insets = new Insets(0, 0, 0, 5);
|
|
gbc_comboBox.fill = GridBagConstraints.BOTH;
|
|
gbc_comboBox.gridx = 0;
|
|
gbc_comboBox.gridy = 0;
|
|
add(comboBox, gbc_comboBox);
|
|
|
|
JSpinner spinner = new JSpinner();
|
|
GridBagConstraints gbc_spinner = new GridBagConstraints();
|
|
gbc_spinner.fill = GridBagConstraints.BOTH;
|
|
gbc_spinner.gridx = 1;
|
|
gbc_spinner.gridy = 0;
|
|
add(spinner, gbc_spinner);
|
|
|
|
}
|
|
|
|
|
|
private class AddressRange{
|
|
|
|
private String name;
|
|
private int base;
|
|
private int size;
|
|
|
|
public AddressRange(String name,int base,int size){
|
|
this.name = name;
|
|
this.size = size;
|
|
this.base = base;
|
|
}
|
|
|
|
public int getBase() {
|
|
return base;
|
|
}
|
|
public int getSize() {
|
|
return size;
|
|
}
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
}
|
|
|
|
}
|