久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

佛教日歷中的JSpinner日期編輯器

JSpinner Date Editor in Buddhist Calendar(佛教日歷中的JSpinner日期編輯器)
本文介紹了佛教日歷中的JSpinner日期編輯器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

有沒有辦法將 JSpinner.DateEditor 與佛教日歷一起使用?當我將語言環境更改為th"、TH"并重新創建我的日歷時,它們確實是佛教日歷.但是,JSpinners 沒有更新.下面是一些示例代碼:

Is there a way to use JSpinner.DateEditor with a Buddhist Calendar? When I change my locale to "th", "TH" and recreate my calendars they are indeed Buddhist Calendars. However, the JSpinners are not updated. Here is some sample code:

Locale locale = new Locale("th", "TH");
Locale.setDefault(locale);
// Reinitializing calendars with new locale, this is done correctly
encodingCalendar = Calendar.getInstance();
expirationCalendar = Calendar.getInstance();
// Modifying the spinners in another class to update them with the correct locale
// this is the part that's not doing what I'd expect.
editor.getExpirationDateSpinner().setLocale(locale);
editor.getExpirationDateSpinner().getEditor().setLocale(locale);

有什么想法嗎?

推薦答案

嘗試設置微調器的語言環境:

Try setting the spinner's locale:

import java.awt.EventQueue;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerDateModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public class JSpinnerTest extends JPanel {

    public static void main(String args[]) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                JFrame f = new JFrame("JSpinnerTest");
                f.add(new JSpinnerTest());
                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                f.pack();
                f.setVisible(true);
            }
        });
    }

    public JSpinnerTest() {
        final JLabel label = new JLabel();
        final JSpinner spinner = new JSpinner();
        spinner.setLocale(new Locale("th", "TH"));
        Calendar calendar = Calendar.getInstance();
        Date initDate = calendar.getTime();
        calendar.add(Calendar.YEAR, -5);
        Date earliestDate = calendar.getTime();
        calendar.add(Calendar.YEAR, 10);
        Date latestDate = calendar.getTime();
        spinner.setModel(new SpinnerDateModel(
            initDate, earliestDate, latestDate, Calendar.MONTH));
        spinner.setEditor(new JSpinner.DateEditor(spinner, "MMM yyyy"));
        spinner.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                JSpinner s = (JSpinner) e.getSource();
                label.setText(s.getValue().toString());
            }
        });
        label.setText(initDate.toString());
        this.add(label);
        this.add(spinner);
    }
}

這篇關于佛教日歷中的JSpinner日期編輯器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當前星期幾的值)
主站蜘蛛池模板: 国产精品久久久久久二区 | 亚洲综合在线一区二区 | 三级免费| 一区视频在线免费观看 | 黄色片在线网站 | 欧美激情一区二区 | 99热播精品| 欧美精品一区二区三区蜜臀 | 久久a久久 | 欧美一卡二卡在线 | 成人夜晚看av | 久久国产精品无码网站 | 激情毛片| 亚洲一区久久 | 国产精品视频免费 | 最近日韩中文字幕 | 久夜精品| 国产黄色大片 | 久久国产香蕉 | 欧美性tv | 天天碰日日操 | 日韩欧美精品在线 | 中文字幕一区二区不卡 | 欧美日本韩国一区二区 | 中文字幕av在线播放 | 亚洲欧美视频一区二区 | 99精品国产一区二区三区 | 色免费视频 | 亚洲精品久久久久中文字幕二区 | 男人的天堂中文字幕 | 日韩三级在线观看 | 人人人艹 | 日本午夜精品 | 国产精品久久久久久影视 | www,黄色,com | 欧美成人高清视频 | 久久69精品久久久久久久电影好 | 欧美亚洲国产精品 | 精精国产xxxx视频在线 | 国产日韩电影 | 成人h免费观看视频 |