Make sure error message updates at start-up
This commit is contained in:
parent
fa27fd0b9a
commit
1a32012aa1
@ -19,6 +19,7 @@ import net.sf.openrocket.util.Color;
|
|||||||
public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfigurator<JavaCode> {
|
public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfigurator<JavaCode> {
|
||||||
private JavaCode extension;
|
private JavaCode extension;
|
||||||
private JTextField classNameField;
|
private JTextField classNameField;
|
||||||
|
private StyledLabel errorMsg;
|
||||||
|
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfig
|
|||||||
panel.add(new JLabel(trans.get("SimulationExtension.javacode.className")), "wrap rel");
|
panel.add(new JLabel(trans.get("SimulationExtension.javacode.className")), "wrap rel");
|
||||||
classNameField = new JTextField(extension.getClassName());
|
classNameField = new JTextField(extension.getClassName());
|
||||||
panel.add(classNameField, "growx, wrap");
|
panel.add(classNameField, "growx, wrap");
|
||||||
StyledLabel errorMsg = new StyledLabel();
|
this.errorMsg = new StyledLabel();
|
||||||
errorMsg.setFontColor(Color.DARK_RED.toAWTColor());
|
errorMsg.setFontColor(Color.DARK_RED.toAWTColor());
|
||||||
errorMsg.setVisible(false);
|
errorMsg.setVisible(false);
|
||||||
panel.add(errorMsg, "growx, wrap");
|
panel.add(errorMsg, "growx, wrap");
|
||||||
@ -52,6 +53,18 @@ public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
|
updateErrorMsg();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
updateErrorMsg();
|
||||||
|
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateErrorMsg() {
|
||||||
|
if (this.errorMsg == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Display error message if the class name is invalid
|
// Display error message if the class name is invalid
|
||||||
String text = classNameField.getText().trim();
|
String text = classNameField.getText().trim();
|
||||||
try {
|
try {
|
||||||
@ -67,10 +80,6 @@ public class JavaCodeConfigurator extends AbstractSwingSimulationExtensionConfig
|
|||||||
errorMsg.setVisible(true);
|
errorMsg.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void close() {
|
protected void close() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user