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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? datechooserpanel.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.
 *
 * ---------------------
 * DateChooserPanel.java
 * ---------------------
 * (C) Copyright 2000-2003, by Object Refinery Limited.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   -;
 *
 * $Id: DateChooserPanel.java,v 1.3 2003/06/12 16:54:38 mungady Exp $
 *
 * Changes (from 26-Oct-2001)
 * --------------------------
 * 26-Oct-2001 : Changed package to com.jrefinery.ui.* (DG);
 * 08-Dec-2001 : Dropped the getMonths() method (DG);
 * 13-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.
 *
 * @author David Gilbert
 */
public class DateChooserPanel extends JPanel implements ActionListener {

    /** The date selected in the panel. */
    private Calendar chosenDate = null;

    /** The color for the selected date; */
    private Color chosenDateButtonColor = Color.red;

    /** The color for dates in the current month; */
    private Color chosenMonthButtonColor = Color.lightGray;

    /** 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 DateChooserPanel() {
        this(Calendar.getInstance(), false);
    }

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

        super(new BorderLayout());
        add(constructSelectionPanel(), BorderLayout.NORTH);
        add(getCalendarPanel(), BorderLayout.CENTER);
        if (controlPanel) {
            add(constructControlPanel(), BorderLayout.SOUTH);
        }
        // the default date is today...
        chosenDate = calendar;
        setDate(calendar.getTime());
    }

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

        chosenDate.setTime(theDate);
        monthSelector.setSelectedIndex(chosenDate.get(Calendar.MONTH));
        refreshYearSelector();
        refreshButtons();

    }

    /**
     * Returns the date selected in the panel.
     *
     * @return the selected date.
     */
    public Date getDate() {
        return chosenDate.getTime();
    }

    /**
     * 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();
            chosenDate.set(Calendar.MONTH, c.getSelectedIndex());
            refreshButtons();
        }

        if (e.getActionCommand().equals("yearSelectionChanged")) {
            if (!refreshing) {
                c = (JComboBox) e.getSource();
                y = (Integer) c.getSelectedItem();
                chosenDate.set(Calendar.YEAR, y.intValue());
                refreshYearSelector();
                refreshButtons();
            }
        }

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

        if (e.getActionCommand().equals("dateButtonClicked")) {
            JButton b = null;
            b = (JButton) e.getSource();
            int i = Integer.parseInt(b.getName());
            Calendar cal = getFirstVisibleDate();
            cal.add(Calendar.DATE, i);
            setDate(cal.getTime());
        }

    }

    /**
     * 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 p = null;
        JButton b = null;

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

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

    }

    /**
     * Returns the button color according to the specified date.
     *
     * @param theDate  the date.
     *
     * @return the color.
     */
    private Color getButtonColor(Calendar theDate) {
        if (equalDates(theDate, chosenDate)) {
            return chosenDateButtonColor;
        }
        else if (theDate.get(Calendar.MONTH) == chosenDate.get(Calendar.MONTH)) {
            return chosenMonthButtonColor;
        }
        else {
            return chosenOtherButtonColor;
        }
    }

    /**
     * Returns true if the two dates are equal (time of day is ignored).
     *
     * @param c1  the first date.
     * @param c2  the second date.
     *
     * @return boolean.
     */
    private boolean equalDates(Calendar c1, Calendar c2) {
        if ((c1.get(Calendar.DATE) == c2.get(Calendar.DATE))
            && (c1.get(Calendar.MONTH) == c2.get(Calendar.MONTH))
            && (c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR))) {
            return true;
        }
        else {
            return false;
        }
    }

    /**
     * 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 date.
     */
    private Calendar getFirstVisibleDate() {
        Calendar c = Calendar.getInstance();
        c.set(chosenDate.get(Calendar.YEAR), chosenDate.get(Calendar.MONTH), 1);
        c.add(Calendar.DATE, -1);
        while (c.get(Calendar.DAY_OF_WEEK) != getFirstDayOfWeek()) {
            c.add(Calendar.DATE, -1);
        }
        return c;
    }

    /**
     * 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.
     */
    private void refreshButtons() {
        JButton b = null;
        Calendar c = getFirstVisibleDate();
        for (int i = 0; i < 42; i++) {
            b = buttons[i];
            b.setText(new Integer(c.get(Calendar.DATE)).toString());
            b.setBackground(getButtonColor(c));
            c.add(Calendar.DATE, 1);
        }
    }

    /**
     * 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(chosenDate.get(Calendar.YEAR));
            for (Enumeration e = v.elements(); e.hasMoreElements();) {
                yearSelector.addItem(e.nextElement());
            }
            yearSelector.setSelectedItem(new Integer(chosenDate.get(Calendar.YEAR)));
            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 selected 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;

    }

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合久久88色综合天天6| 色悠悠久久综合| 亚洲综合丝袜美腿| 国产日韩欧美激情| 7878成人国产在线观看| av影院午夜一区| 国模无码大尺度一区二区三区| 亚洲综合在线免费观看| 久久久99免费| 日韩午夜在线播放| 欧美美女网站色| 91麻豆免费观看| www.66久久| 国产成人8x视频一区二区| 久久99久久99精品免视看婷婷| 一区二区三区在线视频观看 | 日韩色在线观看| 欧美在线观看禁18| 99久久精品情趣| 成人爱爱电影网址| 国产乱码精品1区2区3区| 日本成人超碰在线观看| 亚洲国产一区视频| 亚洲自拍偷拍av| 一区二区三区四区精品在线视频| 亚洲国产精品激情在线观看| 精品粉嫩aⅴ一区二区三区四区| 在线播放一区二区三区| 欧美日韩中文精品| 欧美图区在线视频| 欧美丝袜丝交足nylons图片| 日本高清不卡视频| 在线观看亚洲精品| 欧美日韩一区二区三区高清 | 国产一区二区电影| 久久99精品国产.久久久久久| 久久疯狂做爰流白浆xx| 久久99精品国产| 国产在线麻豆精品观看| 国产福利91精品| 成人av片在线观看| 色婷婷精品大在线视频| 欧美亚洲国产一卡| 欧美日韩精品三区| 日韩一区二区不卡| 久久综合久久综合九色| 精品国产乱码久久久久久1区2区 | 亚洲午夜成aⅴ人片| 一区二区高清在线| 石原莉奈在线亚洲三区| 免播放器亚洲一区| 国精产品一区一区三区mba视频| 国产在线播放一区二区三区| 国产成人免费视频精品含羞草妖精 | 一区二区三区四区不卡视频| 亚洲国产一区二区三区青草影视| 天天色图综合网| 国内精品伊人久久久久av影院| 成人中文字幕合集| 色国产精品一区在线观看| 在线播放中文一区| 国产亚洲欧美中文| 亚洲精品成人在线| 日韩国产在线一| 懂色av中文一区二区三区 | 97久久超碰精品国产| 欧美综合久久久| 精品国产乱码久久久久久浪潮| 国产欧美1区2区3区| 亚洲综合在线免费观看| 久久se精品一区精品二区| 福利一区在线观看| 欧美精品一级二级三级| 久久女同性恋中文字幕| 亚洲色图一区二区三区| 男人的天堂亚洲一区| 高清视频一区二区| 久久女同性恋中文字幕| 精品一区二区三区在线视频| 国产成人精品网址| 欧美午夜精品免费| 欧美经典一区二区| 亚洲国产婷婷综合在线精品| 国产精华液一区二区三区| 色婷婷精品大视频在线蜜桃视频| 欧美一区二区三区小说| 亚洲777理论| 国产综合久久久久影院| 色域天天综合网| 国产日韩精品一区二区三区在线| 亚洲福利视频一区| 成人av在线看| 欧美精品一区二区三区一线天视频| 亚洲另类色综合网站| 久久精品国产77777蜜臀| 成人av影视在线观看| 日韩亚洲欧美在线观看| 一区二区三区欧美亚洲| 国产69精品久久99不卡| 欧美一区二区三区视频| 国产精品福利影院| 精品在线免费观看| 欧美蜜桃一区二区三区| 日韩毛片精品高清免费| 国产伦精一区二区三区| 欧美久久久久久久久久| 亚洲三级在线播放| 丰满放荡岳乱妇91ww| 精品剧情v国产在线观看在线| 亚洲已满18点击进入久久| 丁香桃色午夜亚洲一区二区三区| 91精品久久久久久久久99蜜臂| 亚洲精品成人a在线观看| av在线一区二区| 国产午夜久久久久| 国内精品国产成人| 精品国产一区二区在线观看| 全国精品久久少妇| 欧美人伦禁忌dvd放荡欲情| 亚洲一区在线视频| 在线观看91精品国产入口| 国产精品国产馆在线真实露脸| 国产精品自拍一区| 精品国产欧美一区二区| 精品一区二区三区在线观看| 日韩美女一区二区三区| 美女国产一区二区| 日韩美女视频一区二区在线观看| 奇米精品一区二区三区在线观看| 精品视频一区三区九区| 亚洲成av人片在线观看| 欧美午夜精品电影| 偷拍与自拍一区| 欧美一区二区在线不卡| 久久国产生活片100| 日韩精品一区二区三区swag| 蜜臀久久久久久久| 欧美精品一区二区三区在线播放| 国产综合一区二区| 欧美国产1区2区| 99久久精品免费| 亚洲亚洲精品在线观看| 欧美日韩的一区二区| 免费在线欧美视频| 精品国产伦一区二区三区观看体验| 久久97超碰国产精品超碰| 久久蜜桃香蕉精品一区二区三区| 国产一区二区三区观看| 国产精品高清亚洲| 91国产免费观看| 成人的网站免费观看| 日韩亚洲电影在线| 激情综合网av| 国产精品沙发午睡系列990531| 国产亚洲一区二区在线观看| 高清免费成人av| 亚洲精品高清在线观看| 337p亚洲精品色噜噜噜| 国产揄拍国内精品对白| 日本一区二区三区在线不卡| av福利精品导航| 天天射综合影视| 久久精品免费在线观看| 91福利在线看| 久久国产麻豆精品| 国产精品久久久久久久久果冻传媒 | 亚洲国产高清在线观看视频| 99精品黄色片免费大全| 性感美女久久精品| ww亚洲ww在线观看国产| 一本久久精品一区二区 | 在线亚洲+欧美+日本专区| 日韩经典一区二区| 国产精品久久久久久一区二区三区 | 国产成人精品三级| 一区2区3区在线看| 精品久久人人做人人爽| 91浏览器打开| 精品一区二区三区在线视频| 亚洲另类在线制服丝袜| 久久一区二区三区国产精品| 91国产成人在线| 国产酒店精品激情| 午夜精品久久久久久久| 中文字幕av一区 二区| 欧美日韩精品久久久| 波多野结衣视频一区| 美女网站一区二区| 一区二区三区在线视频免费| 久久精品视频在线看| 555夜色666亚洲国产免| 北岛玲一区二区三区四区| 美日韩黄色大片| 亚洲国产精品人人做人人爽| 中文字幕精品三区| 欧美成人精品福利| 欧美视频在线观看一区二区| 成人av午夜影院| 国产精品一二三| 麻豆国产欧美日韩综合精品二区|