}
catch(ModificationException me) {
int n = AbstractGuiComponent.showCorrectIgnoreOptionDialog(parent, me.getMessage());
if(n == JOptionPane.YES_OPTION) {
(new FocusThread(limitTF)).start();
}
}
}
}
});
if(operator.getLimitValue() > -1) { // if there is a limit value...
this.limitTF.setText("" + operator.getLimitValue()); // set it
}
else { // if there is no limit value...
this.limitTF.setText("-1"); // set "0" as default value
this.limitTF.setEnabled(false); // disable the limit TextField
}
// set new preferred size of the limit TextField...
this.limitTF.setPreferredSize(new Dimension(this.limitTF.getPreferredSize().width + 20, this.limitTF.getPreferredSize().height));
// define listener for limit CheckBox...
limitCB.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ie) {
// get new state...
boolean selected = (ie.getStateChange() == ItemEvent.SELECTED);
elementStatus.put("limit", selected);
limitTF.setEnabled(selected); // enable or disable limit
// TextField according to new
// state
// set limit value in selectOP...
try {
if(!selected) {
operator.setLimitValue("-1");
}
else if(selected) {
operator.setLimitValue(limitTF.getText());
}
}
catch(ModificationException me) {
int n = AbstractGuiComponent.showCorrectIgnoreOptionDialog(parent, me.getMessage());
if(n == JOptionPane.YES_OPTION) {
(new FocusThread(limitTF)).start();
}
}
}
});
limitOffsetPanel.add(this.limitTF); // add limit TextField to row panel
limitOffsetPanel.add(Box.createRigidArea(new Dimension(10, 3))); // spacer
// create offset CheckBox...
JCheckBoxOwnIcon offsetCB = new JCheckBoxOwnIcon("Offset", (operator.getOffsetValue() > -1), this.parent.getFONT());
offsetCB.setOpaque(false);
elementStatus.put("offset", (operator.getOffsetValue() > -1));
limitOffsetPanel.add(offsetCB); // add offset CheckBox to row panel
this.offsetTF.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent fe) {
String content = offsetTF.getText();
if(!content.equals("")) {
try {
operator.setOffsetValue(content);
}
catch(ModificationException me) {
int n = AbstractGuiComponent.showCorrectIgnoreOptionDialog(parent, me.getMessage());
if(n == JOptionPane.YES_OPTION) {
(new FocusThread(offsetTF)).start();
}
}
}
}
});
if(operator.getOffsetValue() > -1) { // if there is an offset value...
this.offsetTF.setText("" + operator.getOffsetValue()); // set it
}
else { // if there is no offset value...
this.offsetTF.setText("0"); // set "0" as default value
this.offsetTF.setEnabled(false); // disable the offset TextField
}
// set new preferred size of the offset TextField...
this.offsetTF.setPreferredSize(new Dimension(this.offsetTF.getPreferredSize().width + 20, this.offsetTF.getPreferredSize().height));
// define listener for offset CheckBox...
offsetCB.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ie) {
// get new state...
boolean selected = (ie.getStateChange() == ItemEvent.SELECTED);
elementStatus.put("offset", selected);
offsetTF.setEnabled(selected); // enable or disable offset
// TextField according to new
// state
// set offset value in selectOP...
try {
if(!selected) {
operator.setOffsetValue("-1");
}
else if(selected) {
operator.setOffsetValue(offsetTF.getText());
}
}
catch(ModificationException me) {
int n = AbstractGuiComponent.showCorrectIgnoreOptionDialog(parent, me.getMessage());
if(n == JOptionPane.YES_OPTION) {
(new FocusThread(offsetTF)).start();
}
}
}
});