⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 titlepositioneditor.java

📁 java2核心技术(原书第七版)卷二:基础知识的配套源码
💻 JAVA
字号:
/**
   @version 1.11 2004-08-30
   @author Cay Horstmann
*/

package com.horstmann.corejava;

import java.beans.*;

/**
   A custom editor for the titlePosition property of the 
   ChartBean. The editor lets the user choose between
   Left, Center, and Right
*/
public class TitlePositionEditor
   extends PropertyEditorSupport
{  
   public String[] getTags() { return options; }
   private String[] options = { "Left", "Center", "Right" };
   public String getJavaInitializationString() { return "" + getValue(); }

   public String getAsText()
   {  
      int value = (Integer) getValue();
      return options[value];
   }

   public void setAsText(String s)
   {  
      for (int i = 0; i < options.length; i++)
      {  
         if (options[i].equals(s))
         {  
            setValue(i);
            return;
         }
      }
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -