SampleResourceBundle.java Source code

Java tutorial

Introduction

Here is the source code for SampleResourceBundle.java

Source

import java.awt.*;
import java.util.*;

public class SampleResourceBundle extends ListResourceBundle {

    public Object[][] getContents() {
        return contents;
    }

    static final Object[][] contents = { { "okButton", new Button("OK") }, { "negativeInteger", new Integer(-1) },
            { "textString", "Thank you for reading our book" } };
}

/////////

public class SimpleResourceBundle_it extends SimpleResourceBundle {

    public Object handleGetObject(String key) {
        if (key.equals("AMMessage"))
            return "Buona mattina";
        if (key.equals("PMMessage"))
            return "Buona sera";

        return null;
    }
}
/////////