1 26 27 package org.objectweb.openccm.packaging.widgets; 28 29 36 public class SoftpkgVersion 37 extends org.objectweb.apollon.gui.bricks.AbstractBrick 38 { 39 45 49 50 59 60 private javax.swing.JTextField [] version_numbers 61 = { 62 new javax.swing.JTextField (), 63 new javax.swing.JTextField (), 64 new javax.swing.JTextField (), 65 new javax.swing.JTextField (), 66 }; 67 68 74 77 public 78 SoftpkgVersion () 79 { 80 this ("Version"); 81 } 82 83 86 public 87 SoftpkgVersion (String label) 88 { 89 super (label); 90 96 javax.swing.JPanel content = new javax.swing.JPanel (); 97 98 content.add(this.version_numbers[0]); 100 content.add(new javax.swing.JLabel (",")); 101 content.add(this.version_numbers[1]); 102 content.add(new javax.swing.JLabel (",")); 103 content.add(this.version_numbers[2]); 104 content.add(new javax.swing.JLabel (",")); 105 content.add(this.version_numbers[3]); 106 107 this.add(content); 109 } 110 111 117 120 public String 121 get() 122 { 123 124 String version 126 = version_numbers[0].getText() 127 +"," 128 + version_numbers[1].getText() 129 +"," 130 + version_numbers[2].getText() 131 +"," 132 + version_numbers[3].getText() 133 ; 134 138 148 149 return version; 150 } 151 152 155 public void 156 set(String formated_version) 157 { 158 159 163 175 java.util.StringTokenizer version_array; 176 if (formated_version != null) 177 { 178 version_array 179 = new java.util.StringTokenizer (formated_version,","); 180 } 181 else 182 { 183 version_array 184 = new java.util.StringTokenizer ("",","); 185 } 186 for (int i = 0 ; i < 4 ; i++) 187 { 188 if (version_array.hasMoreTokens()) 189 { 190 version_numbers[i].setText(version_array.nextToken()); 191 } 192 else 193 { 194 version_numbers[i].setText("0"); 195 } 196 } 197 } 198 199 } 200 | Popular Tags |