1 53 54 package org.swixml; 55 56 import org.jdom.Attribute; 57 import org.swixml.converters.ImageIconConverter; 58 59 import javax.swing.*; 60 import java.util.StringTokenizer ; 61 62 69 70 public class XTabbedPane extends JTabbedPane { 71 72 80 public void setTitles( String titles ) { 81 StringTokenizer st = new StringTokenizer ( titles, "," ); 82 int n = st.countTokens(); 83 for (int i = 0; i < n; i++) { 84 super.setTitleAt( i, st.nextToken().trim() ); 85 } 86 } 87 88 89 112 public void setMnemonics( String mnemonics ) { 113 StringTokenizer st = new StringTokenizer ( mnemonics, "," ); 114 int n = st.countTokens(); 115 for (int i = 0; i < n; i++) { 116 super.setMnemonicAt( i, Integer.parseInt( st.nextToken().trim() ) ); 117 } 118 } 119 120 121 154 public void setDisplayedMnemonics( String displaymnemonics ) { 155 StringTokenizer st = new StringTokenizer ( displaymnemonics, "," ); 156 int n = st.countTokens(); 157 for (int i = 0; i < n; i++) { 158 super.setDisplayedMnemonicIndexAt( i, Integer.parseInt( st.nextToken().trim() ) ); 159 } 160 } 161 162 172 public void setEnabled( String enabled ) { 173 StringTokenizer st = new StringTokenizer ( enabled, "," ); 174 int n = st.countTokens(); 175 for (int i = 0; i < n; i++) { 176 super.setEnabledAt( i, Boolean.valueOf( st.nextToken().trim() ).booleanValue() ); 177 } 178 } 179 180 181 192 public void setToolTipTexts( String toolTipTexts ) { 193 StringTokenizer st = new StringTokenizer ( toolTipTexts, "," ); 194 int n = st.countTokens(); 195 for (int i = 0; i < n; i++) { 196 super.setToolTipTextAt( i, st.nextToken().trim() ); 197 } 198 } 199 200 201 213 public void setIcons( String icons ) { 214 StringTokenizer st = new StringTokenizer ( icons, "," ); 215 int n = st.countTokens(); 216 for (int i = 0; i < n; i++) { 217 Attribute attr = new Attribute( "icon", st.nextToken() ); 218 super.setIconAt( i, (ImageIcon) ImageIconConverter.conv( null, attr, null ) ); 219 } 220 } 221 222 223 234 public void setDisabledIcons( String icons ) { 235 StringTokenizer st = new StringTokenizer ( icons, "," ); 236 int n = st.countTokens(); 237 for (int i = 0; i < n; i++) { 238 Attribute attr = new Attribute( "icon", st.nextToken() ); 239 super.setDisabledIconAt( i, (ImageIcon) ImageIconConverter.conv( null, attr, null ) ); 240 } 241 } 242 } 243 244 | Popular Tags |