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

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

?? doublearrayeditorpanel.java

?? corejava第八版第一卷和第二卷的源代碼
?? JAVA
字號(hào):
/**
   @version 1.20 1999-09-28
   @author Cay Horstmann
*/

package com.horstmann.corejava;

import java.awt.*;
import java.awt.event.*;
import java.text.*;
import java.lang.reflect.*;
import java.beans.*;
import javax.swing.*;
import javax.swing.event.*;

/**
   The panel inside the DoubleArrayEditor. It contains
   a list of the array values, together with buttons to
   resize the array and change the currently selected list value.
*/
public class DoubleArrayEditorPanel extends JPanel
{
   public DoubleArrayEditorPanel(PropertyEditorSupport ed)
   {
      editor = ed;
      setArray((double[])ed.getValue());

      setLayout(new GridBagLayout());

      add(sizeField, new GBC(0, 0, 1, 1).setWeight(100, 0).setFill(GBC.HORIZONTAL));
      add(valueField, new GBC(0, 1, 1, 1).setWeight(100, 0).setFill(GBC.HORIZONTAL));
      add(sizeButton, new GBC(1, 0, 1, 1).setWeight(100, 0));
      add(valueButton, new GBC(1, 1, 1, 1).setWeight(100, 0));
      add(new JScrollPane(elementList), new GBC(0, 2, 2, 1).setWeight(100, 100).setFill(GBC.BOTH));

      sizeButton.addActionListener(new
         ActionListener()
         {
            public void actionPerformed(ActionEvent event) { changeSize(); }
         });

      valueButton.addActionListener(new
         ActionListener()
         {
            public void actionPerformed(ActionEvent event) { changeValue(); }
         });


      elementList.setSelectionMode(
         ListSelectionModel.SINGLE_SELECTION);

      elementList.addListSelectionListener(new
         ListSelectionListener()
         {
            public void valueChanged(ListSelectionEvent event)
            {
               int i = elementList.getSelectedIndex();
               if (i < 0) return;
               valueField.setText("" + array[i]);
            }
         });

      elementList.setModel(model);
      elementList.setSelectedIndex(0);
   }

   /**
      This method is called when the user wants to change
      the size of the array.
   */
   public void changeSize()
   {
      fmt.setParseIntegerOnly(true);
      int s = 0;
      try
      {
         s = fmt.parse(sizeField.getText()).intValue();
         if (s < 0) throw new ParseException("Out of bounds", 0);
      }
      catch (ParseException e)
      {
         JOptionPane.showMessageDialog(this, "" + e, "Input Error", JOptionPane.WARNING_MESSAGE);
         sizeField.requestFocus();
         return;
      }
      if (s == array.length) return;
      setArray((double[]) arrayGrow(array, s));
      editor.setValue(array);
      editor.firePropertyChange();
   }

   /**
      This method is called when the user wants to change
      the currently selected array value.
   */
   public void changeValue()
   {
      double v = 0;
      fmt.setParseIntegerOnly(false);
      try
      {
         v = fmt.parse(valueField.getText()).doubleValue();
      }
      catch (ParseException e)
      {
         JOptionPane.showMessageDialog(this, "" + e, "Input Error", JOptionPane.WARNING_MESSAGE);
         valueField.requestFocus();
         return;
      }
      int currentIndex = elementList.getSelectedIndex();
      setArray(currentIndex, v);
      editor.firePropertyChange();
   }

   /**
      Sets the indexed array property.
      @param v the array to edit
   */
   public void setArray(double[] v)
   {
      if (v == null) array = new double[0];
      else array = v;
      model.setArray(array);
      sizeField.setText("" + array.length);
      if (array.length > 0)
      {
         valueField.setText("" + array[0]);
         elementList.setSelectedIndex(0);
      }
      else
         valueField.setText("");
   }

   /**
      Gets the indexed array property.
      @return the array being edited
   */
   public double[] getArray()
   {
      return (double[]) array.clone();
   }

   /**
      Sets the indexed array property.
      @param i the index whose value to set
      @param value the new value for the given index
   */
   public void setArray(int i, double value)
   {
      if (0 <= i && i < array.length)
      {
         model.setValue(i, value);
         elementList.setSelectedIndex(i);
         valueField.setText("" + value);
      }
   }

   /**
      Gets the indexed array property.
      @param i the index whose value to get
      @return the value at the given index
   */
   public double getArray(int i)
   {
      if (0 <= i && i < array.length) return array[i];
      return 0;
   }

   /**
      Resizes an array
      @param a the array to grow
      @param newLength the new length
      @return an array with the given length and the same
      elements as a in the common positions
   */
   private static Object arrayGrow(Object a, int newLength)
   {
      Class cl = a.getClass();
      if (!cl.isArray()) return null;
      Class componentType = a.getClass().getComponentType();
      int length = Array.getLength(a);

      Object newArray = Array.newInstance(componentType, newLength);
      System.arraycopy(a, 0, newArray, 0, Math.min(length, newLength));
      return newArray;
   }

   private PropertyEditorSupport editor;
   private double[] array;
   private NumberFormat fmt = NumberFormat.getNumberInstance();
   private JTextField sizeField = new JTextField(4);
   private JTextField valueField = new JTextField(12);
   private JButton sizeButton = new JButton("Resize");
   private JButton valueButton = new JButton("Change");
   private JList elementList = new JList();
   private DoubleArrayListModel model = new DoubleArrayListModel();
}

/**
   The list model for the element list in the editor.
*/
class DoubleArrayListModel extends AbstractListModel
{
   public int getSize() { return array.length; }
   public Object getElementAt(int i) { return "[" + i + "] " + array[i]; }

   /**
      Sets a new array to be displayed in the list.
      @param a the new array
   */
   public void setArray(double[] a)
   {
      int oldLength = array == null ? 0 : array.length;
      array = a;
      int newLength = array == null ? 0 : array.length;
      if (oldLength > 0) fireIntervalRemoved(this, 0, oldLength);
      if (newLength > 0) fireIntervalAdded(this, 0, newLength);
   }

   /**
      Changes a value in the array to be displayed in the list.
      @param i the index whose value to change
      @param value the new value for the given index
   */
   public void setValue(int i, double value)
   {
      array[i] = value;
      fireContentsChanged(this, i, i);
   }

   private double[] array;
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美成人aa大片| 国产亚洲欧美激情| 国产a精品视频| 日韩精品乱码av一区二区| 国产三级三级三级精品8ⅰ区| 91免费精品国自产拍在线不卡 | 午夜久久久久久电影| 国产欧美日韩另类一区| 51精品国自产在线| 色欧美日韩亚洲| 国产成人在线电影| 久久超碰97中文字幕| 国产综合色精品一区二区三区| 亚洲蜜臀av乱码久久精品| 久久免费看少妇高潮| 日韩一二在线观看| 欧美日韩成人激情| 在线视频你懂得一区二区三区| 国产夫妻精品视频| 久久草av在线| 日本美女一区二区三区| 亚洲国产精品久久一线不卡| 亚洲区小说区图片区qvod| 国产精品网站在线观看| 久久综合九色综合97婷婷女人| 在线不卡的av| 欧美日本在线播放| 欧美色男人天堂| 欧美在线免费观看亚洲| 色婷婷综合久久久久中文一区二区| 风流少妇一区二区| 国产黄色精品网站| 韩国三级在线一区| 久久精品免费看| 老鸭窝一区二区久久精品| 日韩精品一二区| 热久久一区二区| 另类的小说在线视频另类成人小视频在线 | 日韩欧美中文字幕制服| 51午夜精品国产| 欧美美女bb生活片| 欧美一区二区成人| 日韩精品一区在线| 精品国产凹凸成av人网站| 欧美精品一区二区精品网| 2017欧美狠狠色| 欧美激情一区二区在线| 中文字幕一区二区三区四区 | 美国十次综合导航| 精品综合久久久久久8888| 精久久久久久久久久久| 国产91精品一区二区麻豆亚洲| 成人免费毛片app| 一本久久综合亚洲鲁鲁五月天| 91在线观看视频| 欧美三区在线观看| 欧美xingq一区二区| 久久天堂av综合合色蜜桃网| 国产喂奶挤奶一区二区三区| 奇米影视在线99精品| 黄色精品一二区| 国产sm精品调教视频网站| 99免费精品在线观看| 欧美亚一区二区| 日韩一本二本av| 国产欧美精品日韩区二区麻豆天美| 中文字幕免费不卡| 一区二区三区美女| 免费成人你懂的| 成人动漫一区二区| 欧美日韩国产123区| 久久精品亚洲乱码伦伦中文| 亚洲日本在线观看| 美女在线观看视频一区二区| 国产91精品在线观看| 欧美日韩一级视频| 国产欧美日韩视频一区二区 | 青青青伊人色综合久久| 成人午夜又粗又硬又大| 欧美日韩激情在线| 国产午夜精品一区二区三区嫩草| 一区二区三区四区激情| 日本欧美一区二区三区乱码| 成人免费毛片a| 6080亚洲精品一区二区| 中文字幕中文在线不卡住| 蜜桃精品视频在线| 99re这里都是精品| 欧美成人一级视频| 一区二区三区精品视频在线| 精品一区二区三区在线视频| 色女孩综合影院| 精品成人私密视频| 亚洲国产另类精品专区| 成人av电影在线| 精品福利视频一区二区三区| 一区二区三区日韩欧美精品| 国产精品自产自拍| 7777精品伊人久久久大香线蕉经典版下载 | 在线观看91av| 中文字幕亚洲综合久久菠萝蜜| 成人av网站在线观看免费| 制服丝袜国产精品| 亚洲视频图片小说| 国产福利91精品一区二区三区| 欧美精品123区| 亚洲桃色在线一区| 国产精品综合一区二区三区| 欧美一区二区三区播放老司机| 综合精品久久久| 国产一区二区精品在线观看| 91麻豆精品国产91久久久久久久久| 欧美精彩视频一区二区三区| 蜜桃av噜噜一区| 91精品国产欧美一区二区成人| 亚洲影视资源网| 色999日韩国产欧美一区二区| 国产欧美一二三区| 九九国产精品视频| 欧美成人vps| 久久国内精品自在自线400部| 欧美日韩一区二区欧美激情| 亚洲精品水蜜桃| 99综合电影在线视频| 欧美激情一区二区三区| 国产精品1024| 精品99999| 国模冰冰炮一区二区| 日韩精品一区二区三区在线| 午夜精品久久久久久久| 欧美主播一区二区三区| 亚洲免费观看高清完整版在线| 波多野结衣的一区二区三区| 国产精品素人一区二区| 盗摄精品av一区二区三区| 国产欧美日韩综合精品一区二区| 国产精品996| 欧美经典三级视频一区二区三区| 国产精品白丝jk白祙喷水网站| 国产亚洲短视频| 成人亚洲一区二区一| 国产精品久久综合| 一本色道久久综合精品竹菊| 亚洲久草在线视频| 欧美三级日韩三级国产三级| 香蕉加勒比综合久久| 欧美一卡二卡三卡四卡| 国产在线精品一区二区不卡了| 久久久精品免费观看| 成人av网站大全| 亚洲久本草在线中文字幕| 欧美日韩一区二区三区高清| 免费亚洲电影在线| 精品国产精品一区二区夜夜嗨| 激情综合网av| 国产精品视频一二三| 欧美综合一区二区| 奇米色777欧美一区二区| 久久色.com| 色香蕉成人二区免费| 蜜臀久久久久久久| 久久网站热最新地址| 99久精品国产| 日本不卡视频在线| 国产欧美一区二区精品性| 91麻豆精品秘密| 日韩精品一级中文字幕精品视频免费观看 | 久久综合九色综合久久久精品综合| 国产成人在线看| 一区二区三区波多野结衣在线观看| 91精品国产综合久久蜜臀| 国产成人高清在线| 香蕉久久夜色精品国产使用方法| 久久综合色综合88| 欧美亚洲免费在线一区| 久久99国产精品尤物| 亚洲视频你懂的| 精品日产卡一卡二卡麻豆| 91视频xxxx| 久久66热偷产精品| 综合中文字幕亚洲| 欧美一区二区三区人| www.av精品| 久久精品72免费观看| 亚洲美女电影在线| 精品久久久久一区| 在线观看一区二区精品视频| 国产成人精品免费网站| 亚洲午夜电影在线观看| 久久九九99视频| 91精品婷婷国产综合久久性色| 丁香激情综合五月| 久久精品国产精品亚洲红杏 | 亚洲精品成人少妇| 精品国产乱码久久久久久蜜臀| 欧美色视频在线| 成人国产精品免费观看| 九九视频精品免费| 香蕉久久夜色精品国产使用方法 | 天天综合色天天综合|