亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? serialdatechooserpanel.java

?? 水晶 ? ?  報表 ? ? ? 源碼
?? JAVA
字號:
/* ===================================================
 * JCommon : a free general purpose Java class library
 * ===================================================
 *
 * Project Info:  http://www.jfree.org/jcommon/index.html
 * Project Lead:  David Gilbert (david.gilbert@object-refinery.com);
 *
 * (C) Copyright 2000-2003, by Object Refinery Limited and Contributors.
 *
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with this
 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * ---------------------------
 * SerialDateChooserPanel.java
 * ---------------------------
 * (C) Copyright 2001-2003, by Object Refinery Limited.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   -;
 *
 * $Id: SerialDateChooserPanel.java,v 1.3 2003/06/12 16:54:42 mungady Exp $
 *
 * Changes
 * -------
 * 08-Dec-2001 : Version 1 (DG);
 * 14-Oct-2002 : Fixed errors reported by Checkstyle (DG);
 *
 */

package org.jfree.ui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
import java.util.Vector;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

import org.jfree.date.SerialDate;

/**
 * A panel that allows the user to select a date.
 * <P>
 * This class is incomplete and untested.  You should not use it yet...
 *
 * @author David Gilbert
 */
public class SerialDateChooserPanel extends JPanel implements ActionListener {

    /** The default background color for the selected date. */
    public static final Color DEFAULT_DATE_BUTTON_COLOR = Color.red;

    /** The default background color for the current month. */
    public static final Color DEFAULT_MONTH_BUTTON_COLOR = Color.lightGray;

    /** The date selected in the panel. */
    private SerialDate date;

    /** The color for the selected date; */
    private Color dateButtonColor;

    /** The color for dates in the current month; */
    private Color monthButtonColor;

    /** The color for dates that are visible, but not in the current month; */
    private Color chosenOtherButtonColor = Color.darkGray;

    /** The first day-of-the-week; */
    private int firstDayOfWeek = Calendar.SUNDAY;

    /** The range used for selecting years; */
    private int yearSelectionRange = 20;

    /** The font used to display the date; */
    private Font dateFont = new Font("SansSerif", Font.PLAIN, 10);

    /** A combo for selecting the month; */
    private JComboBox monthSelector = null;

    /** A combo for selecting the year; */
    private JComboBox yearSelector = null;

    /** A button for selecting today's date; */
    private JButton todayButton = null;

    /** An array of buttons used to display the days-of-the-month; */
    private JButton[] buttons = null;

    /** A flag that indicates whether or not we are currently refreshing the buttons; */
    private boolean refreshing = false;

    /**
     * Constructs a new date chooser panel, using today's date as the initial selection.
     */
    public SerialDateChooserPanel() {

        this(SerialDate.createInstance(new Date()), false,
             DEFAULT_DATE_BUTTON_COLOR,
             DEFAULT_MONTH_BUTTON_COLOR);

    }

    /**
     * Constructs a new date chooser panel.
     *
     * @param date  the date.
     * @param controlPanel  a flag that indicates whether or not the 'today' button should
     *                      appear on the panel.
     */
    public SerialDateChooserPanel(SerialDate date, boolean controlPanel) {

        this(date, controlPanel,
             DEFAULT_DATE_BUTTON_COLOR,
             DEFAULT_MONTH_BUTTON_COLOR);

    }

    /**
     * Constructs a new date chooser panel.
     *
     * @param date  the date.
     * @param controlPanel  the control panel.
     * @param dateButtonColor  the date button color.
     * @param monthButtonColor  the month button color.
     */
    public SerialDateChooserPanel(SerialDate date, boolean controlPanel,
                                  Color dateButtonColor, Color monthButtonColor) {

        super(new BorderLayout());

        this.date = date;
        this.dateButtonColor = dateButtonColor;
        this.monthButtonColor = monthButtonColor;

        add(constructSelectionPanel(), BorderLayout.NORTH);
        add(getCalendarPanel(), BorderLayout.CENTER);
        if (controlPanel) {
            add(constructControlPanel(), BorderLayout.SOUTH);
        }

    }

    /**
     * Sets the date chosen in the panel.
     *
     * @param date  the new date.
     */
    public void setDate(SerialDate date) {

        this.date = date;
        monthSelector.setSelectedIndex(date.getMonth() - 1);
        refreshYearSelector();
        refreshButtons();

    }

    /**
     * Returns the date selected in the panel.
     *
     * @return the selected date.
     */
    public SerialDate getDate() {
        return this.date;
    }

    /**
     * Handles action-events from the date panel.
     *
     * @param e information about the event that occurred.
     */
    public void actionPerformed(ActionEvent e) {

        JComboBox c = null;
        Integer y = null;

        if (e.getActionCommand().equals("monthSelectionChanged")) {
            c = (JComboBox) e.getSource();
            date = SerialDate.createInstance(date.getDayOfMonth(), c.getSelectedIndex() + 1,
                                             date.getYYYY());
            refreshButtons();
        }

        if (e.getActionCommand().equals("yearSelectionChanged")) {
            if (!refreshing) {
                c = (JComboBox) e.getSource();
                y = (Integer) c.getSelectedItem();
                date = SerialDate.createInstance(date.getDayOfMonth(), date.getMonth(),
                                                 y.intValue());
                refreshYearSelector();
                refreshButtons();
            }
        }

        if (e.getActionCommand().equals("todayButtonClicked")) {
            setDate(SerialDate.createInstance(new Date()));
        }

        if (e.getActionCommand().equals("dateButtonClicked")) {
            JButton b = null;
            b = (JButton) e.getSource();
            int i = Integer.parseInt(b.getName());
            SerialDate first = getFirstVisibleDate();
            SerialDate selected = SerialDate.addDays(i, first);
            setDate(selected);
        }

    }

    /**
     * Returns a panel of buttons, each button representing a day in the month.  This is a
     * sub-component of the DatePanel.
     *
     * @return the panel.
     */
    private JPanel getCalendarPanel() {

        JPanel panel = new JPanel(new GridLayout(7, 7));
        panel.add(new JLabel("Sun", JLabel.CENTER));
        panel.add(new JLabel("Mon", JLabel.CENTER));
        panel.add(new JLabel("Tue", JLabel.CENTER));
        panel.add(new JLabel("Wed", JLabel.CENTER));
        panel.add(new JLabel("Thu", JLabel.CENTER));
        panel.add(new JLabel("Fri", JLabel.CENTER));
        panel.add(new JLabel("Sat", JLabel.CENTER));

        buttons = new JButton[42];
        for (int i = 0; i < 42; i++) {
            JButton button = new JButton("");
            button.setMargin(new Insets(1, 1, 1, 1));
            button.setName(new Integer(i).toString());
            button.setFont(dateFont);
            button.setFocusPainted(false);
            button.setActionCommand("dateButtonClicked");
            button.addActionListener(this);
            buttons[i] = button;
            panel.add(button);
        }
        return panel;

    }

    /**
     * Returns the button color according to the specified date.
     *
     * @param targetDate  the target date.
     *
     * @return the button color.
     */
    protected Color getButtonColor(SerialDate targetDate) {

        if (this.date.equals(date)) {
            return dateButtonColor;
        }
        else if (targetDate.getMonth() == date.getMonth()) {
            return monthButtonColor;
        }
        else {
            return chosenOtherButtonColor;
        }

    }

    /**
     * Returns the first date that is visible in the grid.  This should always be in the month
     * preceding the month of the selected date.
     *
     * @return the first visible date.
     */
    protected SerialDate getFirstVisibleDate() {

        SerialDate result = SerialDate.createInstance(1, date.getMonth(), date.getYYYY());
        result = SerialDate.addDays(-1, result);
        while (result.getDayOfWeek() != getFirstDayOfWeek()) {
            result = SerialDate.addDays(-1, result);
        }
        return result;

    }

    /**
     * Returns the first day of the week (controls the labels in the date panel).
     *
     * @return the first day of the week.
     */
    private int getFirstDayOfWeek() {
        return firstDayOfWeek;
    }

    /**
     * Update the button labels and colors to reflect date selection.
     */
    protected void refreshButtons() {

        SerialDate current = getFirstVisibleDate();
        for (int i = 0; i < 42; i++) {
            JButton button = buttons[i];
            button.setText(String.valueOf(current.getDayOfWeek()));
            button.setBackground(getButtonColor(current));
            current = SerialDate.addDays(1, current);
        }

    }

    /**
     * Changes the contents of the year selection JComboBox to reflect the chosen date and the year
     * range.
     */
    private void refreshYearSelector() {
        if (!refreshing) {
            refreshing = true;
            yearSelector.removeAllItems();
            Vector v = getYears(date.getYYYY());
            for (Enumeration e = v.elements(); e.hasMoreElements();) {
                yearSelector.addItem(e.nextElement());
            }
            yearSelector.setSelectedItem(new Integer(date.getYYYY()));
            refreshing = false;
        }
    }

    /**
     * Returns a vector of years preceding and following the specified year.  The number of years
     * preceding and following is determined by the yearSelectionRange attribute.
     *
     * @param chosenYear  the current year.
     *
     * @return a vector of years.
     */
    private Vector getYears(int chosenYear) {
        Vector v = null;
        v = new Vector();
        for (int i = chosenYear - yearSelectionRange; i <= chosenYear + yearSelectionRange; i++) {
            v.addElement(new Integer(i));
        }
        return v;
    }

    /**
     * Constructs a panel containing two JComboBoxes (for the month and year) and a button
     * (to reset the date to TODAY).
     *
     * @return the panel.
     */
    private JPanel constructSelectionPanel() {
        JPanel p = null;

        p = new JPanel();
        monthSelector = new JComboBox(SerialDate.getMonths());
        monthSelector.addActionListener(this);
        monthSelector.setActionCommand("monthSelectionChanged");
        p.add(monthSelector);

        yearSelector = new JComboBox(getYears(0));
        yearSelector.addActionListener(this);
        yearSelector.setActionCommand("yearSelectionChanged");
        p.add(yearSelector);

        return p;
    }

    /**
     * Returns a panel that appears at the bottom of the calendar panel - contains a button for
     * selecting today's date.
     *
     * @return the panel.
     */
    private JPanel constructControlPanel() {

        JPanel p = new JPanel();
        p.setBorder(BorderFactory.createEmptyBorder(2, 5, 2, 5));
        todayButton = new JButton("Today");
        todayButton.addActionListener(this);
        todayButton.setActionCommand("todayButtonClicked");
        p.add(todayButton);
        return p;

    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费色视频| 制服丝袜一区二区三区| 国产日韩欧美综合一区| 精品亚洲成av人在线观看| 日韩免费在线观看| 久久se精品一区二区| 久久婷婷成人综合色| 懂色av中文字幕一区二区三区 | 成人理论电影网| 国产精品久久久久久久久免费樱桃 | 一区二区三区四区精品在线视频| 91香蕉视频污在线| 亚洲综合色婷婷| 欧美成人精精品一区二区频| 国产suv精品一区二区三区| 亚洲欧美日韩小说| 制服丝袜成人动漫| 丁香婷婷综合色啪| 亚洲成年人网站在线观看| 久久久久久久免费视频了| 91小视频免费观看| 精品一区免费av| 亚洲男人的天堂一区二区| 4438亚洲最大| 91在线小视频| 久久成人免费网站| 亚洲免费观看高清| 日韩欧美一级在线播放| 91在线观看免费视频| 日韩电影在线一区二区三区| 国产三级欧美三级日产三级99| 欧美体内she精视频| 国产一区二区不卡| 日韩精品电影一区亚洲| 亚洲天堂精品在线观看| 精品久久久久久综合日本欧美| 91久久精品网| 成人国产电影网| 久久精品免费看| 一区二区三区欧美久久| 国产亚洲精品免费| 日韩一级二级三级| 91成人免费在线| 成人av网站在线| 经典三级视频一区| 日韩不卡手机在线v区| 亚洲天堂中文字幕| 国产校园另类小说区| 欧美mv日韩mv亚洲| 在线不卡a资源高清| 91社区在线播放| 春色校园综合激情亚洲| 精品一区二区影视| 日本aⅴ亚洲精品中文乱码| 怡红院av一区二区三区| 国产精品免费视频网站| 久久久噜噜噜久久人人看| 欧美一区永久视频免费观看| 欧美在线不卡一区| 在线观看亚洲精品视频| 91麻豆精东视频| 91麻豆蜜桃一区二区三区| 成人av午夜影院| 成人99免费视频| 国产91综合一区在线观看| 国产精品自在在线| 国内久久精品视频| 韩日精品视频一区| 激情久久五月天| 久久er99精品| 国产精品亚洲综合一区在线观看| 精品一区二区三区的国产在线播放 | 国产精品久久久久久久久免费丝袜| 日韩欧美不卡一区| 日韩欧美国产不卡| 欧美一区二区视频观看视频| 欧美福利一区二区| 欧美一区二区视频在线观看| 日韩一级片在线观看| 精品欧美一区二区在线观看| 日韩美一区二区三区| 日韩欧美一区二区在线视频| 欧美白人最猛性xxxxx69交| 日韩女优av电影| 国产欧美一区二区三区在线看蜜臀 | av动漫一区二区| 99久久伊人网影院| 色先锋久久av资源部| 91激情在线视频| 在线播放一区二区三区| 日韩视频在线观看一区二区| 欧美电影免费观看高清完整版| 精品成人佐山爱一区二区| 久久久久久久久久久久久女国产乱| 国产亚洲精品7777| 亚洲人午夜精品天堂一二香蕉| 亚洲风情在线资源站| 久久精品国产**网站演员| 国产精品99久久久久久久vr| 99精品国产一区二区三区不卡| 91网页版在线| 日韩欧美在线不卡| 国产精品丝袜91| 石原莉奈在线亚洲二区| 国产自产高清不卡| 一本大道综合伊人精品热热 | 久久久亚洲精华液精华液精华液| 中文av一区二区| 天天色图综合网| 国产乱码精品一区二区三区忘忧草 | 美女精品自拍一二三四| 国产福利一区二区三区视频| 日本大香伊一区二区三区| 欧美一区二区三区视频免费 | 国产精品99久久久久久久女警| 色综合天天综合网天天狠天天| 欧美一级艳片视频免费观看| 国产欧美1区2区3区| 亚洲午夜激情网页| 国产成人免费视频| 欧美日韩一区国产| 中文在线一区二区| 日本视频一区二区三区| 99这里只有久久精品视频| 欧美一区二区福利在线| 亚洲视频小说图片| 久久99日本精品| 欧美午夜片在线看| 国产精品女主播在线观看| 欧美aaaaa成人免费观看视频| 一本大道久久a久久综合| 精品成人一区二区三区四区| 亚洲成人黄色小说| 91网站在线播放| 日本一区二区三区国色天香| 麻豆成人久久精品二区三区红 | 国产精品丝袜在线| 精久久久久久久久久久| 欧美日韩情趣电影| 亚洲欧美精品午睡沙发| 国产美女一区二区| 日韩午夜三级在线| 日韩av二区在线播放| 欧美性猛片aaaaaaa做受| 国产精品不卡一区| 国产精品主播直播| 日韩精品在线看片z| 日本午夜一区二区| 精品污污网站免费看| 中文字幕在线一区免费| 国产精品69久久久久水密桃 | 欧美韩日一区二区三区| 久久精品国产亚洲aⅴ | 久久精品人人做人人爽97| 免费成人在线视频观看| 欧美精品日日鲁夜夜添| 亚洲午夜久久久久久久久久久| 色视频欧美一区二区三区| 国产精品你懂的在线| 成人av电影在线| 中文字幕 久热精品 视频在线| 国产成人h网站| 久久精品在这里| 成人高清视频在线观看| 国产精品大尺度| 91色乱码一区二区三区| 亚洲视频1区2区| 在线观看精品一区| 亚洲大片在线观看| 欧美日韩成人综合天天影院| 午夜精品久久久久久不卡8050| 欧美性猛片xxxx免费看久爱| 亚洲成人福利片| 日韩免费成人网| 国产一区二区三区国产| 国产欧美日韩综合精品一区二区| 国产91在线观看丝袜| 亚洲桃色在线一区| 欧美日韩免费电影| 久久爱另类一区二区小说| 国产欧美精品一区二区色综合朱莉| 成人h动漫精品一区二| 亚洲精品免费一二三区| 欧美日韩国产影片| 激情综合亚洲精品| 国产精品国产自产拍高清av王其| 99精品视频在线播放观看| 亚洲电影一级黄| 精品久久久久一区| bt7086福利一区国产| 亚洲成人一二三| 精品国产乱码久久久久久蜜臀| 国产成人午夜电影网| 亚洲免费观看高清完整版在线观看| 欧美日韩成人综合在线一区二区| 久久99精品久久久久| 亚洲欧洲日韩一区二区三区| 在线观看日韩一区| 狠狠色丁香九九婷婷综合五月| 国产精品乱码一区二区三区软件|