Example usage for java.net UnknownHostException getLocalizedMessage

List of usage examples for java.net UnknownHostException getLocalizedMessage

Introduction

In this page you can find the example usage for java.net UnknownHostException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:put.semantic.fcanew.ui.MainWindow.java

/**
 * Creates new form MainWindow/*from  w  w  w  .j a  v a2  s.c  o m*/
 */
public MainWindow() {
    logger.entry();
    logger.trace("INIT");
    try {
        logger.debug("HOST: " + InetAddress.getLocalHost().getCanonicalHostName());
        logger.debug("IP: " + InetAddress.getLocalHost().getHostAddress());
    } catch (UnknownHostException ex) {
    }
    availableCalculatorsModel = new CheckBoxListModel<>(
            Arrays.asList(new RuleCalculator(), new FollowingCalculators(), new ImplicationShapeCalculator(),
                    new EndpointCalculator(), new SatCalculator(), new ConsistencyCalculator()),
            PreferencesProvider.getInstance().getCalculators());
    availableCalculatorsModel.addListDataListener(new ListDataListener() {

        private void save(ListDataEvent e) {
            boolean[] checked = ((CheckBoxListModel<FeatureCalculator>) e.getSource()).getCheckedAsArray();
            PreferencesProvider.getInstance().setCalculators(checked);
        }

        @Override
        public void intervalAdded(ListDataEvent e) {
            save(e);
        }

        @Override
        public void intervalRemoved(ListDataEvent e) {
            save(e);
        }

        @Override
        public void contentsChanged(ListDataEvent e) {
            save(e);
        }
    });
    initComponents();
    normalFont = acceptButton.getFont();
    boldFont = normalFont.deriveFont(Font.BOLD);
    initFiles();
    ((CheckBoxList<FeatureCalculator>) availableCalculators)
            .setTransformer(new CheckBoxList.Transformer<FeatureCalculator>() {

                @Override
                public String transform(FeatureCalculator calc) {
                    return calc.getClass().getSimpleName() + ": " + StringUtils.join(calc.getNames(), ", ");
                }
            });
    classifierConfiguration.getDocument().addDocumentListener(new DocumentListenerHelper() {

        @Override
        protected void update(String text) {
            classifierConfigurationStatus.setText("");
            classifierConfigurationStatus.setForeground(SystemColor.controlText);
            try {
                ((Classifier) classifierToUse.getSelectedItem())
                        .setConfiguration(classifierConfiguration.getText());
                classifierConfigurationStatus.setText("OK");
                classifierConfigurationStatus.setForeground(Color.GREEN);
            } catch (Exception ex) {
                classifierConfigurationStatus.setText(ex.getLocalizedMessage());
                classifierConfigurationStatus.setForeground(Color.RED);
            }
        }
    });
    classifierToUse.setSelectedIndex(PreferencesProvider.getInstance().getClassifier());
    credibilityTreshold.setValue(PreferencesProvider.getInstance().getCredibilityTreshold());
    rejectedWeight.setValue(PreferencesProvider.getInstance().getRejectedWeight());
    CSVExporter.addToAllTables(this);
    if (script != null) {
        runScript();
    }
}