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

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

?? propertysheettable.java

?? 精美開源Swing組件
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/**
 * 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.propertysheet;

import com.l2fprod.common.propertysheet.PropertySheetTableModel.Item;
import com.l2fprod.common.swing.HeaderlessColumnResizer;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyEditor;

import javax.swing.AbstractAction;
import javax.swing.CellEditor;
import javax.swing.Icon;
import javax.swing.JTable;
import javax.swing.KeyStroke;
import javax.swing.ListSelectionModel;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableModel;

/**
 * A table which allows the editing of Properties through
 * PropertyEditors. The PropertyEditors can be changed by using the
 * PropertyEditorRegistry.
 */
public class PropertySheetTable extends JTable {
  
  private static final int HOTSPOT_SIZE = 18;
  
  private static final String TREE_EXPANDED_ICON_KEY = "Tree.expandedIcon";
  private static final String TREE_COLLAPSED_ICON_KEY = "Tree.collapsedIcon";
  private static final String TABLE_BACKGROUND_COLOR_KEY = "Table.background";
  private static final String TABLE_FOREGROUND_COLOR_KEY = "Table.foreground";
  private static final String TABLE_SELECTED_BACKGROUND_COLOR_KEY = "Table.selectionBackground";
  private static final String TABLE_SELECTED_FOREGROUND_COLOR_KEY = "Table.selectionForeground";
  private static final String PANEL_BACKGROUND_COLOR_KEY = "Panel.background";

  private PropertyEditorFactory editorFactory;
  private PropertyRendererFactory rendererFactory;

  private TableCellRenderer nameRenderer;  
  
  private boolean wantsExtraIndent = false;
  
  /**
   * Cancel editing when editing row is changed
   */
  private TableModelListener cancelEditing;

  // Colors used by renderers
  private Color categoryBackground;
  private Color categoryForeground;
  private Color propertyBackground;
  private Color propertyForeground;
  private Color selectedPropertyBackground;
  private Color selectedPropertyForeground;
  private Color selectedCategoryBackground;
  private Color selectedCategoryForeground;
  
  public PropertySheetTable() {
    this(new PropertySheetTableModel());
  }

  public PropertySheetTable(PropertySheetTableModel dm) {
    super(dm);
    initDefaultColors();

    // select only one property at a time
    getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    // hide the table header, we do not need it
    Dimension nullSize = new Dimension(0, 0);
    getTableHeader().setPreferredSize(nullSize);
    getTableHeader().setMinimumSize(nullSize);
    getTableHeader().setMaximumSize(nullSize);
    getTableHeader().setVisible(false);

    // table header not being visible, make sure we can still resize the columns
    new HeaderlessColumnResizer(this);

    // default renderers and editors
    setRendererFactory(new PropertyRendererRegistry());
    setEditorFactory(new PropertyEditorRegistry());
    
    nameRenderer = new NameRenderer();
    
    // force the JTable to commit the edit when it losts focus
    putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    
    // only full rows can be selected
    setColumnSelectionAllowed(false);
    setRowSelectionAllowed(true);

    // replace the edit action to always trigger the editing of the value column
    getActionMap().put("startEditing", new StartEditingAction());
    
    // ensure navigating with "TAB" moves to the next row
    getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0),
      "selectNextRowCell");
    getInputMap().put(
      KeyStroke.getKeyStroke(KeyEvent.VK_TAB, KeyEvent.SHIFT_DOWN_MASK),
      "selectPreviousRowCell");
    
    // allow category toggle with SPACE and mouse
    getActionMap().put("toggle", new ToggleAction());
    getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0),
      "toggle");    
    addMouseListener(new ToggleMouseHandler());
  }

  /**
   * Initializes the default set of colors used by the PropertySheetTable.
   * 
   * @see #categoryBackground
   * @see #categoryForeground
   * @see #selectedCategoryBackground
   * @see #selectedCategoryForeground
   * @see #propertyBackground
   * @see #propertyForeground
   * @see #selectedPropertyBackground
   * @see #selectedPropertyForeground
   */
  private void initDefaultColors() {    
    this.categoryBackground = UIManager.getColor(PANEL_BACKGROUND_COLOR_KEY);
    this.categoryForeground = UIManager.getColor(TABLE_FOREGROUND_COLOR_KEY).darker().darker().darker();
    
    this.selectedCategoryBackground = categoryBackground.darker();
    this.selectedCategoryForeground = categoryForeground;
    
    this.propertyBackground = UIManager.getColor(TABLE_BACKGROUND_COLOR_KEY);
    this.propertyForeground = UIManager.getColor(TABLE_FOREGROUND_COLOR_KEY);
    
    this.selectedPropertyBackground = UIManager
      .getColor(TABLE_SELECTED_BACKGROUND_COLOR_KEY);
    this.selectedPropertyForeground = UIManager
      .getColor(TABLE_SELECTED_FOREGROUND_COLOR_KEY);
    
    setGridColor(categoryBackground);
  }
    
  
  public Color getCategoryBackground() {
    return categoryBackground;
  }

  /**
   * Sets the color used to paint a Category background.
   * 
   * @param categoryBackground
   */
  public void setCategoryBackground(Color categoryBackground) {
    this.categoryBackground = categoryBackground;
    repaint();
  }

  public Color getCategoryForeground() {
    return categoryForeground;
  }

  /**
   * Sets the color used to paint a Category foreground.
   * 
   * @param categoryForeground
   */
  public void setCategoryForeground(Color categoryForeground) {
    this.categoryForeground = categoryForeground;
    repaint();
  }

  public Color getSelectedCategoryBackground() {
    return selectedCategoryBackground;
  }

  /**
   * Sets the color used to paint a selected/focused Category background.
   * 
   * @param selectedCategoryBackground
   */
  public void setSelectedCategoryBackground(Color selectedCategoryBackground) {
    this.selectedCategoryBackground = selectedCategoryBackground;
    repaint();
  }

  public Color getSelectedCategoryForeground() {
    return selectedCategoryForeground;
  }

  /**
   * Sets the color used to paint a selected/focused Category foreground.
   * 
   * @param selectedCategoryForeground
   */
  public void setSelectedCategoryForeground(Color selectedCategoryForeground) {
    this.selectedCategoryForeground = selectedCategoryForeground;
    repaint();
  }

  public Color getPropertyBackground() {
    return propertyBackground;
  }

  /**
   * Sets the color used to paint a Property background.
   * 
   * @param propertyBackground
   */
  public void setPropertyBackground(Color propertyBackground) {
    this.propertyBackground = propertyBackground;
    repaint();
  }

  public Color getPropertyForeground() {
    return propertyForeground;
  }

  /**
   * Sets the color used to paint a Property foreground.
   * 
   * @param propertyForeground
   */
  public void setPropertyForeground(Color propertyForeground) {
    this.propertyForeground = propertyForeground;
    repaint();
  }

  public Color getSelectedPropertyBackground() {
    return selectedPropertyBackground;
  }

  /**
   * Sets the color used to paint a selected/focused Property background.
   * 
   * @param selectedPropertyBackground
   */
  public void setSelectedPropertyBackground(Color selectedPropertyBackground) {
    this.selectedPropertyBackground = selectedPropertyBackground;
    repaint();
  }

  public Color getSelectedPropertyForeground() {
    return selectedPropertyForeground;
  }

  /**
   * Sets the color used to paint a selected/focused Property foreground.
   * 
   * @param selectedPropertyForeground
   */
  public void setSelectedPropertyForeground(Color selectedPropertyForeground) {
    this.selectedPropertyForeground = selectedPropertyForeground;
    repaint();
  }

  public void setEditorFactory(PropertyEditorFactory factory) {
    editorFactory = factory;
  }

  public final PropertyEditorFactory getEditorFactory() {
    return editorFactory;
  }

  /**
   * @param registry
   * @deprecated use {@link #setEditorFactory(PropertyEditorFactory)}
   */
  public void setEditorRegistry(PropertyEditorRegistry registry) {
    setEditorFactory(registry);
  }

  /**
   * @deprecated use {@link #getEditorFactory()}
   * @throws ClassCastException if the current editor factory is not a
   *           PropertyEditorRegistry
   */
  public PropertyEditorRegistry getEditorRegistry() {
    return (PropertyEditorRegistry) editorFactory;
  }

  public void setRendererFactory(PropertyRendererFactory factory) {
    rendererFactory = factory;
  }

  public PropertyRendererFactory getRendererFactory() {
    return rendererFactory;
  }

  /**
   * @deprecated use {@link #setRendererFactory(PropertyRendererFactory)}
   * @param registry
   */
  public void setRendererRegistry(PropertyRendererRegistry registry) {
    setRendererFactory(registry);
  }

  /**
   * @deprecated use {@link #getRendererFactory()}
   * @throws ClassCastException if the current renderer factory is not a
   *           PropertyRendererRegistry
   */
  public PropertyRendererRegistry getRendererRegistry() {
    return (PropertyRendererRegistry) getRendererFactory();
  }

  /* (non-Javadoc)
   * @see javax.swing.JTable#isCellEditable(int, int)
   */
  public boolean isCellEditable(int row, int column) {
    // names are not editable
    if (column == 0) { return false; }

    PropertySheetTableModel.Item item = getSheetModel().getPropertySheetElement(row);
    return item.isProperty() && item.getProperty().isEditable();
  }

  /**
   * Gets the CellEditor for the given row and column. It uses the
   * editor registry to find a suitable editor for the property.
   * @see javax.swing.JTable#getCellEditor(int, int)
   */
  public TableCellEditor getCellEditor(int row, int column) {
    if (column == 0) { return null; }

    Item item = getSheetModel().getPropertySheetElement(row);
    if (!item.isProperty())
      return null;
    
    TableCellEditor result = null;
    Property propery = item.getProperty();
    PropertyEditor editor = getEditorFactory().createPropertyEditor(propery);
    if (editor != null)
      result = new CellEditorAdapter(editor);

    return result;
  }

  /* (non-Javadoc)
   * @see javax.swing.JTable#getCellRenderer(int, int)
   */
  public TableCellRenderer getCellRenderer(int row, int column) {
    PropertySheetTableModel.Item item = getSheetModel()
      .getPropertySheetElement(row);

    switch (column) {
      case PropertySheetTableModel.NAME_COLUMN:
        // name column gets a custom renderer
        return nameRenderer;

      case PropertySheetTableModel.VALUE_COLUMN: {
        if (!item.isProperty())
          return nameRenderer;

        // property value column gets the renderer from the factory
        Property property = item.getProperty();
        TableCellRenderer renderer = getRendererFactory().createTableCellRenderer(property);
        if (renderer == null)
          renderer = getCellRenderer(property.getType());
        return renderer;
      }
      default:
        // when will this happen, given the above?
        return super.getCellRenderer(row, column);
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人手机在线视频| 精品国产露脸精彩对白| 欧美福利视频一区| 国产日韩欧美电影| 日韩二区在线观看| 91色九色蝌蚪| 久久精品欧美一区二区三区不卡| 亚洲成a人v欧美综合天堂| 国产久卡久卡久卡久卡视频精品| 欧美三级在线播放| 亚洲免费毛片网站| 大尺度一区二区| 亚洲精品在线一区二区| 亚洲一区二区三区中文字幕| 成人性生交大片免费看中文| 精品国产髙清在线看国产毛片| 亚洲欧美另类在线| aa级大片欧美| 中文字幕一区二区视频| 国产一区二区三区高清播放| 日韩一级免费观看| 日韩黄色免费电影| 欧美女孩性生活视频| 亚洲午夜在线观看视频在线| 91偷拍与自偷拍精品| 国产精品国产a| 99久久er热在这里只有精品66| 久久久99免费| 国产成人欧美日韩在线电影| 精品91自产拍在线观看一区| 狠狠色综合播放一区二区| 精品久久久久久久久久久久包黑料| 蜜臀av性久久久久蜜臀aⅴ流畅| 欧美无砖专区一中文字| 亚洲自拍偷拍网站| 欧美日韩精品欧美日韩精品| 亚洲超碰精品一区二区| 欧美日本在线一区| 日日骚欧美日韩| 欧美一区二区成人6969| 久久99久久久久| 久久青草欧美一区二区三区| 国产美女久久久久| 久久精品欧美一区二区三区麻豆| 懂色av一区二区三区蜜臀| 国产欧美日韩久久| 99re视频精品| 亚洲一区二区三区在线播放| 在线电影一区二区三区| 韩国女主播一区| 亚洲丝袜美腿综合| 欧美伦理视频网站| 国产一区二区看久久| 成人免费视频在线观看| 欧美性感一区二区三区| 日本成人在线电影网| 久久久久久97三级| 日本电影欧美片| 麻豆精品蜜桃视频网站| 国产精品福利一区二区三区| 欧美日韩精品一二三区| 国产在线不卡视频| 亚洲三级免费电影| 欧美精品粉嫩高潮一区二区| 国产麻豆一精品一av一免费| 自拍偷拍亚洲激情| 日韩午夜激情av| av高清不卡在线| 蜜臀91精品一区二区三区| 国产精品久久久久久久久免费樱桃| 在线观看中文字幕不卡| 国产呦萝稀缺另类资源| 亚洲一区二区三区四区在线免费观看| 日韩一级大片在线| va亚洲va日韩不卡在线观看| 免费欧美在线视频| 一区二区三区四区在线播放 | 美女视频一区在线观看| 国产拍揄自揄精品视频麻豆 | 99这里只有久久精品视频| 亚洲成av人**亚洲成av**| 中文字幕精品一区| 日韩精品一区二区三区在线播放 | 一区二区三区日韩精品| 欧美成人精品高清在线播放 | 精品国产第一区二区三区观看体验| 91最新地址在线播放| 久久不见久久见免费视频7| 亚洲精品中文字幕在线观看| 久久久影视传媒| 日韩欧美中文字幕一区| 在线观看视频91| 成人av网在线| 成人综合在线视频| 麻豆成人久久精品二区三区红| 夜夜嗨av一区二区三区网页| 中文字幕不卡在线播放| 欧美成人伊人久久综合网| 欧美性猛交xxxx黑人交| 97久久精品人人爽人人爽蜜臀| 韩国一区二区三区| 麻豆国产一区二区| 五月婷婷欧美视频| 香蕉成人伊视频在线观看| 日日夜夜精品免费视频| 亚洲欧美乱综合| 亚洲男女一区二区三区| 亚洲青青青在线视频| 国产精品久久久久久久久果冻传媒| 久久精品免视看| 欧美韩国一区二区| 国产精品沙发午睡系列990531| 久久精品欧美一区二区三区麻豆| 日韩免费高清av| 欧美电视剧在线观看完整版| 日韩西西人体444www| 精品福利一区二区三区免费视频| 日韩一区二区三区四区| 日韩午夜av一区| 精品免费日韩av| 国产色综合一区| 中文字幕欧美日韩一区| 亚洲欧美中日韩| 亚洲一区二区三区中文字幕| 亚洲18色成人| 男人操女人的视频在线观看欧美| 美女网站一区二区| 国产高清无密码一区二区三区| 国产自产v一区二区三区c| 成人免费观看男女羞羞视频| av在线不卡免费看| 色噜噜久久综合| 91精品国模一区二区三区| 欧美一级二级三级蜜桃| 久久久久青草大香线综合精品| 欧美精品一区二区三区高清aⅴ| 欧美va亚洲va在线观看蝴蝶网| 国产欧美一区二区三区网站 | 99在线视频精品| 日本久久一区二区三区| 欧美日韩亚洲综合一区二区三区| 欧美卡1卡2卡| 国产视频在线观看一区二区三区| 最新国产成人在线观看| 日韩精品色哟哟| 国产一区二区三区美女| 91麻豆免费看片| 7777精品伊人久久久大香线蕉完整版 | 这里只有精品电影| 久久久精品国产免大香伊| 亚洲日本在线a| 天堂成人国产精品一区| 国产精品亚洲一区二区三区在线| 91国模大尺度私拍在线视频| 91麻豆精品国产91久久久久久久久| 久久精品日产第一区二区三区高清版| 一区二区三区中文字幕电影| 蜜臀av一区二区在线观看| 99视频精品免费视频| 日韩亚洲欧美高清| 国产精品美女久久久久久久| 午夜欧美一区二区三区在线播放| 国产精品中文字幕一区二区三区| 一本色道久久综合亚洲91| 精品日韩欧美一区二区| 一区二区三区加勒比av| 国产一区二区精品久久| 欧美日韩一区二区在线视频| 久久精品视频网| 麻豆精品一区二区三区| 欧美日韩国产在线观看| 亚洲欧洲韩国日本视频| 国产尤物一区二区在线| 欧美一区二区网站| 亚洲精品久久7777| www.欧美.com| 国产日韩精品一区二区三区| 日日嗨av一区二区三区四区| 日本韩国欧美国产| 亚洲国产高清在线| 国产精品一区二区久激情瑜伽| 欧美精品日韩精品| 一区二区三区在线免费视频| www.在线成人| 中文字幕av不卡| 国产一区 二区| 久久一区二区三区四区| 麻豆一区二区99久久久久| 欧美男同性恋视频网站| 亚洲一二三区不卡| 欧美午夜影院一区| 亚洲一二三四区不卡| 色婷婷久久综合| 一区二区三区国产精品| 在线免费观看一区| 亚洲精品中文字幕乱码三区| 97久久精品人人澡人人爽| 亚洲欧洲在线观看av| www.亚洲色图.com| 亚洲毛片av在线|