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

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

?? jtipoftheday.java

?? 精美開源Swing組件
?? JAVA
字號:
/**
 * L2FProd.com Common Components 7.3 License.
 *
 * Copyright 2005-2007 L2FProd.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.l2fprod.common.swing;

import com.l2fprod.common.swing.TipModel.Tip;
import com.l2fprod.common.swing.plaf.JTipOfTheDayAddon;
import com.l2fprod.common.swing.plaf.LookAndFeelAddons;
import com.l2fprod.common.swing.plaf.TipOfTheDayUI;
import com.l2fprod.common.swing.tips.DefaultTipModel;

import java.awt.Component;
import java.awt.HeadlessException;
import java.util.prefs.Preferences;

import javax.swing.JComponent;
import javax.swing.JDialog;

/**
 * Provides the "Tip of The Day" pane and dialog.<br>
 * Tips are retrieved from the {@link com.l2fprod.common.swing.TipModel}. In
 * the most common usage, a tip (as returned by
 * {@link com.l2fprod.common.swing.TipModel.Tip#getTip()}) is just a
 * <code>String</code>. However, the return type of this method is actually
 * <code>Object</code>. Its interpretation depends on its type:
 * <dl compact>
 * <dt>Component
 * <dd>The <code>Component</code> is displayed in the dialog.
 * <dt>Icon
 * <dd>The <code>Icon</code> is wrapped in a <code>JLabel</code> and
 * displayed in the dialog.
 * <dt>others
 * <dd>The object is converted to a <code>String</code> by calling its
 * <code>toString</code> method. The result is wrapped in a
 * <code>JEditorPane</code> or <code>JTextArea</code> and displayed.
 * </dl>
 * 
 * @author Frederic Lavigne
 */
public class JTipOfTheDay extends JComponent {

  public final static String uiClassID = "l2fprod/TipOfTheDayUI";

  // ensure at least the default ui is registered
  static {
    LookAndFeelAddons.contribute(new JTipOfTheDayAddon());
  }

  /**
   * Key used to store the status of the "Show tip on startup" checkbox"
   */
  public static final String PREFERENCE_KEY = "ShowTipOnStartup";

  /**
   * Used when generating PropertyChangeEvents for the "currentTip" property
   */
  public static final String CURRENT_TIP_CHANGED_KEY = "currentTip";

  private TipModel model;
  private int currentTip = 0;

  public JTipOfTheDay() {
    this(new DefaultTipModel(new Tip[0]));
  }
  
  public JTipOfTheDay(TipModel model) {
    this.model = model;
    updateUI();
  }

  /**
   * Notification from the <code>UIManager</code> that the L&F has changed.
   * Replaces the current UI object with the latest version from the
   * <code>UIManager</code>.
   * 
   * @see javax.swing.JComponent#updateUI
   */
  public void updateUI() {
    setUI((TipOfTheDayUI)LookAndFeelAddons.getUI(this, TipOfTheDayUI.class));
  }

  /**
   * Sets the L&F object that renders this component.
   * 
   * @param ui
   *          the <code>TipOfTheDayUI</code> L&F object
   * @see javax.swing.UIDefaults#getUI
   * 
   * @beaninfo bound: true hidden: true description: The UI object that
   *           implements the taskpane group's LookAndFeel.
   */
  public void setUI(TipOfTheDayUI ui) {
    super.setUI(ui);
  }

  /**
   * Gets the UI object which implements the L&F for this component.
   * 
   * @return the TipOfTheDayUI object that implements the TipOfTheDayUI L&F
   */
  public TipOfTheDayUI getUI() {
    return (TipOfTheDayUI)ui;
  }

  /**
   * Returns the name of the L&F class that renders this component.
   * 
   * @return the string {@link #uiClassID}
   * @see javax.swing.JComponent#getUIClassID
   * @see javax.swing.UIDefaults#getUI
   */
  public String getUIClassID() {
    return uiClassID;
  }

  public TipModel getModel() {
    return model;
  }

  public void setModel(TipModel model) {
    TipModel old = this.model;
    this.model = model;
    firePropertyChange("model", old, model);
  }

  public int getCurrentTip() {
    return currentTip;
  }

  /**
   * Sets the index of the tip to show
   * 
   * @param currentTip
   * @throw IllegalArgumentException if currentTip is not within the bounds [0,
   *        getModel().getTipCount()[.
   */
  public void setCurrentTip(int currentTip) {
    if (currentTip < 0 || currentTip >= getModel().getTipCount()) { throw new IllegalArgumentException(
      "Current tip must be within the bounds [0, " + getModel().getTipCount()
        + "["); }

    int oldTip = this.currentTip;
    this.currentTip = currentTip;
    firePropertyChange(CURRENT_TIP_CHANGED_KEY, oldTip, currentTip);
  }

  /**
   * Shows the next tip in the list. It cycles the tip list.
   */
  public void nextTip() {
    int count = getModel().getTipCount();
    if (count == 0) { return; }

    int nextTip = currentTip + 1;
    if (nextTip >= count) {
      nextTip = 0;
    }
    setCurrentTip(nextTip);
  }

  /**
   * Shows the previous tip in the list. It cycles the tip list.
   */
  public void previousTip() {
    int count = getModel().getTipCount();
    if (count == 0) { return; }

    int previousTip = currentTip - 1;
    if (previousTip < 0) {
      previousTip = count - 1;
    }
    setCurrentTip(previousTip);
  }

  /**
   * Pops up a "Tip of the day" dialog.
   * 
   * @param parentComponent
   * @exception HeadlessException
   *              if GraphicsEnvironment.isHeadless() returns true.
   * @see java.awt.GraphicsEnvironment#isHeadless
   */
  public void showDialog(Component parentComponent) throws HeadlessException {
    showDialog(parentComponent, (ShowOnStartupChoice)null);
  }

  /**
   * Pops up a "Tip of the day" dialog. Additionally, it saves the state of the
   * "Show tips on startup" checkbox in a key named "ShowTipOnStartup" in the
   * given Preferences.
   * 
   * @param parentComponent
   * @param showOnStartupPref
   * @exception HeadlessException
   *              if GraphicsEnvironment.isHeadless() returns true.
   * @throws IllegalArgumentException
   *           if showOnStartupPref is null
   * @see java.awt.GraphicsEnvironment#isHeadless
   * @return true if the user chooses to see the tips again, false otherwise.
   */
  public boolean showDialog(Component parentComponent,
    Preferences showOnStartupPref) throws HeadlessException {
    return showDialog(parentComponent, showOnStartupPref, false);
  }
  
  /**
   * Pops up a "Tip of the day" dialog. Additionally, it saves the state of the
   * "Show tips on startup" checkbox in a key named "ShowTipOnStartup" in the
   * given Preferences.
   * 
   * @param parentComponent
   * @param showOnStartupPref
   * @param force
   *          if true, the dialog is displayed even if the Preferences is set to
   *          hide the dialog
   * @exception HeadlessException
   *              if GraphicsEnvironment.isHeadless() returns true.
   * @throws IllegalArgumentException
   *           if showOnStartupPref is null
   * @see java.awt.GraphicsEnvironment#isHeadless
   * @return true if the user chooses to see the tips again, false
   *         otherwise.
   */
  public boolean showDialog(Component parentComponent,
    final Preferences showOnStartupPref, boolean force) throws HeadlessException {
    if (showOnStartupPref == null) { throw new IllegalArgumentException(
      "Preferences can not be null"); }

    ShowOnStartupChoice store = new ShowOnStartupChoice() {
      public boolean isShowingOnStartup() {
        return showOnStartupPref.getBoolean(PREFERENCE_KEY, true);
      }
      public void setShowingOnStartup(boolean showOnStartup) {
        // only save the choice if it is negative
        if (!showOnStartup) {
          showOnStartupPref.putBoolean(PREFERENCE_KEY, showOnStartup);
        }
      }
    };
    return showDialog(parentComponent, store, force);
  }

  /**
   * Pops up a "Tip of the day" dialog.
   * 
   * If <code>choice</code> is not null, the method first checks if
   * {@link ShowOnStartupChoice#isShowingOnStartup()} is true before showing the
   * dialog.
   * 
   * Additionally, it saves the state of the "Show tips on startup" checkbox
   * using the given {@link ShowOnStartupChoice} object.
   * 
   * @param parentComponent
   * @param choice
   * @exception HeadlessException
   *              if GraphicsEnvironment.isHeadless() returns true.
   * @see java.awt.GraphicsEnvironment#isHeadless
   * @return true if the user chooses to not the tips again, false otherwise.
   */
  public boolean showDialog(Component parentComponent,
    ShowOnStartupChoice choice) {
    return showDialog(parentComponent, choice, false);
  }

  /**
   * Pops up a "Tip of the day" dialog.
   * 
   * If <code>choice</code> is not null, the method first checks if
   * <code>force</code> is true or if
   * {@link ShowOnStartupChoice#isShowingOnStartup()} is true before showing the
   * dialog.
   * 
   * Additionally, it saves the state of the "Show tips on startup" checkbox
   * using the given {@link ShowOnStartupChoice} object.
   * 
   * @param parentComponent
   * @param choice
   * @param force
   *          if true, the dialog is displayed even if
   *          {@link ShowOnStartupChoice#isShowingOnStartup()} is false
   * @exception HeadlessException
   *              if GraphicsEnvironment.isHeadless() returns true.
   * @see java.awt.GraphicsEnvironment#isHeadless
   * @return true if the user chooses to see the tips again, false otherwise.
   */
  public boolean showDialog(Component parentComponent,
    ShowOnStartupChoice choice, boolean force) {    
    if (choice == null) {
      JDialog dialog = createDialog(parentComponent, choice);
      dialog.setVisible(true);
      dialog.dispose();
      return true;
    } else if (force || choice.isShowingOnStartup()) {
      JDialog dialog = createDialog(parentComponent, choice);
      dialog.setVisible(true);
      dialog.dispose();
      return choice.isShowingOnStartup();
    } else {
      return false;
    }
  }
  
  /**
   * @param showOnStartupPref
   * @return true if the key named "ShowTipOnStartup" is not set to false
   */
  public static boolean isShowingOnStartup(Preferences showOnStartupPref) {
    return showOnStartupPref.getBoolean(PREFERENCE_KEY, true);
  }

  /**
   * Removes the value set for "ShowTipOnStartup" in the given Preferences to
   * ensure the dialog shown by a later call to
   * {@link #showDialog(Component, Preferences)} will be visible to the user.
   * 
   * @param showOnStartupPref
   */
  public static void forceShowOnStartup(Preferences showOnStartupPref) {
    showOnStartupPref.remove(PREFERENCE_KEY);
  }

  /**
   * Calls
   * {@link TipOfTheDayUI#createDialog(Component, JTipOfTheDay.ShowOnStartupChoice)}
   * 
   * @param parentComponent
   * @param choice
   * @return a JDialog to show this TipOfTheDay pane
   */
  protected JDialog createDialog(Component parentComponent,
    ShowOnStartupChoice choice) {
    return getUI().createDialog(parentComponent, choice);
  }

  /**
   * Used in conjunction with the
   * {@link JTipOfTheDay#showDialog(Component, ShowOnStartupChoice)} to save the
   * "Show tips on startup" choice.
   */
  public static interface ShowOnStartupChoice {
    void setShowingOnStartup(boolean showOnStartup);
    boolean isShowingOnStartup();
  }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲高清中文字幕| 欧美一级国产精品| 成人免费一区二区三区在线观看| 精品一二线国产| 精品国产不卡一区二区三区| 麻豆精品精品国产自在97香蕉| 欧美一区二区三区精品| 美国一区二区三区在线播放| 日韩欧美另类在线| 国产成人欧美日韩在线电影| 国产精品三级久久久久三级| 91丨porny丨国产| 日韩成人午夜电影| 久久久不卡网国产精品二区| 97精品久久久久中文字幕| 一区二区高清在线| 精品久久久久久无| 色哟哟一区二区在线观看| 亚洲成av人片www| 久久精品欧美一区二区三区不卡| av午夜精品一区二区三区| 亚洲国产综合在线| 国产午夜精品理论片a级大结局 | 亚洲综合一区在线| 精品国产电影一区二区| 色欧美片视频在线观看| 亚洲一本大道在线| 国产日产欧美一区二区三区| 欧美日韩久久久一区| 成人免费三级在线| 久久精品噜噜噜成人av农村| 亚洲视频电影在线| 国产午夜亚洲精品午夜鲁丝片| 欧美日韩一区国产| 91蝌蚪porny成人天涯| 高清视频一区二区| 紧缚奴在线一区二区三区| 亚洲午夜电影在线观看| 亚洲精品国久久99热| 国产午夜一区二区三区| 精品剧情v国产在线观看在线| 欧美人牲a欧美精品| 欧美男人的天堂一二区| 在线免费不卡视频| 日本电影亚洲天堂一区| 91国产福利在线| 精品污污网站免费看| 精品视频一区二区三区免费| 欧美三级电影一区| 制服丝袜中文字幕亚洲| 911精品国产一区二区在线| 欧美精选一区二区| 久久亚洲一级片| 国产精品乱码妇女bbbb| 亚洲免费成人av| 天堂一区二区在线| 精品一区二区在线观看| 国产成人av福利| 91在线视频官网| 欧美精选一区二区| 久久久精品国产免大香伊| 亚洲国产精品高清| 亚洲电影中文字幕在线观看| 国产精品自在在线| 国产精品99久久久久久似苏梦涵 | 午夜av区久久| 黄色资源网久久资源365| 成人av网址在线| 欧美久久久久免费| 国产精品天天摸av网| 亚洲国产精品久久人人爱蜜臀 | 不卡视频一二三四| 日韩亚洲欧美在线| 国产精品动漫网站| 国产一区二区在线视频| 欧洲av一区二区嗯嗯嗯啊| 精品福利二区三区| 午夜av一区二区| 欧美在线一区二区三区| 国产亚洲va综合人人澡精品| 亚洲成av人片一区二区梦乃 | 日本美女视频一区二区| 97se亚洲国产综合在线| 久久中文娱乐网| 美女视频黄 久久| 欧美视频在线一区二区三区 | 精品国产乱码久久久久久老虎 | 久久日一线二线三线suv| 亚洲国产一区二区视频| 一本一本久久a久久精品综合麻豆| 精品动漫一区二区三区在线观看| 日韩成人dvd| 精品美女被调教视频大全网站| 久久精品噜噜噜成人88aⅴ| 欧美亚洲国产一区二区三区va| 国产精品国产三级国产aⅴ入口| 国产精品1区2区3区在线观看| 久久亚洲捆绑美女| 国产成人午夜视频| 国产欧美中文在线| av一二三不卡影片| 亚洲久本草在线中文字幕| 欧美曰成人黄网| 日韩电影在线观看电影| 日韩欧美一区在线| 国产呦萝稀缺另类资源| 亚洲精品乱码久久久久久黑人| 91九色最新地址| 蜜桃一区二区三区在线| 久久久久国产成人精品亚洲午夜| 成人午夜视频免费看| 亚洲福利视频一区二区| 久久综合av免费| 在线观看av一区二区| 久久99国内精品| 自拍偷拍亚洲欧美日韩| 日韩欧美一区二区不卡| 色欧美乱欧美15图片| 激情另类小说区图片区视频区| 亚洲欧洲精品成人久久奇米网| 欧美自拍丝袜亚洲| 韩国v欧美v亚洲v日本v| 亚洲h在线观看| 一区二区三区在线观看动漫| 欧美xxxxx牲另类人与| 91丨porny丨最新| 国产成人免费视频网站| 美女视频一区二区三区| 亚洲国产综合人成综合网站| 国产精品久久久久久户外露出| 欧美二区乱c少妇| 91视视频在线观看入口直接观看www | 中文字幕在线不卡| 欧美精品一区二区久久婷婷| 91麻豆精品国产无毒不卡在线观看| av不卡一区二区三区| 成人亚洲一区二区一| 高清不卡一二三区| caoporen国产精品视频| 高清在线不卡av| 99re这里都是精品| av在线不卡免费看| 91蝌蚪porny九色| 91香蕉视频污在线| 91福利社在线观看| 欧美综合一区二区| 91精品福利在线一区二区三区 | 色婷婷av一区二区| 91官网在线免费观看| 欧美日韩国产成人在线免费| 欧美高清一级片在线| 日韩欧美一级片| 国产色一区二区| 亚洲精品综合在线| 欧美aaaaa成人免费观看视频| 免费精品99久久国产综合精品| 九一九一国产精品| av电影在线不卡| 欧美久久婷婷综合色| 久久一二三国产| 亚洲一区二区在线播放相泽| 免费不卡在线观看| 99精品视频一区二区三区| 欧美色视频在线| 久久久久久电影| 亚洲已满18点击进入久久| 九一九一国产精品| 色婷婷综合久色| 国产色产综合色产在线视频| 亚洲综合在线免费观看| 国产曰批免费观看久久久| 欧美影院一区二区| 国产精品网友自拍| 久色婷婷小香蕉久久| 在线视频一区二区免费| 国产欧美一区二区精品性色| 亚洲国产美国国产综合一区二区| 国产伦精品一区二区三区在线观看| 色噜噜狠狠成人网p站| 久久久精品欧美丰满| 精品在线免费视频| 日韩美女一区二区三区四区| 亚洲国产精品尤物yw在线观看| 成人av在线资源网| 日本一区二区视频在线观看| 黄页视频在线91| 精品久久久久久亚洲综合网| 日本成人在线一区| 91精品国产手机| 日韩成人伦理电影在线观看| 欧美精品在欧美一区二区少妇| 亚洲一级二级在线| 91成人看片片| 午夜av电影一区| 欧美一区二区三区免费观看视频 | 欧美日韩情趣电影| 日韩av在线播放中文字幕| 日韩一卡二卡三卡| 精品一区二区三区久久| 久久久久久久久久电影|