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

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

?? basedialog.java

?? java swing控件
?? JAVA
字號:
/**
 * L2FProd.com Common Components 6.9.1 License.
 *
 * Copyright 2005-2006 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.util.ResourceManager;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.HeadlessException;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;

/**
 * An extension of the <code>JDialog</code> with built-in support for
 * OK/CANCEL/CLOSE buttons.
 * 
 * <code>BaseDialog</code> adds:
 * <ul>
 * <li>support for ESCAPE key to dispose the window</li>
 * <li>ok, cancel methods</li>
 * <li>simple method to check if ok or cancel was called ({@link #ask})
 * </li>
 * <li>button pane</li>
 * <li>banner pane</li>
 * </ul>
 */
public class BaseDialog extends JDialog {

  /**
   * Used to set the mode of the dialog to OK/CANCEL. When in this mode, OK and
   * Cancel buttons are automatically added to the dialog.
   */
  public final static int OK_CANCEL_DIALOG = 0;

  /**
   * Used to set the mode of the dialog to OK/CANCEL. When in this mode, a
   * Close button is automatically added to the dialog.
   */
  public final static int CLOSE_DIALOG = 1;

  private BannerPanel banner;
  private JPanel contentPane;
  private JPanel buttonPane;
  private boolean cancelClicked;

  private JButton okButton;
  private JButton cancelOrCloseButton;
  private int mode;

  private Action okAction = new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
      ok();
    }
  };

  private Action cancelOrCloseAction = new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
      cancel();
    }
  };

  public BaseDialog() throws HeadlessException {
    super();
    buildUI();
  }

  public BaseDialog(Dialog owner) throws HeadlessException {
    super(owner);
    buildUI();
  }

  public static BaseDialog newBaseDialog(Component parent) {
    Window window = (Window)SwingUtilities.getAncestorOfClass(Window.class, parent);
    if (window instanceof Frame) {
      return new BaseDialog((Frame)window);
    } else if (window instanceof Dialog) {
      return new BaseDialog((Dialog)window);      
    } else {
      return new BaseDialog();
    }
  }

  public BaseDialog(Dialog owner, boolean modal) throws HeadlessException {
    super(owner, modal);
    buildUI();
  }

  public BaseDialog(Frame owner) throws HeadlessException {
    super(owner);
    buildUI();
  }

  public BaseDialog(Frame owner, boolean modal) throws HeadlessException {
    super(owner, modal);
    buildUI();
  }

  public BaseDialog(Dialog owner, String title) throws HeadlessException {
    super(owner, title);
    buildUI();
  }

  public BaseDialog(Dialog owner, String title, boolean modal)
    throws HeadlessException {
    super(owner, title, modal);
    buildUI();
  }

  public BaseDialog(Frame owner, String title) throws HeadlessException {
    super(owner, title);
    buildUI();
  }

  public BaseDialog(Frame owner, String title, boolean modal)
    throws HeadlessException {
    super(owner, title, modal);
    buildUI();
  }

  public BaseDialog(
    Dialog owner,
    String title,
    boolean modal,
    GraphicsConfiguration gc)
    throws HeadlessException {
    super(owner, title, modal, gc);
    buildUI();
  }

  public BaseDialog(
    Frame owner,
    String title,
    boolean modal,
    GraphicsConfiguration gc) {
    super(owner, title, modal, gc);
    buildUI();
  }

  /**
   * Gets the BannerPanel displayed in this dialog. The BannerPanel can be made
   * invisible by calling <code>getBanner().setVisible(false);</code> if it
   * is not needed.
   * 
   * @see BannerPanel
   */
  public final BannerPanel getBanner() {
    return banner;
  }

  public final Container getContentPane() {
    return contentPane;
  }

  public final Container getButtonPane() {
    return buttonPane;
  }

  /**
   * @return true if OK was clicked, false if CANCEL or CLOSE was clicked
   */
  public boolean ask() {
    setVisible(true);
    dispose();
    return !cancelClicked;
  }

  /**
   * Called when the user clicks on the OK button.
   */
  public void ok() {
    cancelClicked = false;
    setVisible(false);
  }

  /**
   * Called when the user clicks on the CANCEL or CLOSE button
   */
  public void cancel() {
    cancelClicked = true;
    setVisible(false);
  }

  /**
   * Sets the mode of this dialog. Default mode is
   * {@link BaseDialog#OK_CANCEL_DIALOG}
   * 
   * @param mode {@link BaseDialog#OK_CANCEL_DIALOG}or
   *          {@link BaseDialog#CLOSE_DIALOG}
   */
  public void setDialogMode(int mode) {
    if (!(mode == OK_CANCEL_DIALOG || mode == CLOSE_DIALOG)) {
      throw new IllegalArgumentException("invalid dialog mode");
    }

    if (okButton != null) {
      buttonPane.remove(okButton);
      okButton = null;
    }
    if (cancelOrCloseButton != null) {
      buttonPane.remove(cancelOrCloseButton);
      cancelOrCloseButton = null;
    }

    switch (mode) {
      case OK_CANCEL_DIALOG :
        okButton =
          new JButton(ResourceManager.all(BaseDialog.class).getString("ok"));
        okButton.addActionListener(okAction);
        buttonPane.add(okButton);
        cancelOrCloseButton =
          new JButton(
            ResourceManager.all(BaseDialog.class).getString("cancel"));
        cancelOrCloseButton.addActionListener(cancelOrCloseAction);
        buttonPane.add(cancelOrCloseButton);
        getRootPane().setDefaultButton(okButton);
        break;
      case CLOSE_DIALOG :
        cancelOrCloseButton =
          new JButton(ResourceManager.all(BaseDialog.class).getString("close"));
        cancelOrCloseButton.addActionListener(cancelOrCloseAction);
        buttonPane.add(cancelOrCloseButton);
        break;
    }

    this.mode = mode;
  }

  /**
   * Gets this dialog mode
   * 
   * @return this dialog mode
   */
  public int getDialogMode() {
    return mode;
  }

  /**
   * Centers this dialog on screen.
   */
  public void centerOnScreen() {
    UIUtilities.centerOnScreen(this);
  }

  protected String paramString() {
    return super.paramString()
      + ",dialogMode="
      + (mode == OK_CANCEL_DIALOG ? "OK_CANCEL_DIALOG" : "CLOSE_DIALOG");
  }

  private void buildUI() {
    Container container = super.getContentPane();
    container.setLayout(new BorderLayout(0, 0));

    banner = new BannerPanel();
    container.add("North", banner);

    JPanel contentPaneAndButtons = new JPanel();
    contentPaneAndButtons.setLayout(
      LookAndFeelTweaks.createVerticalPercentLayout());
    contentPaneAndButtons.setBorder(LookAndFeelTweaks.WINDOW_BORDER);
    container.add("Center", contentPaneAndButtons);

    contentPane = new JPanel();
    LookAndFeelTweaks.setBorderLayout(contentPane);
    LookAndFeelTweaks.setBorder(contentPane);
    contentPaneAndButtons.add(contentPane, "*");

    buttonPane = new JPanel();
    buttonPane.setLayout(LookAndFeelTweaks.createButtonAreaLayout());
    LookAndFeelTweaks.setBorder(buttonPane);
    contentPaneAndButtons.add(buttonPane);

    // layout is done, now everything about "cancel", "escape key" and "click
    // on close in window bar"
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

    ((JComponent)container).registerKeyboardAction(
      cancelOrCloseAction,
      KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
      JComponent.WHEN_IN_FOCUSED_WINDOW);

    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        cancel();
      }
    });

    // default mode is OK_CANCEL_DIALOG
    setDialogMode(OK_CANCEL_DIALOG);
  }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产乱码久久久久久老虎| 国产校园另类小说区| 国产乱人伦偷精品视频不卡 | 精品欧美久久久| 成人免费看黄yyy456| 亚洲一区二区精品视频| 中文字幕精品一区二区三区精品| 7777女厕盗摄久久久| 91亚洲大成网污www| 狠狠狠色丁香婷婷综合激情| 一区二区高清视频在线观看| 欧美激情一区在线观看| 欧美va日韩va| 欧美日韩国产一二三| aaa亚洲精品| 国产99久久久精品| 精品一区二区三区在线播放| 午夜久久福利影院| 一区二区在线观看av| 国产色产综合色产在线视频| 精品国产一区二区三区久久影院| 欧美喷潮久久久xxxxx| 色美美综合视频| 成人av高清在线| 成人免费视频网站在线观看| 国产精品一区二区x88av| 日韩av一区二区在线影视| 一区二区久久久| 最新国产の精品合集bt伙计| 国产欧美精品国产国产专区| 精品国产伦一区二区三区观看方式| 欧美浪妇xxxx高跟鞋交| 欧美三级在线视频| 欧美性猛交xxxx黑人交| 91福利精品第一导航| 色综合久久88色综合天天6| 91在线高清观看| 91丨porny丨首页| 91日韩精品一区| 一本久久a久久免费精品不卡| aaa欧美色吧激情视频| 99视频在线观看一区三区| 97精品视频在线观看自产线路二| av在线一区二区三区| 色综合久久久久综合| 91久久精品一区二区二区| 91国产精品成人| 欧美伦理影视网| 欧美一二三在线| 精品人伦一区二区色婷婷| 26uuu国产在线精品一区二区| 久久久久国产精品厨房| 久久精品欧美一区二区三区麻豆| 久久综合九色综合欧美就去吻| 久久久久久久国产精品影院| 国产精品私人影院| 亚洲欧美日韩在线| 亚洲一二三区视频在线观看| 日韩高清一区在线| 久久精品国产999大香线蕉| 国产寡妇亲子伦一区二区| 成人黄色777网| 在线观看亚洲专区| 欧美一级日韩一级| 久久久久9999亚洲精品| 中文字幕一区二区不卡| 亚洲成人黄色影院| 久久激五月天综合精品| 国产91清纯白嫩初高中在线观看| 91亚洲男人天堂| 欧美福利视频导航| 国产亚洲女人久久久久毛片| 亚洲欧洲av在线| 午夜精品视频一区| 国产中文一区二区三区| 91小视频在线免费看| 日韩三级精品电影久久久 | 国产视频一区在线观看| 亚洲激情第一区| 久久99这里只有精品| av亚洲精华国产精华精华| 欧美日韩夫妻久久| 亚洲国产精品激情在线观看| 亚洲一区二区三区在线看| 美女久久久精品| 一本一道波多野结衣一区二区| 日韩一级免费观看| 亚洲欧洲av在线| 久久99国产精品免费网站| 91小视频免费观看| 亚洲精品一区二区三区福利| 亚洲精品中文在线观看| 精东粉嫩av免费一区二区三区| 一本一道久久a久久精品| 精品国产一区二区三区久久影院| 亚洲老司机在线| 国产剧情一区二区三区| 欧美精品丝袜中出| 亚洲欧洲色图综合| 国产美女精品人人做人人爽| 精品婷婷伊人一区三区三| 中文字幕一区二区视频| 国内精品第一页| 欧美日韩高清一区| 亚洲激情自拍偷拍| 国产iv一区二区三区| 精品国精品自拍自在线| 偷拍日韩校园综合在线| 色婷婷亚洲精品| 国产精品久久久爽爽爽麻豆色哟哟 | 日韩你懂的在线观看| 一区二区三区在线影院| 成人动漫在线一区| www国产精品av| 男女男精品视频| 91激情五月电影| 中文字幕在线观看不卡视频| 国产原创一区二区| 日韩欧美一级特黄在线播放| 亚洲国产成人av网| 欧美在线你懂的| 中文字幕亚洲视频| 国产成人福利片| 欧美电视剧免费全集观看| 视频在线观看一区| 欧美日韩夫妻久久| 亚洲国产精品久久久男人的天堂| 91在线一区二区三区| 国产精品热久久久久夜色精品三区| 国产一区二区中文字幕| 精品成a人在线观看| 狠狠狠色丁香婷婷综合久久五月| 欧美一区二区福利在线| 青青草成人在线观看| 在线成人av影院| 国产在线国偷精品免费看| 91麻豆精品久久久久蜜臀| 亚洲成人777| 91精品国产一区二区| 日韩电影免费在线看| 日韩一区二区三区视频| 卡一卡二国产精品| 精品不卡在线视频| 国产真实乱对白精彩久久| 久久久99精品免费观看不卡| 国产成人av电影免费在线观看| 中文字幕欧美三区| av一区二区三区| 亚洲一区免费视频| 91精品国产综合久久蜜臀| 美女视频免费一区| www欧美成人18+| gogo大胆日本视频一区| 中文字幕亚洲电影| 色94色欧美sute亚洲线路一ni| 一区二区在线观看免费| 欧美日韩电影在线| 激情成人综合网| 中文字幕精品—区二区四季| 色综合天天综合网天天看片| 亚洲激情图片qvod| 欧美一激情一区二区三区| 国产精品综合av一区二区国产馆| 欧美国产精品中文字幕| 色素色在线综合| 免费欧美在线视频| 久久久精品综合| 色噜噜狠狠成人网p站| 亚洲a一区二区| 久久女同互慰一区二区三区| 99久久精品国产观看| 日韩激情一区二区| 久久久美女艺术照精彩视频福利播放| 不卡欧美aaaaa| 午夜婷婷国产麻豆精品| www激情久久| 欧洲一区在线观看| 久久成人18免费观看| 成人欧美一区二区三区| 日韩一区二区三| 99国产精品国产精品毛片| 亚洲va欧美va天堂v国产综合| 欧美精品一区二区三区蜜桃| 色综合亚洲欧洲| 久久99蜜桃精品| 一区二区理论电影在线观看| 2021中文字幕一区亚洲| 在线观看www91| 国产一区二区视频在线| 亚洲精品免费在线| 亚洲精品一区二区三区香蕉| 在线日韩av片| 国产一区二区在线看| 亚洲成a天堂v人片| 综合分类小说区另类春色亚洲小说欧美| 777午夜精品视频在线播放| 99久久伊人精品| 久久精品99国产精品日本| 亚洲男人的天堂网| 久久九九99视频|