⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class-schedule3.java

📁 java good!
💻 JAVA
字号:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.text.*;
import java.util.*;

public class class-schedule3 extends Frame {

    private int position = 0;
    private static Object location[][] = {
        {"San Mateo, CA",  Locale.US},
        {"Milano, Italia", Locale.ITALY},
        {"Espoo, Suomi",   new Locale("fi", "FI")}
    };

    public class-schedule3() {
        this(null);
    }

    public class-schedule3(Locale loc) {
        super("Java Training");
        if (loc != null) {
            for (int i=0;i<location.length;i++) {
                if (loc.equals((Locale)location[i][1])) {
                    position = i;
                    break;
                }
            }
        }

        ResourceBundle labels = ResourceBundle.getBundle(
            "training-settings-bundle", (Locale)location[position][1]);
        ResourceBundle settings = ResourceBundle.getBundle(
            "training-settings-bundle", (Locale)location[position][1]);

        Image im = getToolkit().getImage(
            getClass().getResource(settings.getString("Map")));
        image-canvas ic = new ImageCanvas(im);

        Panel p = new Panel(new GridLayout(3, 2));
        p.add(new Label(labels.getString("Date")));

        String dateString = settings.getString("Date");
        DateFormat dfInput = DateFormat.getDateInstance(
            DateFormat.LONG, Locale.US);
        DateFormat dfOutput = DateFormat.getDateInstance(
        DateFormat.SHORT, (Locale)location[position][1]);
        String dateLabelString;

        try {
            dateLabelString = dfOutput.format(dfInput.parse(dateString));
        }
        catch (ParseException e) {
            dateLabelString = dateString;
        }
        p.add(new Label(dateLabelString));
        p.add(new Label(labels.getString("Cost")));

        String costString = settings.getString("Cost");
        NumberFormat nfInput  =
        NumberFormat.getNumberInstance(Locale.US);
        NumberFormat nfOutput = NumberFormat.getCurrencyInstance(
          (Locale)location[position][1]);
        String costLabelString;
        try {
            Number n = nfInput.parse(costString);
            costLabelString = nfOutput.format(n.longValue());
        }
        catch (ParseException e) {
            costLabelString = costString;
        }
        p.add(new Label(costLabelString));
        p.add(new Label(labels.getString("Location")));
        p.add(new Label((String)location[position][0]));

        add(new Label(labels.getString("Title"), Label.CENTER),
            BorderLayout.NORTH);
        add(p, BorderLayout.SOUTH);
        ScrollPane sp = new ScrollPane();
        sp.add(ic);
        add(sp, BorderLayout.CENTER);
        setSize(300, 250);
    }

    public static void main(String[] args) {
        for (int i=0;i<location.length;i++) {
            Frame f = new class-schedule3((Locale)location[i][1]);
            f.addWindowListener(
                new WindowAdapter() {
                    public void windowClosing(WindowEvent e) {
                        System.exit(0);
                    }
                }
            );
            f.setVisible(true);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -