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

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

?? windowsfontchooserui.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.plaf.windows;

import com.l2fprod.common.swing.JFontChooser;
import com.l2fprod.common.swing.LookAndFeelTweaks;
import com.l2fprod.common.swing.PercentLayout;
import com.l2fprod.common.swing.plaf.FontChooserUI;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.font.TextAttribute;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.plaf.ComponentUI;

/**
 * Windows implementation of the JFontChooser pluggable UI.
 */
public class WindowsFontChooserUI extends FontChooserUI {

  public static ComponentUI createUI(JComponent component) {
    return new WindowsFontChooserUI();
  }

  private JFontChooser chooser;

  private JPanel fontPanel;
  private JTextField fontField;
  private JList fontList;

  private JTextField fontEffectField;
  private JList fontEffectList;

  private JPanel fontSizePanel;
  private JTextField fontSizeField;
  private JList fontSizeList;

  private JTextArea previewPanel;
  private JComboBox charSetCombo;

  private PropertyChangeListener propertyListener;

  public void installUI(JComponent c) {
    super.installUI(c);

    chooser = (JFontChooser)c;

    installComponents();
    installListeners();
  }

  protected void installComponents() {
    JLabel label;

    ResourceBundle bundle = ResourceBundle.getBundle(FontChooserUI.class
        .getName()
        + "RB");

    // FIRST PANEL with Font list
    fontPanel = new JPanel(new PercentLayout(PercentLayout.VERTICAL, 2));
    fontPanel.add(label = new JLabel(bundle
        .getString("FontChooserUI.fontLabel")));
    fontPanel.add(fontField = new JTextField(25));
    fontField.setEditable(false);
    fontPanel.add(new JScrollPane(fontList = new JList()), "*");
    label.setLabelFor(fontList);
    label.setDisplayedMnemonic(bundle.getString(
        "FontChooserUI.fontLabel.mnemonic").charAt(0));
    fontList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    String[] fontFamilies = chooser.getModel().getFontFamilies(null);
    fontList.setListData(fontFamilies);

    // SECOND PANEL with Bold, Italic, Charset
    JPanel fontEffectPanel = new JPanel(new PercentLayout(
        PercentLayout.VERTICAL, 2));
    fontEffectPanel.add(label = new JLabel(bundle
        .getString("FontChooserUI.styleLabel")));
    fontEffectPanel.add(fontEffectField = new JTextField(10));
    fontEffectField.setEditable(false);
    fontEffectPanel.add(new JScrollPane(fontEffectList = new JList()), "*");
    label.setLabelFor(fontEffectList);
    label.setDisplayedMnemonic(bundle.getString(
        "FontChooserUI.styleLabel.mnemonic").charAt(0));
    fontEffectList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    FontStyle[] fontStyles = new FontStyle[]{
        new FontStyle(Font.PLAIN, bundle.getString("FontChooserUI.style.plain")),
        new FontStyle(Font.BOLD, bundle.getString("FontChooserUI.style.bold")),
        new FontStyle(Font.ITALIC, bundle
            .getString("FontChooserUI.style.italic")),
        new FontStyle(Font.BOLD | Font.ITALIC, bundle
            .getString("FontChooserUI.style.bolditalic")),};
    fontEffectList.setListData(fontStyles);

    // The SIZE PANEL
    fontSizePanel = new JPanel(new PercentLayout(PercentLayout.VERTICAL, 2));
    fontSizePanel.add(label = new JLabel(bundle
        .getString("FontChooserUI.sizeLabel")));

    label.setDisplayedMnemonic(bundle.getString(
        "FontChooserUI.sizeLabel.mnemonic").charAt(0));

    fontSizePanel.add(fontSizeField = new JTextField(5));
    label.setLabelFor(fontSizeField);
    fontSizePanel.add(new JScrollPane(fontSizeList = new JList()), "*");

    int[] defaultFontSizes = chooser.getModel().getDefaultSizes();
    String[] sizes = new String[defaultFontSizes.length];
    for (int i = 0, c = sizes.length; i < c; i++) {
      sizes[i] = String.valueOf(defaultFontSizes[i]);
    }
    fontSizeList.setPrototypeCellValue("012345");
    fontSizeList.setListData(sizes);
    fontSizeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    fontSizeList.setVisibleRowCount(2);

    chooser.setLayout(LookAndFeelTweaks.createBorderLayout());
    JPanel panel = new JPanel();
    panel.setLayout(LookAndFeelTweaks.createHorizontalPercentLayout());
    panel.add(fontPanel, "*");
    panel.add(fontEffectPanel);
    panel.add(fontSizePanel);

    previewPanel = new JTextArea();
    previewPanel.setText(chooser.getModel().getPreviewMessage(null));
    JScrollPane scroll = new JScrollPane(previewPanel);

    JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    split.setBorder(null);
    split.setTopComponent(panel);
    split.setBottomComponent(scroll);
    split.setDividerLocation(0.5);
    split.setOneTouchExpandable(true);
    chooser.add("Center", split);

    // allow the split pane to completely hide the top panel
    panel.setMinimumSize(new Dimension(0, 0));
    
    JPanel charSetPanel = new JPanel(new PercentLayout(
        PercentLayout.HORIZONTAL, 2));
    label = new JLabel("CHARSET");
    label.setHorizontalAlignment(JLabel.RIGHT);
    charSetPanel.add(label, "*");

    charSetCombo = new JComboBox(chooser.getModel().getCharSets());
    charSetPanel.add(charSetCombo);
    // PENDING(fred) implement charset
    // chooser.add("South", charSetPanel);
  }

  protected void installListeners() {
    SelectedFontUpdater listener = new SelectedFontUpdater();
    fontList.addListSelectionListener(listener);
    fontEffectList.addListSelectionListener(listener);
    fontSizeList.addListSelectionListener(listener);
    fontSizeField.getDocument().addDocumentListener(listener);

    propertyListener = createPropertyChangeListener();
    chooser.addPropertyChangeListener(JFontChooser.SELECTED_FONT_CHANGED_KEY,
        propertyListener);
  }

  public void uninstallUI(JComponent c) {
    chooser.remove(fontPanel);
    chooser.remove(fontSizePanel);

    super.uninstallUI(c);
  }

  public void uninstallListeners() {
    chooser.removePropertyChangeListener(propertyListener);
  }

  protected PropertyChangeListener createPropertyChangeListener() {
    return new PropertyChangeListener() {

      public void propertyChange(PropertyChangeEvent evt) {
        updateDisplay();
      }
    };
  }

  private void updateDisplay() {
    Font selected = chooser.getSelectedFont();
    if (selected != null) {
      /** PENDING(fred) implement charset
      String charset = (String)charSetCombo.getSelectedItem();
      String text = chooser.getModel().getPreviewMessage(charset);
      boolean canDisplay = selected.canDisplayUpTo(text) == -1;
      if (canDisplay) {
        previewPanel.setText(text);
      } else {
        previewPanel.setText("Charset not supported");
      }
      **/
      previewPanel.setFont(selected);
      fontList.setSelectedValue(selected.getName(), true);
      fontSizeField.setText(String.valueOf(selected.getSize()));
      fontSizeList.setSelectedValue(String.valueOf(selected.getSize()), true);
      
      FontStyle style = new FontStyle(selected.getStyle(), null);
      fontEffectList.setSelectedValue(style, true);
      style = (FontStyle)fontEffectList.getSelectedValue();
      fontEffectField.setText(style.toString());
    }
  }

  private void updateSelectedFont() {
    Font currentFont = chooser.getSelectedFont();
    String fontFamily = currentFont == null?"SansSerif":currentFont.getName();
    int fontSize = currentFont == null?11:currentFont.getSize();

    if (fontList.getSelectedIndex() >= 0) {
      fontFamily = (String)fontList.getSelectedValue();
    }

    if (fontSizeField.getText().trim().length() > 0) {
      try {
        fontSize = Integer.parseInt(fontSizeField.getText().trim());
      } catch (Exception e) {
        // ignore the NumberFormatException
      }
    }

    Map attributes = new HashMap();
    attributes.put(TextAttribute.SIZE, new Float(fontSize));
    attributes.put(TextAttribute.FAMILY, fontFamily);

    FontStyle style = (FontStyle)fontEffectList.getSelectedValue();
    if (style != null) {
      if (style.isBold()) {
        attributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
      }
      if (style.isItalic()) {
        attributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
      }
    }

    Font font = Font.getFont(attributes);
    if (!font.equals(currentFont)) {
      chooser.setSelectedFont(font);
      previewPanel.setFont(font);
    }
  }

  private class SelectedFontUpdater
      implements
        ListSelectionListener,
        DocumentListener,
        ActionListener {

    public void valueChanged(ListSelectionEvent e) {
      if (fontList == e.getSource() && fontList.getSelectedValue() != null) {
        fontField.setText((String)fontList.getSelectedValue());
      }
      if (fontSizeList == e.getSource()
          && fontSizeList.getSelectedValue() != null) {
        fontSizeField.setText((String)fontSizeList.getSelectedValue());
      }
      updateSelectedFont();
    }

    public void changedUpdate(DocumentEvent e) {
      updateLater();
    }

    public void insertUpdate(DocumentEvent e) {
      updateLater();
    }

    public void removeUpdate(DocumentEvent e) {
      updateLater();
    }

    public void actionPerformed(ActionEvent e) {
      updateLater();
    }

    void updateLater() {
      SwingUtilities.invokeLater(new Runnable() {

        public void run() {
          updateSelectedFont();
        }
      });
    }
  }

  static private class FontStyle {

    String display;
    int value;

    public FontStyle(int value, String display) {
      this.value = value;
      this.display = display;
    }

    public int value() {
      return value;
    }

    public String toString() {
      return display;
    }

    public boolean isBold() {
      return (value & Font.BOLD) != 0;
    }

    public boolean isItalic() {
      return (value & Font.ITALIC) != 0;
    }
    
    public int hashCode() {
      return value;
    }
    
    public boolean equals(Object obj) {
      return (obj instanceof FontStyle) && (((FontStyle)obj).value == value);
    }
    
  }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产黑丝在线一区二区三区| 不卡影院免费观看| 国产成人精品三级| 在线观看中文字幕不卡| 久久综合色播五月| 亚洲乱码精品一二三四区日韩在线| 亚洲成年人网站在线观看| 激情图区综合网| 欧美性色黄大片| 国产日韩精品久久久| 日韩精品一二区| 国产69精品久久久久777| 欧美午夜精品一区二区蜜桃| 欧美—级在线免费片| 亚洲国产精品天堂| 粉嫩av一区二区三区粉嫩| 91在线视频在线| 国产精品视频yy9299一区| 日日骚欧美日韩| 欧美三区在线视频| 国产精品成人一区二区三区夜夜夜| 日韩av电影天堂| 91黄色激情网站| 国产精品网曝门| 国产一区二区三区四区五区入口 | 精品嫩草影院久久| 亚洲精品自拍动漫在线| caoporm超碰国产精品| 2022国产精品视频| 奇米影视7777精品一区二区| 91国内精品野花午夜精品| 国产精品视频一二三| 国产成人免费在线观看不卡| 精品少妇一区二区三区视频免付费| 亚洲午夜影视影院在线观看| 色综合久久久久网| 国产精品色哟哟网站| 高清成人在线观看| 国产精品午夜久久| 91小视频在线免费看| 国产精品久久久久一区| 成人午夜短视频| 一区二区三区不卡视频在线观看| 国产成人亚洲精品青草天美| www日韩大片| www.亚洲人| 亚洲欧美成aⅴ人在线观看| 色av成人天堂桃色av| 一区二区三区久久| 日韩一区和二区| 国产精品一区二区在线播放| 国产三级精品在线| 91色porny在线视频| 亚洲免费在线播放| 在线综合亚洲欧美在线视频| 免费成人av在线播放| 久久精品欧美一区二区三区麻豆 | 久久精品夜夜夜夜久久| 东方欧美亚洲色图在线| 亚洲精品午夜久久久| 在线欧美日韩精品| 蜜桃av一区二区三区| 久久精品在这里| 日本国产一区二区| 久久成人久久爱| 中文字幕制服丝袜一区二区三区| 欧美日韩在线播| 国产精品自拍av| 一区二区三区四区不卡视频| 欧美一区二区三区系列电影| 国产成人免费视频网站高清观看视频| 国产网红主播福利一区二区| 91免费观看在线| 亚洲成人先锋电影| 欧美一区二区日韩一区二区| 国产99久久久精品| 亚洲国产一区二区三区 | 最好看的中文字幕久久| 在线欧美小视频| 国产·精品毛片| 午夜av区久久| 国产亚洲一二三区| 在线播放亚洲一区| 91视频国产观看| 国产一区二区三区国产| 一区二区视频在线看| 久久免费偷拍视频| 欧美日韩一区高清| va亚洲va日韩不卡在线观看| 久久精品国产第一区二区三区| 亚洲色图欧美激情| 久久精品亚洲精品国产欧美kt∨| 欧美日韩精品二区第二页| 成人av网站免费观看| 久久www免费人成看片高清| 亚洲夂夂婷婷色拍ww47| 国产精品欧美久久久久一区二区 | 99精品视频一区| 国内久久精品视频| 秋霞电影一区二区| 亚洲午夜久久久久久久久电影院| 中文成人av在线| 国产午夜一区二区三区| 欧美成va人片在线观看| 69久久99精品久久久久婷婷| 91福利在线看| 91在线小视频| 91色在线porny| 色综合久久久久综合99| 色综合夜色一区| 91最新地址在线播放| 99久久免费视频.com| 国产suv精品一区二区6| 国产精品亚洲一区二区三区在线| 首页国产丝袜综合| 欧美96一区二区免费视频| 午夜免费欧美电影| 天天综合色天天综合色h| 一区二区三区在线播放| 樱桃视频在线观看一区| 一级日本不卡的影视| 夜色激情一区二区| 亚洲成人777| 婷婷成人激情在线网| 日本不卡高清视频| 看片网站欧美日韩| 国产精品综合视频| eeuss鲁片一区二区三区在线看| 成人激情黄色小说| 色婷婷精品大在线视频 | 不卡电影免费在线播放一区| 成人黄色电影在线 | 又紧又大又爽精品一区二区| 亚洲精品水蜜桃| 午夜精品久久久久久不卡8050| 日韩精品一卡二卡三卡四卡无卡| 免费高清视频精品| 国产成人免费视频网站高清观看视频 | 欧美精品丝袜中出| 欧美va亚洲va在线观看蝴蝶网| 久久久久青草大香线综合精品| 中文字幕不卡在线观看| 又紧又大又爽精品一区二区| 肉丝袜脚交视频一区二区| 激情国产一区二区| 91丨九色丨黑人外教| 欧美日韩国产成人在线免费| 欧美电视剧在线观看完整版| 欧美极品少妇xxxxⅹ高跟鞋| 亚洲精品v日韩精品| 蜜桃视频在线观看一区二区| 成人精品在线视频观看| 欧美色手机在线观看| 欧美精品一区二区精品网| 国产精品美女久久久久久| 亚洲成人www| 国产成人a级片| 欧美日本乱大交xxxxx| 久久精品亚洲国产奇米99| 亚洲精品菠萝久久久久久久| 精品一区二区三区在线播放视频| 91影视在线播放| 久久久综合激的五月天| 亚洲国产精品久久久男人的天堂| 国产麻豆视频一区| 欧美美女黄视频| 亚洲欧洲性图库| 国产在线播放一区| 欧美精品日日鲁夜夜添| 国产精品高清亚洲| 国产精品自拍av| 日韩欧美国产成人一区二区| 一区二区三区在线影院| 国产丶欧美丶日本不卡视频| 9191成人精品久久| 一区二区在线看| 91丨porny丨首页| 日韩免费一区二区三区在线播放| 亚洲精品一二三四区| 成人黄色免费短视频| 久久久久国产精品免费免费搜索| 香蕉av福利精品导航| 91亚洲国产成人精品一区二区三| 久久视频一区二区| 精品制服美女丁香| 91精品国产综合久久久久久| 一区二区三区91| 91美女视频网站| 中文字幕在线不卡一区 | 一本色道久久综合狠狠躁的推荐| 国产亚洲综合性久久久影院| 欧美a一区二区| 91精品在线免费| 丝袜亚洲另类欧美| 欧美日韩免费观看一区二区三区| 樱桃国产成人精品视频| 色噜噜狠狠成人网p站| 亚洲日本在线a| 在线观看视频一区| 亚洲美女精品一区|