bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
protected void set_parameters(Applet app, Properties props) { useProperties(props); String[][] para = app.getParameterInfo(); if (para != null) { for (int i = 0; i < para.length; i++) { if (para [ i ] [ 0 ].equals(LISTEN_ON)) Port = Integer.parseInt(para [ i ] [ 1 ]); if (para [ i ] [ 0 ].equals(REFERENCE)) { StringTokenizer st = new StringTokenizer(para [ i ] [ 1 ], "="); initial_references.put(st.nextToken(), string_to_object(st.nextToken()) ); } if (para [ i ] [ 0 ].equals(NS_HOST)) ns_host = para [ i ] [ 1 ]; if (para [ i ] [ 0 ].equals(START_READING_MESSAGE)) TOUT_START_READING_MESSAGE = Integer.parseInt(para [ i ] [ 1 ]); if (para [ i ] [ 0 ].equals(WHILE_READING)) TOUT_WHILE_READING = Integer.parseInt(para [ i ] [ 1 ]); if (para [ i ] [ 0 ].equals(AFTER_RECEIVING)) TOUT_AFTER_RECEIVING = Integer.parseInt(para [ i ] [ 1 ]); try { if (para [ i ] [ 0 ].equals(NS_PORT)) ns_port = Integer.parseInt(para [ i ] [ 1 ]); } catch (NumberFormatException ex) { BAD_PARAM bad = new BAD_PARAM("Invalid " + NS_PORT + "property, unable to parse '" + props.getProperty(NS_PORT) + "'" ); bad.initCause(ex); throw bad; } } } }
|
protected void set_parameters(Applet app, Properties props) { useProperties(props); String[][] para = app.getParameterInfo(); if (para != null) { for (int i = 0; i < para.length; i++) { if (para [ i ] [ 0 ].equals(LISTEN_ON)) Port = Integer.parseInt(para [ i ] [ 1 ]); if (para [ i ] [ 0 ].equals(REFERENCE)) { StringTokenizer st = new StringTokenizer(para [ i ] [ 1 ], "="); initial_references.put(st.nextToken(), string_to_object(st.nextToken()) ); } if (para [ i ] [ 0 ].equals(NS_HOST)) ns_host = para [ i ] [ 1 ]; if (para [ i ] [ 0 ].equals(START_READING_MESSAGE)) TOUT_START_READING_MESSAGE = Integer.parseInt(para [ i ] [ 1 ]); if (para [ i ] [ 0 ].equals(WHILE_READING)) TOUT_WHILE_READING = Integer.parseInt(para [ i ] [ 1 ]); if (para [ i ] [ 0 ].equals(AFTER_RECEIVING)) TOUT_AFTER_RECEIVING = Integer.parseInt(para [ i ] [ 1 ]); try { if (para [ i ] [ 0 ].equals(NS_PORT)) ns_port = Integer.parseInt(para [ i ] [ 1 ]); } catch (NumberFormatException ex) { BAD_PARAM bad = new BAD_PARAM("Invalid " + NS_PORT + "property, unable to parse '" + props.getProperty(NS_PORT) + "'" ); bad.initCause(ex); throw bad; } } } }
| 15,636
|
private void formatInternal (double number, FormatBuffer dest, FieldPosition fieldPos) { // A very special case. if (Double.isNaN(number)) { dest.append(symbols.getNaN()); if (fieldPos != null && (fieldPos.getField() == INTEGER_FIELD || fieldPos.getFieldAttribute() == NumberFormat.Field.INTEGER)) { int index = dest.length(); fieldPos.setBeginIndex(index - symbols.getNaN().length()); fieldPos.setEndIndex(index); } return; } boolean is_neg = number < 0; if (is_neg) { if (negativePrefix != null) { dest.append(substituteCurrency(negativePrefix, number), negativePrefixRanges, negativePrefixAttrs); } else { dest.append(symbols.getMinusSign(), NumberFormat.Field.SIGN); dest.append(substituteCurrency(positivePrefix, number), positivePrefixRanges, positivePrefixAttrs); } number = - number; } else { dest.append(substituteCurrency(positivePrefix, number), positivePrefixRanges, positivePrefixAttrs); } int integerBeginIndex = dest.length(); int integerEndIndex = 0; int zeroStart = symbols.getZeroDigit() - '0'; if (Double.isInfinite (number)) { dest.append(symbols.getInfinity()); integerEndIndex = dest.length(); } else { number *= multiplier; // Compute exponent. long exponent = 0; double baseNumber; if (useExponentialNotation) { exponent = (long) Math.floor (Math.log(number) / Math.log(10)); exponent = exponent - (exponent % exponentRound); if (minimumIntegerDigits > 0) exponent -= minimumIntegerDigits - 1; baseNumber = (number / Math.pow(10.0, exponent)); } else baseNumber = number; // Round to the correct number of digits. baseNumber += 5 * Math.pow(10.0, - maximumFractionDigits - 1); int index = dest.length(); //double intPart = Math.floor(baseNumber); String intPart = Long.toString((long)Math.floor(baseNumber)); int count, groupPosition = intPart.length(); dest.setDefaultAttribute(NumberFormat.Field.INTEGER); for (count = 0; count < minimumIntegerDigits-intPart.length(); count++) dest.append(symbols.getZeroDigit()); for (count = 0; count < maximumIntegerDigits && count < intPart.length(); count++) { int dig = intPart.charAt(count); // Append group separator if required. if (groupingUsed && count > 0 && groupingSize != 0 && groupPosition % groupingSize == 0) { dest.append(symbols.getGroupingSeparator(), NumberFormat.Field.GROUPING_SEPARATOR); dest.setDefaultAttribute(NumberFormat.Field.INTEGER); } dest.append((char) (zeroStart + dig)); groupPosition--; } dest.setDefaultAttribute(null); integerEndIndex = dest.length(); int decimal_index = integerEndIndex; int consecutive_zeros = 0; int total_digits = 0; int localMaximumFractionDigits = maximumFractionDigits; if (useExponentialNotation) localMaximumFractionDigits += minimumIntegerDigits - count; // Strip integer part from NUMBER. double fracPart = baseNumber - Math.floor(baseNumber); if ( ((fracPart != 0 || minimumFractionDigits > 0) && localMaximumFractionDigits > 0) || decimalSeparatorAlwaysShown) { dest.append (symbols.getDecimalSeparator(), NumberFormat.Field.DECIMAL_SEPARATOR); } int fraction_begin = dest.length(); dest.setDefaultAttribute(NumberFormat.Field.FRACTION); for (count = 0; count < localMaximumFractionDigits && (fracPart != 0 || count < minimumFractionDigits); ++count) { ++total_digits; fracPart *= 10; long dig = (long) fracPart; if (dig == 0) ++consecutive_zeros; else consecutive_zeros = 0; dest.append((char) (symbols.getZeroDigit() + dig)); // Strip integer part from FRACPART. fracPart = fracPart - Math.floor (fracPart); } // Strip extraneous trailing `0's. We can't always detect // these in the loop. int extra_zeros = Math.min (consecutive_zeros, total_digits - minimumFractionDigits); if (extra_zeros > 0) { dest.cutTail(extra_zeros); total_digits -= extra_zeros; if (total_digits == 0 && !decimalSeparatorAlwaysShown) dest.cutTail(1); } if (fieldPos != null && fieldPos.getField() == FRACTION_FIELD) { fieldPos.setBeginIndex(fraction_begin); fieldPos.setEndIndex(dest.length()); } // Finally, print the exponent. if (useExponentialNotation) { dest.append(symbols.getExponential(), NumberFormat.Field.EXPONENT_SYMBOL); if (exponent < 0) { dest.append (symbols.getMinusSign (), NumberFormat.Field.EXPONENT_SIGN); exponent = - exponent; } index = dest.length(); dest.setDefaultAttribute(NumberFormat.Field.EXPONENT); String exponentString = Long.toString ((long) exponent); for (count = 0; count < minExponentDigits-exponentString.length(); count++) dest.append((char) symbols.getZeroDigit()); for (count = 0; count < exponentString.length(); ++count) { int dig = exponentString.charAt(count); dest.append((char) (zeroStart + dig)); } } } if (fieldPos != null && (fieldPos.getField() == INTEGER_FIELD || fieldPos.getFieldAttribute() == NumberFormat.Field.INTEGER)) { fieldPos.setBeginIndex(integerBeginIndex); fieldPos.setEndIndex(integerEndIndex); } if (is_neg && negativeSuffix != null) { dest.append(substituteCurrency(negativeSuffix, number), negativeSuffixRanges, negativeSuffixAttrs); } else { dest.append(substituteCurrency(positiveSuffix, number), positiveSuffixRanges, positiveSuffixAttrs); } }
|
private void formatInternal (double number, FormatBuffer dest, FieldPosition fieldPos) { // A very special case. if (Double.isNaN(number)) { dest.append(symbols.getNaN()); if (fieldPos != null && (fieldPos.getField() == INTEGER_FIELD || fieldPos.getFieldAttribute() == NumberFormat.Field.INTEGER)) { int index = dest.length(); fieldPos.setBeginIndex(index - symbols.getNaN().length()); fieldPos.setEndIndex(index); } return; } boolean is_neg = number < 0; if (is_neg) { if (negativePrefix != null) { dest.append(substituteCurrency(negativePrefix, number), negativePrefixRanges, negativePrefixAttrs); } else { dest.append(symbols.getMinusSign(), NumberFormat.Field.SIGN); dest.append(substituteCurrency(positivePrefix, number), positivePrefixRanges, positivePrefixAttrs); } number = - number; } else { dest.append(substituteCurrency(positivePrefix, number), positivePrefixRanges, positivePrefixAttrs); } int integerBeginIndex = dest.length(); int integerEndIndex = 0; int zeroStart = symbols.getZeroDigit() - '0'; if (Double.isInfinite (number)) { dest.append(symbols.getInfinity()); integerEndIndex = dest.length(); } else { number *= multiplier; // Compute exponent. long exponent = 0; double baseNumber; if (useExponentialNotation && number > 0) { exponent = (long) Math.floor (Math.log(number) / Math.log(10)); exponent = exponent - (exponent % exponentRound); if (minimumIntegerDigits > 0) exponent -= minimumIntegerDigits - 1; baseNumber = (number / Math.pow(10.0, exponent)); } else baseNumber = number; // Round to the correct number of digits. baseNumber += 5 * Math.pow(10.0, - maximumFractionDigits - 1); int index = dest.length(); //double intPart = Math.floor(baseNumber); String intPart = Long.toString((long)Math.floor(baseNumber)); int count, groupPosition = intPart.length(); dest.setDefaultAttribute(NumberFormat.Field.INTEGER); for (count = 0; count < minimumIntegerDigits-intPart.length(); count++) dest.append(symbols.getZeroDigit()); for (count = 0; count < maximumIntegerDigits && count < intPart.length(); count++) { int dig = intPart.charAt(count); // Append group separator if required. if (groupingUsed && count > 0 && groupingSize != 0 && groupPosition % groupingSize == 0) { dest.append(symbols.getGroupingSeparator(), NumberFormat.Field.GROUPING_SEPARATOR); dest.setDefaultAttribute(NumberFormat.Field.INTEGER); } dest.append((char) (zeroStart + dig)); groupPosition--; } dest.setDefaultAttribute(null); integerEndIndex = dest.length(); int decimal_index = integerEndIndex; int consecutive_zeros = 0; int total_digits = 0; int localMaximumFractionDigits = maximumFractionDigits; if (useExponentialNotation && number > 0) localMaximumFractionDigits += minimumIntegerDigits - count; // Strip integer part from NUMBER. double fracPart = baseNumber - Math.floor(baseNumber); if ( ((fracPart != 0 || minimumFractionDigits > 0) && localMaximumFractionDigits > 0) || decimalSeparatorAlwaysShown) { dest.append (symbols.getDecimalSeparator(), NumberFormat.Field.DECIMAL_SEPARATOR); } int fraction_begin = dest.length(); dest.setDefaultAttribute(NumberFormat.Field.FRACTION); for (count = 0; count < localMaximumFractionDigits && (fracPart != 0 || count < minimumFractionDigits); ++count) { ++total_digits; fracPart *= 10; long dig = (long) fracPart; if (dig == 0) ++consecutive_zeros; else consecutive_zeros = 0; dest.append((char) (symbols.getZeroDigit() + dig)); // Strip integer part from FRACPART. fracPart = fracPart - Math.floor (fracPart); } // Strip extraneous trailing `0's. We can't always detect // these in the loop. int extra_zeros = Math.min (consecutive_zeros, total_digits - minimumFractionDigits); if (extra_zeros > 0) { dest.cutTail(extra_zeros); total_digits -= extra_zeros; if (total_digits == 0 && !decimalSeparatorAlwaysShown) dest.cutTail(1); } if (fieldPos != null && fieldPos.getField() == FRACTION_FIELD) { fieldPos.setBeginIndex(fraction_begin); fieldPos.setEndIndex(dest.length()); } // Finally, print the exponent. if (useExponentialNotation && number > 0) { dest.append(symbols.getExponential(), NumberFormat.Field.EXPONENT_SYMBOL); if (exponent < 0) { dest.append (symbols.getMinusSign (), NumberFormat.Field.EXPONENT_SIGN); exponent = - exponent; } index = dest.length(); dest.setDefaultAttribute(NumberFormat.Field.EXPONENT); String exponentString = Long.toString ((long) exponent); for (count = 0; count < minExponentDigits-exponentString.length(); count++) dest.append((char) symbols.getZeroDigit()); for (count = 0; count < exponentString.length(); ++count) { int dig = exponentString.charAt(count); dest.append((char) (zeroStart + dig)); } } } if (fieldPos != null && (fieldPos.getField() == INTEGER_FIELD || fieldPos.getFieldAttribute() == NumberFormat.Field.INTEGER)) { fieldPos.setBeginIndex(integerBeginIndex); fieldPos.setEndIndex(integerEndIndex); } if (is_neg && negativeSuffix != null) { dest.append(substituteCurrency(negativeSuffix, number), negativeSuffixRanges, negativeSuffixAttrs); } else { dest.append(substituteCurrency(positiveSuffix, number), positiveSuffixRanges, positiveSuffixAttrs); } }
| 15,638
|
public JTree() { this(createTreeModel(null)); }
|
public JTree() { this(getDefaultTreeModel()); }
| 15,640
|
public void setModel(TreeModel model) { if (treeModel == model) return; // add treeModelListener to the new model if (treeModelListener == null) treeModelListener = createTreeModelListener(); if (model != null) // as setModel(null) is allowed model.addTreeModelListener(treeModelListener); TreeModel oldValue = treeModel; treeModel = model; firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model); updateUI(); }
|
public void setModel(TreeModel model) { if (treeModel == model) return; // add treeModelListener to the new model if (treeModelListener == null) treeModelListener = createTreeModelListener(); if (model != null) // as setModel(null) is allowed model.addTreeModelListener(treeModelListener); TreeModel oldValue = treeModel; treeModel = model; firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model); }
| 15,641
|
public void add(int field, int amount) { switch (field) { case YEAR: complete(); fields[YEAR] += amount; isTimeSet = false; break; case MONTH: complete(); int months = fields[MONTH] + amount; fields[YEAR] += months / 12; fields[MONTH] = months % 12; if (fields[MONTH] < 0) { fields[MONTH] += 12; fields[YEAR]--; } isTimeSet = false; int maxDay = getActualMaximum(DAY_OF_MONTH); if (fields[DAY_OF_MONTH] > maxDay) { fields[DAY_OF_MONTH] = maxDay; isTimeSet = false; } break; case DAY_OF_MONTH: case DAY_OF_YEAR: case DAY_OF_WEEK: if (! isTimeSet) computeTime(); time += amount * (24 * 60 * 60 * 1000L); areFieldsSet = false; break; case WEEK_OF_YEAR: case WEEK_OF_MONTH: case DAY_OF_WEEK_IN_MONTH: if (! isTimeSet) computeTime(); time += amount * (7 * 24 * 60 * 60 * 1000L); areFieldsSet = false; break; case AM_PM: if (! isTimeSet) computeTime(); time += amount * (12 * 60 * 60 * 1000L); areFieldsSet = false; break; case HOUR: case HOUR_OF_DAY: if (! isTimeSet) computeTime(); time += amount * (60 * 60 * 1000L); areFieldsSet = false; break; case MINUTE: if (! isTimeSet) computeTime(); time += amount * (60 * 1000L); areFieldsSet = false; break; case SECOND: if (! isTimeSet) computeTime(); time += amount * (1000L); areFieldsSet = false; break; case MILLISECOND: if (! isTimeSet) computeTime(); time += amount; areFieldsSet = false; break; case ZONE_OFFSET: case DST_OFFSET:default: throw new IllegalArgumentException("Invalid or unknown field"); } }
|
public void add(int field, int amount) { switch (field) { case YEAR: complete(); fields[YEAR] += amount; break; case MONTH: complete(); int months = fields[MONTH] + amount; fields[YEAR] += months / 12; fields[MONTH] = months % 12; if (fields[MONTH] < 0) { fields[MONTH] += 12; fields[YEAR]--; } int maxDay = getActualMaximum(DAY_OF_MONTH); if (fields[DAY_OF_MONTH] > maxDay) { fields[DAY_OF_MONTH] = maxDay; } break; case DAY_OF_MONTH: case DAY_OF_YEAR: case DAY_OF_WEEK: if (! isTimeSet) computeTime(); time += amount * (24 * 60 * 60 * 1000L); areFieldsSet = false; break; case WEEK_OF_YEAR: case WEEK_OF_MONTH: case DAY_OF_WEEK_IN_MONTH: if (! isTimeSet) computeTime(); time += amount * (7 * 24 * 60 * 60 * 1000L); areFieldsSet = false; break; case AM_PM: if (! isTimeSet) computeTime(); time += amount * (12 * 60 * 60 * 1000L); areFieldsSet = false; break; case HOUR: case HOUR_OF_DAY: if (! isTimeSet) computeTime(); time += amount * (60 * 60 * 1000L); areFieldsSet = false; break; case MINUTE: if (! isTimeSet) computeTime(); time += amount * (60 * 1000L); areFieldsSet = false; break; case SECOND: if (! isTimeSet) computeTime(); time += amount * (1000L); areFieldsSet = false; break; case MILLISECOND: if (! isTimeSet) computeTime(); time += amount; areFieldsSet = false; break; case ZONE_OFFSET: case DST_OFFSET:default: throw new IllegalArgumentException("Invalid or unknown field"); } }
| 15,642
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH] && (! isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR])) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 15,644
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 15,645
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 15,646
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs -= 7 - daysInFirstWeek; month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 15,647
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek(); if (offs < 0) offs += 7; day += offs; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek(); if (offs < 0) offs += 7; day += offs; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 15,648
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int millisInDay = 0; int era = fields[ERA]; int year = fields[YEAR]; int month = fields[MONTH]; int day = fields[DAY_OF_MONTH]; int minute = fields[MINUTE]; int second = fields[SECOND]; int millis = fields[MILLISECOND]; int[] month_days = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int hour = 0; if (! isLenient()) nonLeniencyCheck(); if (! isSet[MONTH]) { // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR if (isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]) { int first = getFirstDayOfMonth(year, 0); int offs; if ((8 - first) >= getMinimalDaysInFirstWeek()) // start counting on first week offs = 1; else offs = 1 + (8 - first); month = 0; day = offs + 7 * (fields[WEEK_OF_YEAR] - 1); day += fields[DAY_OF_WEEK] - first; } else { // 4: YEAR + DAY_OF_YEAR month = 0; day = fields[DAY_OF_YEAR]; } } else { if (isSet[DAY_OF_WEEK]) { int first = getFirstDayOfMonth(year, month); // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK day = 1 + 7 * (fields[WEEK_OF_MONTH] - 1); day += fields[DAY_OF_WEEK] - first; } } // 1: YEAR + MONTH + DAY_OF_MONTH } if (era == BC && year > 0) year = 1 - year; // rest of code assumes day/month/year set // should negative BC years be AD? // get the hour (but no check for validity) if (isSet[HOUR]) { hour = fields[HOUR]; if (fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (fields[AM_PM] == AM && hour == 12) hour = 0; } else hour = fields[HOUR_OF_DAY]; // Read the era,year,month,day fields and convert as appropriate. // Calculate number of milliseconds into the day // This takes care of both h, m, s, ms over/underflows. long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; day += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); if (month < 0) { year += (int) month / 12; month = month % 12; if (month < 0) { month += 12; year--; } } if (month > 11) { year += (month / 12); month = month % 12; } month_days[1] = isLeapYear(year) ? 29 : 28; while (day <= 0) { if (month == 0) { year--; month_days[1] = isLeapYear(year) ? 29 : 28; } month = (month + 11) % 12; day += month_days[month]; } while (day > month_days[month]) { day -= (month_days[month]); month = (month + 1) % 12; if (month == 0) { year++; month_days[1] = isLeapYear(year) ? 29 : 28; } } // ok, by here we have valid day,month,year,era and millisinday int dayOfYear = dayCount[month] + day - 1; // (day starts on 1) if (isLeapYear(year) && month > 1) dayOfYear++; int relativeDay = (year - 1) * 365 + ((year - 1) >> 2) + dayOfYear - EPOCH_DAYS; // gregorian days from 1 to epoch. int gregFactor = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); if ((relativeDay + gregFactor) * 60L * 60L * 24L * 1000L >= gregorianCutover) relativeDay += gregFactor; else relativeDay -= 2; time = relativeDay * (24 * 60 * 60 * 1000L) + millisInDay; // the epoch was a Thursday. int weekday = (int) (relativeDay + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // Time zone corrections. TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 15,649
|
public Color getForeground() { if (foreground != null) return foreground; return parent == null ? SystemColor.windowText : parent.getForeground(); }
|
public Color getForeground() { if (foreground != null) return foreground; return parent == null ? null : parent.getForeground(); }
| 15,652
|
public Dimension getMaximumSize() { return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); }
|
public Dimension getMaximumSize() { return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE); }
| 15,653
|
public boolean isShowing() { if (! visible || peer == null) return false; return parent == null ? true : parent.isShowing(); }
|
public boolean isShowing() { if (! visible || peer == null) return false; return parent == null ? false : parent.isShowing(); }
| 15,656
|
public void requestFocus () { if (isDisplayable () && isShowing () && isFocusable ()) { synchronized (getTreeLock ()) { // Find this Component's top-level ancestor. Container parent = getParent (); while (parent != null && !(parent instanceof Window)) parent = parent.getParent (); Window toplevel = (Window) parent; if (toplevel.isFocusableWindow ()) { if (peer != null && !isLightweight()) // This call will cause a FOCUS_GAINED event to be // posted to the system event queue if the native // windowing system grants the focus request. peer.requestFocus (); else { // Either our peer hasn't been created yet or we're a // lightweight component. In either case we want to // post a FOCUS_GAINED event. EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue (); synchronized (eq) { KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); Component currentFocusOwner = manager.getGlobalPermanentFocusOwner (); if (currentFocusOwner != null) { eq.postEvent (new FocusEvent(currentFocusOwner, FocusEvent.FOCUS_LOST, false, this)); eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, false, currentFocusOwner)); } else eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, false)); } } } else pendingFocusRequest = new FocusEvent(this, FocusEvent.FOCUS_GAINED); } } }
|
public void requestFocus () { if (isDisplayable () && isShowing () && isFocusable ()) { synchronized (getTreeLock ()) { // Find this Component's top-level ancestor. Container parent = (this instanceof Container) ? (Container) this : getParent(); while (parent != null && !(parent instanceof Window)) parent = parent.getParent (); Window toplevel = (Window) parent; if (toplevel.isFocusableWindow ()) { if (peer != null && !isLightweight()) // This call will cause a FOCUS_GAINED event to be // posted to the system event queue if the native // windowing system grants the focus request. peer.requestFocus (); else { // Either our peer hasn't been created yet or we're a // lightweight component. In either case we want to // post a FOCUS_GAINED event. EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue (); synchronized (eq) { KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); Component currentFocusOwner = manager.getGlobalPermanentFocusOwner (); if (currentFocusOwner != null) { eq.postEvent (new FocusEvent(currentFocusOwner, FocusEvent.FOCUS_LOST, false, this)); eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, false, currentFocusOwner)); } else eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, false)); } } } else pendingFocusRequest = new FocusEvent(this, FocusEvent.FOCUS_GAINED); } } }
| 15,657
|
public void setExceptionListener(ExceptionListener listener) { exceptionListener = (listener != null) ? listener : new ExceptionListener() { public void exceptionThrown(Exception e) { System.err.println("exception thrown: " + e); e.printStackTrace(); } }; }
|
public void setExceptionListener(ExceptionListener listener) { exceptionListener = (listener != null) ? listener : new ExceptionListener() { public void exceptionThrown(Exception e) { System.err.println("exception thrown: " + e); } }; }
| 15,660
|
public void exceptionThrown(Exception e) { System.err.println("exception thrown: " + e); e.printStackTrace(); }
|
public void exceptionThrown(Exception e) { System.err.println("exception thrown: " + e); }
| 15,661
|
private static void setupDefaultPersistenceDelegates() { synchronized (delegates) { if (defaultPersistenceDelegate != null) return; delegates.put(Class.class, new ClassPersistenceDelegate()); PersistenceDelegate pd = new PrimitivePersistenceDelegate(); delegates.put(Boolean.class, pd); delegates.put(Byte.class, pd); delegates.put(Short.class, pd); delegates.put(Integer.class, pd); delegates.put(Long.class, pd); delegates.put(Float.class, pd); delegates.put(Double.class, pd); delegates.put(Object[].class, new ArrayPersistenceDelegate()); pd = new CollectionPersistenceDelegate(); delegates.put(ArrayList.class, pd); delegates.put(LinkedList.class, pd); delegates.put(Vector.class, pd); delegates.put(HashSet.class, pd); delegates.put(LinkedHashSet.class, pd); delegates.put(TreeSet.class, pd); pd = new MapPersistenceDelegate(); delegates.put(HashMap.class, pd); delegates.put(TreeMap.class, pd); delegates.put(java.util.Hashtable.class, pd); delegates.put(java.util.IdentityHashMap.class, pd); delegates.put(java.util.LinkedHashMap.class, pd); delegates.put(java.util.Properties.class, pd); delegates.put(java.awt.RenderingHints.class, pd); delegates.put(java.util.WeakHashMap.class, pd); delegates.put(javax.swing.UIDefaults.class, pd); // TODO: These classes need to be implemented first //delegates.put(java.security.AuthProvider.class, pd); //delegates.put(java.util.concurrent.ConcurrentHashMap.class, pd); //delegates.put(java.util.EnumMap.class, pd); //delegates.put(javax.management.openmbean.TabularDataSupport.class, pd); defaultPersistenceDelegate = new DefaultPersistenceDelegate(); delegates.put(Object.class, defaultPersistenceDelegate); // Creates a PersistenceDelegate implementation which is // returned for 'null'. In practice this instance is // not used in any way and is just here to be compatible // with the reference implementation which returns a // similar instance when calling getPersistenceDelegate(null) . fakePersistenceDelegate = new PersistenceDelegate() { protected Expression instantiate(Object o, Encoder e) { return null; } }; } }
|
private static void setupDefaultPersistenceDelegates() { synchronized (delegates) { if (defaultPersistenceDelegate != null) return; delegates.put(Class.class, new ClassPersistenceDelegate()); PersistenceDelegate pd = new PrimitivePersistenceDelegate(); delegates.put(Boolean.class, pd); delegates.put(Byte.class, pd); delegates.put(Short.class, pd); delegates.put(Integer.class, pd); delegates.put(Long.class, pd); delegates.put(Float.class, pd); delegates.put(Double.class, pd); delegates.put(Object[].class, new ArrayPersistenceDelegate()); pd = new CollectionPersistenceDelegate(); delegates.put(ArrayList.class, pd); delegates.put(LinkedList.class, pd); delegates.put(Vector.class, pd); delegates.put(HashSet.class, pd); delegates.put(LinkedHashSet.class, pd); delegates.put(TreeSet.class, pd); pd = new MapPersistenceDelegate(); delegates.put(HashMap.class, pd); delegates.put(TreeMap.class, pd); delegates.put(java.util.Hashtable.class, pd); delegates.put(java.util.IdentityHashMap.class, pd); delegates.put(java.util.LinkedHashMap.class, pd); delegates.put(java.util.Properties.class, pd); delegates.put(java.awt.RenderingHints.class, pd); delegates.put(java.util.WeakHashMap.class, pd); delegates.put(javax.swing.UIDefaults.class, pd); // TODO: These classes need to be implemented first //delegates.put(java.security.AuthProvider.class, pd); //delegates.put(java.util.concurrent.ConcurrentHashMap.class, pd); //delegates.put(java.util.EnumMap.class, pd); //delegates.put(javax.management.openmbean.TabularDataSupport.class, pd); defaultPersistenceDelegate = new DefaultPersistenceDelegate(); delegates.put(Object.class, defaultPersistenceDelegate); // Creates a PersistenceDelegate implementation which is // returned for 'null'. In practice this instance is // not used in any way and is just here to be compatible // with the reference implementation which returns a // similar instance when calling getPersistenceDelegate(null) . fakePersistenceDelegate = new PersistenceDelegate() { protected Expression instantiate(Object o, Encoder e) { return null; } }; } }
| 15,662
|
private static void setupDefaultPersistenceDelegates() { synchronized (delegates) { if (defaultPersistenceDelegate != null) return; delegates.put(Class.class, new ClassPersistenceDelegate()); PersistenceDelegate pd = new PrimitivePersistenceDelegate(); delegates.put(Boolean.class, pd); delegates.put(Byte.class, pd); delegates.put(Short.class, pd); delegates.put(Integer.class, pd); delegates.put(Long.class, pd); delegates.put(Float.class, pd); delegates.put(Double.class, pd); delegates.put(Object[].class, new ArrayPersistenceDelegate()); pd = new CollectionPersistenceDelegate(); delegates.put(ArrayList.class, pd); delegates.put(LinkedList.class, pd); delegates.put(Vector.class, pd); delegates.put(HashSet.class, pd); delegates.put(LinkedHashSet.class, pd); delegates.put(TreeSet.class, pd); pd = new MapPersistenceDelegate(); delegates.put(HashMap.class, pd); delegates.put(TreeMap.class, pd); delegates.put(java.util.Hashtable.class, pd); delegates.put(java.util.IdentityHashMap.class, pd); delegates.put(java.util.LinkedHashMap.class, pd); delegates.put(java.util.Properties.class, pd); delegates.put(java.awt.RenderingHints.class, pd); delegates.put(java.util.WeakHashMap.class, pd); delegates.put(javax.swing.UIDefaults.class, pd); // TODO: These classes need to be implemented first //delegates.put(java.security.AuthProvider.class, pd); //delegates.put(java.util.concurrent.ConcurrentHashMap.class, pd); //delegates.put(java.util.EnumMap.class, pd); //delegates.put(javax.management.openmbean.TabularDataSupport.class, pd); defaultPersistenceDelegate = new DefaultPersistenceDelegate(); delegates.put(Object.class, defaultPersistenceDelegate); // Creates a PersistenceDelegate implementation which is // returned for 'null'. In practice this instance is // not used in any way and is just here to be compatible // with the reference implementation which returns a // similar instance when calling getPersistenceDelegate(null) . fakePersistenceDelegate = new PersistenceDelegate() { protected Expression instantiate(Object o, Encoder e) { return null; } }; } }
|
private static void setupDefaultPersistenceDelegates() { synchronized (delegates) { if (defaultPersistenceDelegate != null) return; delegates.put(Class.class, new ClassPersistenceDelegate()); PersistenceDelegate pd = new PrimitivePersistenceDelegate(); delegates.put(Boolean.class, pd); delegates.put(Byte.class, pd); delegates.put(Short.class, pd); delegates.put(Integer.class, pd); delegates.put(Long.class, pd); delegates.put(Float.class, pd); delegates.put(Double.class, pd); delegates.put(Object[].class, new ArrayPersistenceDelegate()); pd = new CollectionPersistenceDelegate(); delegates.put(ArrayList.class, pd); delegates.put(LinkedList.class, pd); delegates.put(Vector.class, pd); delegates.put(HashSet.class, pd); delegates.put(LinkedHashSet.class, pd); delegates.put(TreeSet.class, pd); pd = new MapPersistenceDelegate(); delegates.put(HashMap.class, pd); delegates.put(TreeMap.class, pd); delegates.put(java.util.Hashtable.class, pd); delegates.put(java.util.IdentityHashMap.class, pd); delegates.put(java.util.LinkedHashMap.class, pd); delegates.put(java.util.Properties.class, pd); delegates.put(java.awt.RenderingHints.class, pd); delegates.put(java.util.WeakHashMap.class, pd); delegates.put(javax.swing.UIDefaults.class, pd); // TODO: These classes need to be implemented first //delegates.put(java.security.AuthProvider.class, pd); //delegates.put(java.util.concurrent.ConcurrentHashMap.class, pd); //delegates.put(java.util.EnumMap.class, pd); //delegates.put(javax.management.openmbean.TabularDataSupport.class, pd); defaultPersistenceDelegate = new DefaultPersistenceDelegate(); delegates.put(Object.class, defaultPersistenceDelegate); // Creates a PersistenceDelegate implementation which is // returned for 'null'. In practice this instance is // not used in any way and is just here to be compatible // with the reference implementation which returns a // similar instance when calling getPersistenceDelegate(null) . fakePersistenceDelegate = new PersistenceDelegate() { protected Expression instantiate(Object o, Encoder e) { return null; } }; } }
| 15,663
|
private static void setupDefaultPersistenceDelegates() { synchronized (delegates) { if (defaultPersistenceDelegate != null) return; delegates.put(Class.class, new ClassPersistenceDelegate()); PersistenceDelegate pd = new PrimitivePersistenceDelegate(); delegates.put(Boolean.class, pd); delegates.put(Byte.class, pd); delegates.put(Short.class, pd); delegates.put(Integer.class, pd); delegates.put(Long.class, pd); delegates.put(Float.class, pd); delegates.put(Double.class, pd); delegates.put(Object[].class, new ArrayPersistenceDelegate()); pd = new CollectionPersistenceDelegate(); delegates.put(ArrayList.class, pd); delegates.put(LinkedList.class, pd); delegates.put(Vector.class, pd); delegates.put(HashSet.class, pd); delegates.put(LinkedHashSet.class, pd); delegates.put(TreeSet.class, pd); pd = new MapPersistenceDelegate(); delegates.put(HashMap.class, pd); delegates.put(TreeMap.class, pd); delegates.put(java.util.Hashtable.class, pd); delegates.put(java.util.IdentityHashMap.class, pd); delegates.put(java.util.LinkedHashMap.class, pd); delegates.put(java.util.Properties.class, pd); delegates.put(java.awt.RenderingHints.class, pd); delegates.put(java.util.WeakHashMap.class, pd); delegates.put(javax.swing.UIDefaults.class, pd); // TODO: These classes need to be implemented first //delegates.put(java.security.AuthProvider.class, pd); //delegates.put(java.util.concurrent.ConcurrentHashMap.class, pd); //delegates.put(java.util.EnumMap.class, pd); //delegates.put(javax.management.openmbean.TabularDataSupport.class, pd); defaultPersistenceDelegate = new DefaultPersistenceDelegate(); delegates.put(Object.class, defaultPersistenceDelegate); // Creates a PersistenceDelegate implementation which is // returned for 'null'. In practice this instance is // not used in any way and is just here to be compatible // with the reference implementation which returns a // similar instance when calling getPersistenceDelegate(null) . fakePersistenceDelegate = new PersistenceDelegate() { protected Expression instantiate(Object o, Encoder e) { return null; } }; } }
|
private static void setupDefaultPersistenceDelegates() { synchronized (delegates) { if (defaultPersistenceDelegate != null) return; delegates.put(Class.class, new ClassPersistenceDelegate()); PersistenceDelegate pd = new PrimitivePersistenceDelegate(); delegates.put(Boolean.class, pd); delegates.put(Byte.class, pd); delegates.put(Short.class, pd); delegates.put(Integer.class, pd); delegates.put(Long.class, pd); delegates.put(Float.class, pd); delegates.put(Double.class, pd); delegates.put(Object[].class, new ArrayPersistenceDelegate()); pd = new CollectionPersistenceDelegate(); delegates.put(ArrayList.class, pd); delegates.put(LinkedList.class, pd); delegates.put(Vector.class, pd); delegates.put(HashSet.class, pd); delegates.put(LinkedHashSet.class, pd); delegates.put(TreeSet.class, pd); pd = new MapPersistenceDelegate(); delegates.put(HashMap.class, pd); delegates.put(TreeMap.class, pd); delegates.put(java.util.Hashtable.class, pd); delegates.put(java.util.IdentityHashMap.class, pd); delegates.put(java.util.LinkedHashMap.class, pd); delegates.put(java.util.Properties.class, pd); delegates.put(java.awt.RenderingHints.class, pd); delegates.put(java.util.WeakHashMap.class, pd); delegates.put(javax.swing.UIDefaults.class, pd); // TODO: These classes need to be implemented first //delegates.put(java.security.AuthProvider.class, pd); //delegates.put(java.util.concurrent.ConcurrentHashMap.class, pd); //delegates.put(java.util.EnumMap.class, pd); //delegates.put(javax.management.openmbean.TabularDataSupport.class, pd); defaultPersistenceDelegate = new DefaultPersistenceDelegate(); delegates.put(Object.class, defaultPersistenceDelegate); // Creates a PersistenceDelegate implementation which is // returned for 'null'. In practice this instance is // not used in any way and is just here to be compatible // with the reference implementation which returns a // similar instance when calling getPersistenceDelegate(null) . fakePersistenceDelegate = new PersistenceDelegate() { protected Expression instantiate(Object o, Encoder e) { return null; } }; } }
| 15,664
|
public String paramString() { StringBuffer s = new StringBuffer(); switch (id) { case MOUSE_CLICKED: s.append("MOUSE_CLICKED,("); break; case MOUSE_PRESSED: s.append("MOUSE_PRESSED,("); break; case MOUSE_RELEASED: s.append("MOUSE_RELEASED,("); break; case MOUSE_MOVED: s.append("MOUSE_MOVED,("); break; case MOUSE_ENTERED: s.append("MOUSE_ENTERED,("); break; case MOUSE_EXITED: s.append("MOUSE_EXITED,("); break; case MOUSE_DRAGGED: s.append("MOUSE_DRAGGED,("); break; case MOUSE_WHEEL: s.append("MOUSE_WHEEL,("); break; default: s.append("unknown type,("); } s.append(x).append(',').append(y).append("),button=").append(button); if ((modifiers & EventModifier.NEW_MASK) != 0) { int mod = modifiers; if ((mod & (ALT_DOWN_MASK | BUTTON2_DOWN_MASK)) != 0) mod |= ALT_DOWN_MASK | BUTTON2_DOWN_MASK; if ((mod & (META_DOWN_MASK | BUTTON3_DOWN_MASK)) != 0) mod |= META_DOWN_MASK | BUTTON3_DOWN_MASK; s.append(",modifiers=").append(getModifiersExText(mod)); } if (modifiers != 0) s.append(",extModifiers=").append(getModifiersExText(modifiers)); return s.append(",clickCount=").append(clickCount).toString(); }
|
public String paramString() { StringBuffer s = new StringBuffer(); switch (id) { case MOUSE_CLICKED: s.append("MOUSE_CLICKED,("); break; case MOUSE_PRESSED: s.append("MOUSE_PRESSED,("); break; case MOUSE_RELEASED: s.append("MOUSE_RELEASED,("); break; case MOUSE_MOVED: s.append("MOUSE_MOVED,("); break; case MOUSE_ENTERED: s.append("MOUSE_ENTERED,("); break; case MOUSE_EXITED: s.append("MOUSE_EXITED,("); break; case MOUSE_DRAGGED: s.append("MOUSE_DRAGGED,("); break; case MOUSE_WHEEL: s.append("MOUSE_WHEEL,("); break; default: s.append("unknown type,("); } s.append(x).append(',').append(y).append("),button=").append(button); if ((modifiers & EventModifier.NEW_MASK) != 0) { int mod = modifiers; if ((mod & (ALT_DOWN_MASK | BUTTON2_DOWN_MASK)) != 0) mod |= ALT_DOWN_MASK | BUTTON2_DOWN_MASK; if ((mod & (META_DOWN_MASK | BUTTON3_DOWN_MASK)) != 0) mod |= META_DOWN_MASK | BUTTON3_DOWN_MASK; s.append(",modifiers=").append(getModifiersExText(mod)); } if (modifiers != 0) s.append(",extModifiers=").append(getModifiersExText(modifiers)); return s.append(",clickCount=").append(clickCount).toString(); }
| 15,666
|
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); if ((modifiers & EventModifier.OLD_MASK) != 0) { if ((modifiers & BUTTON1_MASK) != 0) button = BUTTON1; else if ((modifiers & BUTTON2_MASK) != 0) button = BUTTON2; else if ((modifiers & BUTTON3_MASK) != 0) button = BUTTON3; modifiers = EventModifier.extend(modifiers); } }
|
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); if ((modifiers & EventModifier.OLD_MASK) != 0) { if ((modifiers & BUTTON1_MASK) != 0) button = BUTTON1; else if ((modifiers & BUTTON2_MASK) != 0) button = BUTTON2; else if ((modifiers & BUTTON3_MASK) != 0) button = BUTTON3; modifiersEx = EventModifier.extend(modifiers) & EventModifier.NEW_MASK; } }
| 15,667
|
public String getUIClassID() { return "JPanel"; }
|
public String getUIClassID() { return "JPanel"; }
| 15,668
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
| 15,669
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.add(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.add(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
| 15,670
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
| 15,671
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
| 15,672
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
| 15,673
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.addElement(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if (Character.isLetter(thisChar)) { // Not a valid letter tokens.addElement(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.addElement(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.addElement(pattern.substring(i+1,pos+1)); } else { tokens.addElement(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.addElement(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.add(current); } } } }
| 15,674
|
public boolean equals(Object o) { if (o == null) return false; if (!super.equals(o)) return false; if (!(o instanceof SimpleDateFormat)) return false; SimpleDateFormat sdf = (SimpleDateFormat)o; if (!toPattern().equals(sdf.toPattern())) return false; if (!get2DigitYearStart().equals(sdf.get2DigitYearStart())) return false; if (!getDateFormatSymbols().equals(sdf.getDateFormatSymbols())) return false; return true; }
|
public boolean equals(Object o) { if (o == null) return false; if (!super.equals(o)) return false; if (!(o instanceof SimpleDateFormat)) return false; SimpleDateFormat sdf = (SimpleDateFormat)o; if (!toPattern().equals(sdf.toPattern())) return false; if (!get2DigitYearStart().equals(sdf.get2DigitYearStart())) return false; if (!getDateFormatSymbols().equals(sdf.getDateFormatSymbols())) return false; return true; }
| 15,675
|
public boolean equals(Object o) { if (o == null) return false; if (!super.equals(o)) return false; if (!(o instanceof SimpleDateFormat)) return false; SimpleDateFormat sdf = (SimpleDateFormat)o; if (!toPattern().equals(sdf.toPattern())) return false; if (!get2DigitYearStart().equals(sdf.get2DigitYearStart())) return false; if (!getDateFormatSymbols().equals(sdf.getDateFormatSymbols())) return false; return true; }
|
public boolean equals(Object o) { if (o == null) return false; if (!super.equals(o)) return false; if (!(o instanceof SimpleDateFormat)) return false; SimpleDateFormat sdf = (SimpleDateFormat)o; if (defaultCentury != sdf.defaultCentury) return false; if (!get2DigitYearStart().equals(sdf.get2DigitYearStart())) return false; if (!getDateFormatSymbols().equals(sdf.getDateFormatSymbols())) return false; return true; }
| 15,676
|
public boolean equals(Object o) { if (o == null) return false; if (!super.equals(o)) return false; if (!(o instanceof SimpleDateFormat)) return false; SimpleDateFormat sdf = (SimpleDateFormat)o; if (!toPattern().equals(sdf.toPattern())) return false; if (!get2DigitYearStart().equals(sdf.get2DigitYearStart())) return false; if (!getDateFormatSymbols().equals(sdf.getDateFormatSymbols())) return false; return true; }
|
public boolean equals(Object o) { if (o == null) return false; if (!super.equals(o)) return false; if (!(o instanceof SimpleDateFormat)) return false; SimpleDateFormat sdf = (SimpleDateFormat)o; if (!toPattern().equals(sdf.toPattern())) return false; if (!toPattern().equals(sdf.toPattern())) return false; if (!getDateFormatSymbols().equals(sdf.getDateFormatSymbols())) return false; return true; }
| 15,677
|
public Date parse (String dateStr, ParsePosition pos) { int fmt_index = 0; int fmt_max = pattern.length(); calendar.clear(); boolean saw_timezone = false; int quote_start = -1; boolean is2DigitYear = false; for (; fmt_index < fmt_max; ++fmt_index) { char ch = pattern.charAt(fmt_index); if (ch == '\'') { int index = pos.getIndex(); if (fmt_index < fmt_max - 1 && pattern.charAt(fmt_index + 1) == '\'') { if (! expect (dateStr, pos, ch)) return null; ++fmt_index; } else quote_start = quote_start < 0 ? fmt_index : -1; continue; } if (quote_start != -1 || ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z'))) { if (! expect (dateStr, pos, ch)) return null; continue; } // We've arrived at a potential pattern character in the // pattern. int first = fmt_index; while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch) ; int fmt_count = fmt_index - first; --fmt_index; // We can handle most fields automatically: most either are // numeric or are looked up in a string vector. In some cases // we need an offset. When numeric, `offset' is added to the // resulting value. When doing a string lookup, offset is the // initial index into the string array. int calendar_field; boolean is_numeric = true; String[] match = null; int offset = 0; boolean maybe2DigitYear = false; switch (ch) { case 'd': calendar_field = Calendar.DATE; break; case 'D': calendar_field = Calendar.DAY_OF_YEAR; break; case 'F': calendar_field = Calendar.DAY_OF_WEEK_IN_MONTH; break; case 'E': is_numeric = false; offset = 1; calendar_field = Calendar.DAY_OF_WEEK; match = (fmt_count <= 3 ? formatData.getShortWeekdays() : formatData.getWeekdays()); break; case 'w': calendar_field = Calendar.WEEK_OF_YEAR; break; case 'W': calendar_field = Calendar.WEEK_OF_MONTH; break; case 'M': calendar_field = Calendar.MONTH; if (fmt_count <= 2) offset = -1; else { is_numeric = false; match = (fmt_count <= 3 ? formatData.getShortMonths() : formatData.getMonths()); } break; case 'y': calendar_field = Calendar.YEAR; if (fmt_count <= 2) maybe2DigitYear = true; break; case 'K': calendar_field = Calendar.HOUR; break; case 'h': calendar_field = Calendar.HOUR; break; case 'H': calendar_field = Calendar.HOUR_OF_DAY; break; case 'k': calendar_field = Calendar.HOUR_OF_DAY; break; case 'm': calendar_field = Calendar.MINUTE; break; case 's': calendar_field = Calendar.SECOND; break; case 'S': calendar_field = Calendar.MILLISECOND; break; case 'a': is_numeric = false; calendar_field = Calendar.AM_PM; match = formatData.getAmPmStrings(); break; case 'z': // We need a special case for the timezone, because it // uses a different data structure than the other cases. is_numeric = false; calendar_field = Calendar.DST_OFFSET; String[][] zoneStrings = formatData.getZoneStrings(); int zoneCount = zoneStrings.length; int index = pos.getIndex(); boolean found_zone = false; for (int j = 0; j < zoneCount; j++) { String[] strings = zoneStrings[j]; int k; for (k = 1; k < strings.length; ++k) { if (dateStr.startsWith(strings[k], index)) break; } if (k != strings.length) { found_zone = true; saw_timezone = true; TimeZone tz = TimeZone.getTimeZone (strings[0]); calendar.setTimeZone (tz); calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ()); offset = 0; if (k > 2 && tz instanceof SimpleTimeZone) { SimpleTimeZone stz = (SimpleTimeZone) tz; offset = stz.getDSTSavings (); } pos.setIndex(index + strings[k].length()); break; } } if (! found_zone) { pos.setErrorIndex(pos.getIndex()); return null; } break; default: pos.setErrorIndex(pos.getIndex()); return null; } // Compute the value we should assign to the field. int value; int index = -1; if (is_numeric) { numberFormat.setMinimumIntegerDigits(fmt_count); if (maybe2DigitYear) index = pos.getIndex(); Number n = numberFormat.parse(dateStr, pos); if (pos == null || ! (n instanceof Long)) return null; value = n.intValue() + offset; } else if (match != null) { index = pos.getIndex(); int i; for (i = offset; i < match.length; ++i) { if (dateStr.startsWith(match[i], index)) break; } if (i == match.length) { pos.setErrorIndex(index); return null; } pos.setIndex(index + match[i].length()); value = i; } else value = offset; if (maybe2DigitYear) { // Parse into default century if the numeric year string has // exactly 2 digits. int digit_count = pos.getIndex() - index; if (digit_count == 2) is2DigitYear = true; } // Assign the value and move on. calendar.set(calendar_field, value); } if (is2DigitYear) { // Apply the 80-20 heuristic to dermine the full year based on // defaultCenturyStart. int year = defaultCentury + calendar.get(Calendar.YEAR); calendar.set(Calendar.YEAR, year); if (calendar.getTime().compareTo(defaultCenturyStart) < 0) calendar.set(Calendar.YEAR, year + 100); } try { if (! saw_timezone) { // Use the real rules to determine whether or not this // particular time is in daylight savings. calendar.clear (Calendar.DST_OFFSET); calendar.clear (Calendar.ZONE_OFFSET); } return calendar.getTime(); } catch (IllegalArgumentException x) { pos.setErrorIndex(pos.getIndex()); return null; } }
|
public Date parse (String dateStr, ParsePosition pos) { int fmt_index = 0; int fmt_max = pattern.length(); calendar.clear(); boolean saw_timezone = false; int quote_start = -1; boolean is2DigitYear = false; for (; fmt_index < fmt_max; ++fmt_index) { char ch = pattern.charAt(fmt_index); if (ch == '\'') { int index = pos.getIndex(); if (fmt_index < fmt_max - 1 && pattern.charAt(fmt_index + 1) == '\'') { if (! expect (dateStr, pos, ch)) return null; ++fmt_index; } else quote_start = quote_start < 0 ? fmt_index : -1; continue; } if (quote_start != -1 || ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z'))) { if (! expect (dateStr, pos, ch)) return null; continue; } // We've arrived at a potential pattern character in the // pattern. int first = fmt_index; while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch) ; int fmt_count = fmt_index - first; --fmt_index; // We can handle most fields automatically: most either are // numeric or are looked up in a string vector. In some cases // we need an offset. When numeric, `offset' is added to the // resulting value. When doing a string lookup, offset is the // initial index into the string array. int calendar_field; boolean is_numeric = true; String[] match = null; int offset = 0; boolean maybe2DigitYear = false; switch (ch) { case 'd': calendar_field = Calendar.DATE; break; case 'D': calendar_field = Calendar.DAY_OF_YEAR; break; case 'F': calendar_field = Calendar.DAY_OF_WEEK_IN_MONTH; break; case 'E': is_numeric = false; offset = 1; calendar_field = Calendar.DAY_OF_WEEK; match = (fmt_count <= 3 ? formatData.getShortWeekdays() : formatData.getWeekdays()); break; case 'w': calendar_field = Calendar.WEEK_OF_YEAR; break; case 'W': calendar_field = Calendar.WEEK_OF_MONTH; break; case 'M': calendar_field = Calendar.MONTH; if (fmt_count <= 2) offset = -1; else { is_numeric = false; match = (fmt_count <= 3 ? formatData.getShortMonths() : formatData.getMonths()); } break; case 'y': calendar_field = Calendar.YEAR; if (fmt_count <= 2) maybe2DigitYear = true; break; case 'K': calendar_field = Calendar.HOUR; break; case 'h': calendar_field = Calendar.HOUR; break; case 'H': calendar_field = Calendar.HOUR_OF_DAY; break; case 'k': calendar_field = Calendar.HOUR_OF_DAY; break; case 'm': calendar_field = Calendar.MINUTE; break; case 's': calendar_field = Calendar.SECOND; break; case 'S': calendar_field = Calendar.MILLISECOND; break; case 'a': is_numeric = false; calendar_field = Calendar.AM_PM; match = formatData.getAmPmStrings(); break; case 'z': // We need a special case for the timezone, because it // uses a different data structure than the other cases. is_numeric = false; calendar_field = Calendar.DST_OFFSET; String[][] zoneStrings = formatData.getZoneStrings(); int zoneCount = zoneStrings.length; int index = pos.getIndex(); boolean found_zone = false; for (int j = 0; j < zoneCount; j++) { String[] strings = zoneStrings[j]; int k; for (k = 1; k < strings.length; ++k) { if (dateStr.startsWith(strings[k], index)) break; } if (k != strings.length) { found_zone = true; saw_timezone = true; TimeZone tz = TimeZone.getTimeZone (strings[0]); calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ()); offset = 0; if (k > 2 && tz instanceof SimpleTimeZone) { SimpleTimeZone stz = (SimpleTimeZone) tz; offset = stz.getDSTSavings (); } pos.setIndex(index + strings[k].length()); break; } } if (! found_zone) { pos.setErrorIndex(pos.getIndex()); return null; } break; default: pos.setErrorIndex(pos.getIndex()); return null; } // Compute the value we should assign to the field. int value; int index = -1; if (is_numeric) { numberFormat.setMinimumIntegerDigits(fmt_count); if (maybe2DigitYear) index = pos.getIndex(); Number n = numberFormat.parse(dateStr, pos); if (pos == null || ! (n instanceof Long)) return null; value = n.intValue() + offset; } else if (match != null) { index = pos.getIndex(); int i; for (i = offset; i < match.length; ++i) { if (dateStr.startsWith(match[i], index)) break; } if (i == match.length) { pos.setErrorIndex(index); return null; } pos.setIndex(index + match[i].length()); value = i; } else value = offset; if (maybe2DigitYear) { // Parse into default century if the numeric year string has // exactly 2 digits. int digit_count = pos.getIndex() - index; if (digit_count == 2) is2DigitYear = true; } // Assign the value and move on. calendar.set(calendar_field, value); } if (is2DigitYear) { // Apply the 80-20 heuristic to dermine the full year based on // defaultCenturyStart. int year = defaultCentury + calendar.get(Calendar.YEAR); calendar.set(Calendar.YEAR, year); if (calendar.getTime().compareTo(defaultCenturyStart) < 0) calendar.set(Calendar.YEAR, year + 100); } try { if (! saw_timezone) { // Use the real rules to determine whether or not this // particular time is in daylight savings. calendar.clear (Calendar.DST_OFFSET); calendar.clear (Calendar.ZONE_OFFSET); } return calendar.getTime(); } catch (IllegalArgumentException x) { pos.setErrorIndex(pos.getIndex()); return null; } }
| 15,678
|
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); if (serialVersionOnStream < 1) { computeCenturyStart (); serialVersionOnStream = 1; } else // Ensure that defaultCentury gets set. set2DigitYearStart(defaultCenturyStart); // Set up items normally taken care of by the constructor. tokens = new Vector(); compileFormat(pattern); }
|
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); if (serialVersionOnStream < 1) { computeCenturyStart (); serialVersionOnStream = 1; } else // Ensure that defaultCentury gets set. set2DigitYearStart(defaultCenturyStart); // Set up items normally taken care of by the constructor. tokens = new ArrayList(); compileFormat(pattern); }
| 15,680
|
public String toString() { StringBuffer output = new StringBuffer(); Enumeration e = tokens.elements(); while (e.hasMoreElements()) { output.append(e.nextElement().toString()); } return output.toString(); }
|
public String toString() { StringBuffer output = new StringBuffer(); Enumeration e = tokens.elements(); while (e.hasMoreElements()) { output.append(e.nextElement().toString()); } return output.toString(); }
| 15,681
|
private void withLeadingZeros(int value, int length, StringBuffer buffer) { String valStr = String.valueOf(value); for (length -= valStr.length(); length > 0; length--) buffer.append('0'); buffer.append(valStr); }
|
private void withLeadingZeros(int value, int length, FormatBuffer buffer) { String valStr = String.valueOf(value); for (length -= valStr.length(); length > 0; length--) buffer.append('0'); buffer.append(valStr); }
| 15,682
|
public String getUIClassID() { return "JTree"; }
|
public String getUIClassID() { return "TreeUI"; }
| 15,684
|
protected void installDefaults(JSeparator s) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); shadow = defaults.getColor("Separator.shadow"); highlight = defaults.getColor("Separator.highlight"); s.setOpaque(false); }
|
protected void installDefaults(JSeparator s) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); shadow = defaults.getColor("Separator.shadow"); highlight = defaults.getColor("Separator.highlight"); s.setOpaque(false); }
| 15,685
|
public String paramString () { throw new Error ("not implemented"); }
|
public String paramString () { return ("scrollpane=" + sp + ", orientation=" + orientation + ", value=" + value + ", minimum=" + minimum + ", maximum=" + maximum + ", visibleAmount=" + visibleAmount + ", unitIncrement=" + unitIncrement + ", blockIncrement=" + blockIncrement); }
| 15,686
|
public int getOffset() { return 0; }
|
protected int getOffset() { return 0; }
| 15,687
|
public int getGlyphCharIndex (int glyphIndex) throws NotImplementedException { throw new Error ("not implemented"); }
|
public int getGlyphCharIndex (int glyphIndex) { throw new Error ("not implemented"); }
| 15,688
|
public int getGlyphCharIndex (int glyphIndex) throws NotImplementedException { throw new Error ("not implemented"); }
|
public int getGlyphCharIndex (int glyphIndex) throws NotImplementedException { return glyphIndex; }
| 15,689
|
public int[] getGlyphCharIndices (int beginGlyphIndex, int numEntries, int[] codeReturn) throws NotImplementedException { throw new Error ("not implemented"); }
|
public int[] getGlyphCharIndices (int beginGlyphIndex, int numEntries, int[] codeReturn) { throw new Error ("not implemented"); }
| 15,690
|
public int[] getGlyphCharIndices (int beginGlyphIndex, int numEntries, int[] codeReturn) throws NotImplementedException { throw new Error ("not implemented"); }
|
public int[] getGlyphCharIndices (int beginGlyphIndex, int numEntries, int[] codeReturn) throws NotImplementedException { if (codeReturn == null) codeReturn = new int[numEntries]; int i = 0; int j = beginGlyphIndex; while (j < numEntries) codeReturn[i++] = getGlyphCharIndex(j++); return codeReturn; }
| 15,691
|
public Rectangle getGlyphPixelBounds (int index, FontRenderContext renderFRC, float x, float y) throws NotImplementedException { throw new Error ("not implemented"); }
|
public Rectangle getGlyphPixelBounds (int index, FontRenderContext renderFRC, float x, float y) { throw new Error ("not implemented"); }
| 15,692
|
public Rectangle getGlyphPixelBounds (int index, FontRenderContext renderFRC, float x, float y) throws NotImplementedException { throw new Error ("not implemented"); }
|
public Rectangle getGlyphPixelBounds (int index, FontRenderContext renderFRC, float x, float y) throws NotImplementedException { Rectangle bounds = new Rectangle(); Rectangle2D rect = getGlyphVisualBounds(index).getBounds2D(); bounds.x = (int) (rect.getX() + x); bounds.y = (int) (rect.getY() + y); bounds.width = (int) rect.getMaxX() - bounds.x; bounds.height = (int) rect.getMaxY() - bounds.y; return bounds; }
| 15,693
|
public Rectangle getPixelBounds (FontRenderContext renderFRC, float x, float y) throws NotImplementedException { throw new Error ("not implemented"); }
|
public Rectangle getPixelBounds (FontRenderContext renderFRC, float x, float y) { throw new Error ("not implemented"); }
| 15,694
|
public Rectangle getPixelBounds (FontRenderContext renderFRC, float x, float y) throws NotImplementedException { throw new Error ("not implemented"); }
|
public Rectangle getPixelBounds (FontRenderContext renderFRC, float x, float y) throws NotImplementedException { Rectangle bounds = new Rectangle(); Rectangle2D rect = getVisualBounds(); bounds.x = (int) (rect.getX() + x); bounds.y = (int) (rect.getY() + y); bounds.width = (int) rect.getMaxX() - bounds.x; bounds.height = (int) rect.getMaxY() - bounds.y; return bounds; }
| 15,695
|
public void fillHelp(Map map) { super.fillHelp(map); map.put("n", "Next threads"); map.put("r", "Reset the list"); }
|
public void fillHelp(Map map) { super.fillHelp(map); map.put("n", "Next thread"); map.put("r", "Reset the list"); }
| 15,696
|
protected void activate() throws RemoteException { try { Remote self = actId.activate(false); // This will call UnicastServer.exportObject, replacing null by // the activated object (self) in the object map. exportObject(self); } catch (RemoteException rex) { throw rex; } catch (Exception exc) { RemoteException rx = new RemoteException("Activation failed."); rx.initCause(exc); throw rx; } }
|
protected void activate() throws RemoteException { try { Remote self = actId.activate(false); // This will call UnicastServer.exportObject, replacing null by // the activated object (self) in the object map. exportObject(self); } catch (RemoteException rex) { throw rex; } catch (Exception exc) { RemoteException rx = new RemoteException("Activation failed."); rx.detail = exc; throw rx; } }
| 15,697
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { Dimension ss = ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(desktop, BorderLayout.CENTER); awtRoot.add(taskBar, BorderLayout.SOUTH); awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(desktop, BorderLayout.CENTER); awtRoot.add(taskBar, BorderLayout.SOUTH); awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 15,698
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { Dimension ss = ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(desktop, BorderLayout.CENTER); awtRoot.add(taskBar, BorderLayout.SOUTH); awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { Dimension ss = ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(desktop, BorderLayout.CENTER); awtRoot.add(taskBar, BorderLayout.SOUTH); awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 15,699
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { Dimension ss = ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(desktop, BorderLayout.CENTER); awtRoot.add(taskBar, BorderLayout.SOUTH); awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(desktop, BorderLayout.CENTER); awtRoot.add(taskBar, BorderLayout.SOUTH); awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 15,700
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { Dimension ss = ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(desktop, BorderLayout.CENTER); awtRoot.add(taskBar, BorderLayout.SOUTH); awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { Dimension ss = ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(desktop, BorderLayout.CENTER); awtRoot.add(taskBar, BorderLayout.SOUTH); awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 15,701
|
public void run() { Dimension ss = ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); }
|
public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); }
| 15,702
|
public void run() { Dimension ss = ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); }
|
public void run() { Dimension ss = ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); ctx.adjustDesktopSize(ss.width, ss.height); System.out.println("screenres1: " + ss); System.out.println("screenres2: " + Toolkit.getDefaultToolkit().getScreenSize()); }
| 15,703
|
public BufferCapabilities(ImageCapabilities front, ImageCapabilities back, FlipContents flip) { if (front == null || back == null) throw new IllegalArgumentException(); this.front = front; this.back = back; this.flip = flip; }
|
public BufferCapabilities(ImageCapabilities front, ImageCapabilities back, FlipContents flip) { if (front == null || back == null) throw new IllegalArgumentException(); this.front = front; this.back = back; this.flip = flip; }
| 15,704
|
public BufferCapabilities(ImageCapabilities front, ImageCapabilities back, FlipContents flip) { if (front == null || back == null) throw new IllegalArgumentException(); this.front = front; this.back = back; this.flip = flip; }
|
public BufferCapabilities(ImageCapabilities front, ImageCapabilities back, FlipContents flip) { if (frontCaps == null || backCaps == null) throw new IllegalArgumentException(); this.front = front; this.back = back; this.flip = flip; }
| 15,705
|
public BufferCapabilities(ImageCapabilities front, ImageCapabilities back, FlipContents flip) { if (front == null || back == null) throw new IllegalArgumentException(); this.front = front; this.back = back; this.flip = flip; }
|
public BufferCapabilities(ImageCapabilities front, ImageCapabilities back, FlipContents flip) { if (front == null || back == null) throw new IllegalArgumentException(); this.front = front; this.back = back; this.flip = flip; }
| 15,706
|
public final void dispatchEvent(AWTEvent e) { // Some subclasses in the AWT package need to override this behavior, // hence the use of dispatchEventImpl(). dispatchEventImpl(e); if (peer != null && ! e.consumed) peer.handleEvent(e); }
|
public final void dispatchEvent(AWTEvent e) { // Some subclasses in the AWT package need to override this behavior, // hence the use of dispatchEventImpl(). dispatchEventImpl(e); if (peer != null && ! e.consumed) peer.handleEvent(e); }
| 15,707
|
void dispatchEventImpl (AWTEvent e) { Event oldEvent = translateEvent (e); if (oldEvent != null) postEvent (oldEvent); if (eventTypeEnabled (e.id)) { // the trick we use to communicate between dispatch and redispatch // is to have KeyboardFocusManager.redispatch synchronize on the // object itself. we then do not redispatch to KeyboardFocusManager // if we are already holding the lock. if (! Thread.holdsLock(e)) { switch (e.id) { case WindowEvent.WINDOW_GAINED_FOCUS: case WindowEvent.WINDOW_LOST_FOCUS: case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: if (KeyboardFocusManager .getCurrentKeyboardFocusManager() .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: if (isLightweight()) requestFocus(); break; } } processEvent (e); } }
|
void dispatchEventImpl (AWTEvent e) { Event oldEvent = translateEvent (e); if (oldEvent != null) postEvent (oldEvent); if (eventTypeEnabled (e.id)) { // the trick we use to communicate between dispatch and redispatch // is to have KeyboardFocusManager.redispatch synchronize on the // object itself. we then do not redispatch to KeyboardFocusManager // if we are already holding the lock. if (! Thread.holdsLock(e)) { switch (e.id) { case WindowEvent.WINDOW_GAINED_FOCUS: case WindowEvent.WINDOW_LOST_FOCUS: case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: if (KeyboardFocusManager .getCurrentKeyboardFocusManager() .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: if (isLightweight()) requestFocus(); break; } } if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE) processEvent(e); } }
| 15,708
|
public boolean isDisplayable() { if (parent != null) return parent.isDisplayable(); return false; }
|
public boolean isDisplayable() { if (parent != null) return parent.isDisplayable(); return false; }
| 15,710
|
public void paint(Graphics g) { // Paint the heavyweight peer if (!isLightweight() && peer != null) peer.paint(g); }
|
public void paint(Graphics g) { // Paint the heavyweight peer if (!isLightweight() && peer != null) peer.paint(g); }
| 15,711
|
protected String paramString() { StringBuffer param = new StringBuffer(); String name = getName(); if (name != null) param.append(name).append(","); param.append(x).append(",").append(y).append(",").append(width) .append("x").append(height); if (! isValid()) param.append(",invalid"); if (! isVisible()) param.append(",invisible"); if (! isEnabled()) param.append(",disabled"); if (! isOpaque()) param.append(",translucent"); if (isDoubleBuffered()) param.append(",doublebuffered"); if (parent == null) param.append(",parent==null"); else param.append(",parent==").append(parent.getName()); return param.toString(); }
|
protected String paramString() { StringBuffer param = new StringBuffer(); String name = getName(); if (name != null) param.append(name).append(","); param.append(x).append(",").append(y).append(",").append(width) .append("x").append(height); if (! isValid()) param.append(",invalid"); if (! isVisible()) param.append(",invisible"); if (! isEnabled()) param.append(",disabled"); if (! isOpaque()) param.append(",translucent"); if (isDoubleBuffered()) param.append(",doublebuffered"); if (parent == null) param.append(",parent=null"); else param.append(",parent==").append(parent.getName()); return param.toString(); }
| 15,712
|
protected String paramString() { StringBuffer param = new StringBuffer(); String name = getName(); if (name != null) param.append(name).append(","); param.append(x).append(",").append(y).append(",").append(width) .append("x").append(height); if (! isValid()) param.append(",invalid"); if (! isVisible()) param.append(",invisible"); if (! isEnabled()) param.append(",disabled"); if (! isOpaque()) param.append(",translucent"); if (isDoubleBuffered()) param.append(",doublebuffered"); if (parent == null) param.append(",parent==null"); else param.append(",parent==").append(parent.getName()); return param.toString(); }
|
protected String paramString() { StringBuffer param = new StringBuffer(); String name = getName(); if (name != null) param.append(name).append(","); param.append(x).append(",").append(y).append(",").append(width) .append("x").append(height); if (! isValid()) param.append(",invalid"); if (! isVisible()) param.append(",invisible"); if (! isEnabled()) param.append(",disabled"); if (! isOpaque()) param.append(",translucent"); if (isDoubleBuffered()) param.append(",doublebuffered"); if (parent == null) param.append(",parent==null"); else param.append(",parent=").append(parent.getName()); return param.toString(); }
| 15,713
|
public void reshape(int x, int y, int width, int height) { int oldx = this.x; int oldy = this.y; int oldwidth = this.width; int oldheight = this.height; if (this.x == x && this.y == y && this.width == width && this.height == height) return; invalidate (); this.x = x; this.y = y; this.width = width; this.height = height; if (peer != null) peer.setBounds (x, y, width, height); // Erase old bounds and repaint new bounds for lightweights. if (isLightweight() && isShowing ()) { boolean shouldRepaintParent = false; boolean shouldRepaintSelf = false; if (parent != null) { Rectangle parentBounds = parent.getBounds(); Rectangle oldBounds = new Rectangle(parent.getX() + oldx, parent.getY() + oldy, oldwidth, oldheight); Rectangle newBounds = new Rectangle(parent.getX() + x, parent.getY() + y, width, height); shouldRepaintParent = parentBounds.intersects(oldBounds); shouldRepaintSelf = parentBounds.intersects(newBounds); } if (shouldRepaintParent && parent != null) parent.repaint(oldx, oldy, oldwidth, oldheight); if (shouldRepaintSelf) repaint(); } // Only post event if this component is visible and has changed size. if (isShowing () && (oldx != x || oldy != y)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED); getToolkit().getSystemEventQueue().postEvent(ce); } if (isShowing () && (oldwidth != width || oldheight != height)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED); getToolkit().getSystemEventQueue().postEvent(ce); } }
|
public void reshape(int x, int y, int width, int height) { int oldx = this.x; int oldy = this.y; int oldwidth = this.width; int oldheight = this.height; if (this.x == x && this.y == y && this.width == width && this.height == height) return; invalidate (); this.x = x; this.y = y; this.width = width; this.height = height; if (peer != null) peer.setBounds (x, y, width, height); // Erase old bounds and repaint new bounds for lightweights. if (isLightweight() && isShowing ()) { boolean shouldRepaintParent = false; boolean shouldRepaintSelf = false; if (parent != null) { Rectangle parentBounds = parent.getBounds(); Rectangle oldBounds = new Rectangle(parent.getX() + oldx, parent.getY() + oldy, oldwidth, oldheight); Rectangle newBounds = new Rectangle(parent.getX() + x, parent.getY() + y, width, height); shouldRepaintParent = parentBounds.intersects(oldBounds); shouldRepaintSelf = parentBounds.intersects(newBounds); } if (shouldRepaintParent && parent != null) parent.repaint(oldx, oldy, oldwidth, oldheight); if (shouldRepaintSelf) repaint(); } // Only post event if this component is visible and has changed size. if (isShowing () && (oldx != x || oldy != y)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED); getToolkit().getSystemEventQueue().postEvent(ce); } if (isShowing () && (oldwidth != width || oldheight != height)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED); getToolkit().getSystemEventQueue().postEvent(ce); } }
| 15,715
|
public void reshape(int x, int y, int width, int height) { int oldx = this.x; int oldy = this.y; int oldwidth = this.width; int oldheight = this.height; if (this.x == x && this.y == y && this.width == width && this.height == height) return; invalidate (); this.x = x; this.y = y; this.width = width; this.height = height; if (peer != null) peer.setBounds (x, y, width, height); // Erase old bounds and repaint new bounds for lightweights. if (isLightweight() && isShowing ()) { boolean shouldRepaintParent = false; boolean shouldRepaintSelf = false; if (parent != null) { Rectangle parentBounds = parent.getBounds(); Rectangle oldBounds = new Rectangle(parent.getX() + oldx, parent.getY() + oldy, oldwidth, oldheight); Rectangle newBounds = new Rectangle(parent.getX() + x, parent.getY() + y, width, height); shouldRepaintParent = parentBounds.intersects(oldBounds); shouldRepaintSelf = parentBounds.intersects(newBounds); } if (shouldRepaintParent && parent != null) parent.repaint(oldx, oldy, oldwidth, oldheight); if (shouldRepaintSelf) repaint(); } // Only post event if this component is visible and has changed size. if (isShowing () && (oldx != x || oldy != y)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED); getToolkit().getSystemEventQueue().postEvent(ce); } if (isShowing () && (oldwidth != width || oldheight != height)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED); getToolkit().getSystemEventQueue().postEvent(ce); } }
|
public void reshape(int x, int y, int width, int height) { int oldx = this.x; int oldy = this.y; int oldwidth = this.width; int oldheight = this.height; if (this.x == x && this.y == y && this.width == width && this.height == height) return; invalidate (); this.x = x; this.y = y; this.width = width; this.height = height; if (peer != null) peer.setBounds (x, y, width, height); // Erase old bounds and repaint new bounds for lightweights. if (isLightweight() && isShowing ()) { boolean shouldRepaintParent = false; boolean shouldRepaintSelf = false; if (parent != null) { Rectangle parentBounds = parent.getBounds(); Rectangle oldBounds = new Rectangle(parent.getX() + oldx, parent.getY() + oldy, oldwidth, oldheight); Rectangle newBounds = new Rectangle(parent.getX() + x, parent.getY() + y, width, height); shouldRepaintParent = parentBounds.intersects(oldBounds); shouldRepaintSelf = parentBounds.intersects(newBounds); } if (shouldRepaintParent && parent != null) parent.repaint(oldx, oldy, oldwidth, oldheight); if (shouldRepaintSelf) repaint(); } // Only post event if this component is visible and has changed size. if (isShowing () && (oldx != x || oldy != y)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED); getToolkit().getSystemEventQueue().postEvent(ce); } if (isShowing () && (oldwidth != width || oldheight != height)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED); getToolkit().getSystemEventQueue().postEvent(ce); } }
| 15,716
|
public void reshape(int x, int y, int width, int height) { int oldx = this.x; int oldy = this.y; int oldwidth = this.width; int oldheight = this.height; if (this.x == x && this.y == y && this.width == width && this.height == height) return; invalidate (); this.x = x; this.y = y; this.width = width; this.height = height; if (peer != null) peer.setBounds (x, y, width, height); // Erase old bounds and repaint new bounds for lightweights. if (isLightweight() && isShowing ()) { boolean shouldRepaintParent = false; boolean shouldRepaintSelf = false; if (parent != null) { Rectangle parentBounds = parent.getBounds(); Rectangle oldBounds = new Rectangle(parent.getX() + oldx, parent.getY() + oldy, oldwidth, oldheight); Rectangle newBounds = new Rectangle(parent.getX() + x, parent.getY() + y, width, height); shouldRepaintParent = parentBounds.intersects(oldBounds); shouldRepaintSelf = parentBounds.intersects(newBounds); } if (shouldRepaintParent && parent != null) parent.repaint(oldx, oldy, oldwidth, oldheight); if (shouldRepaintSelf) repaint(); } // Only post event if this component is visible and has changed size. if (isShowing () && (oldx != x || oldy != y)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED); getToolkit().getSystemEventQueue().postEvent(ce); } if (isShowing () && (oldwidth != width || oldheight != height)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED); getToolkit().getSystemEventQueue().postEvent(ce); } }
|
public void reshape(int x, int y, int width, int height) { int oldx = this.x; int oldy = this.y; int oldwidth = this.width; int oldheight = this.height; if (this.x == x && this.y == y && this.width == width && this.height == height) return; invalidate (); this.x = x; this.y = y; this.width = width; this.height = height; if (peer != null) peer.setBounds (x, y, width, height); // Erase old bounds and repaint new bounds for lightweights. if (isLightweight() && isShowing ()) { boolean shouldRepaintParent = false; boolean shouldRepaintSelf = false; if (parent != null) { Rectangle parentBounds = parent.getBounds(); Rectangle oldBounds = new Rectangle(parent.getX() + oldx, parent.getY() + oldy, oldwidth, oldheight); Rectangle newBounds = new Rectangle(parent.getX() + x, parent.getY() + y, width, height); shouldRepaintParent = parentBounds.intersects(oldBounds); shouldRepaintSelf = parentBounds.intersects(newBounds); } if (shouldRepaintParent && parent != null) parent.repaint(oldx, oldy, oldwidth, oldheight); if (shouldRepaintSelf) repaint(); } // Only post event if this component is visible and has changed size. if (isShowing () && (oldx != x || oldy != y)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED); getToolkit().getSystemEventQueue().postEvent(ce); } if (isShowing () && (oldwidth != width || oldheight != height)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED); getToolkit().getSystemEventQueue().postEvent(ce); } }
| 15,717
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
| 15,718
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
| 15,719
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
| 15,720
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = UIManager.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
| 15,721
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
| 15,722
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tabPane.setFont(defaults.getFont("TabbedPane.font")); tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); tabPane.setBackground(defaults.getColor("TabbedPane.background")); tabPane.setOpaque(false); highlight = defaults.getColor("TabbedPane.highlight"); lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); shadow = defaults.getColor("TabbedPane.shadow"); darkShadow = defaults.getColor("TabbedPane.darkShadow"); focus = defaults.getColor("TabbedPane.focus"); textIconGap = defaults.getInt("TabbedPane.textIconGap"); tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); calcRect = new Rectangle(); tabRuns = new int[10]; tabAreaRect = new Rectangle(); contentRect = new Rectangle(); }
| 15,723
|
protected void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected) { SwingUtilities.layoutCompoundLabel(metrics, title, icon, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, tabRect, iconRect, textRect, textIconGap); int shiftX = getTabLabelShiftX(tabPlacement, tabIndex, isSelected); int shiftY = getTabLabelShiftY(tabPlacement, tabIndex, isSelected); iconRect.x += shiftX; iconRect.y += shiftY; textRect.x += shiftX; textRect.y += shiftY; }
|
protected void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected) { SwingUtilities.layoutCompoundLabel(metrics, title, icon, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.RIGHT, tabRect, iconRect, textRect, textIconGap); int shiftX = getTabLabelShiftX(tabPlacement, tabIndex, isSelected); int shiftY = getTabLabelShiftY(tabPlacement, tabIndex, isSelected); iconRect.x += shiftX; iconRect.y += shiftY; textRect.x += shiftX; textRect.y += shiftY; }
| 15,724
|
public GlyphJustificationInfo getJustificationInfo () throws NotImplementedException { throw new Error ("not implemented"); }
|
public GlyphJustificationInfo getJustificationInfo () throws NotImplementedException { throw new Error ("not implemented"); }
| 15,725
|
public GlyphJustificationInfo getJustificationInfo () throws NotImplementedException { throw new Error ("not implemented"); }
|
public GlyphJustificationInfo getJustificationInfo () throws NotImplementedException { float adv = getAdvance(); return new GlyphJustificationInfo(adv, false, 2, adv / 3, adv / 3, false, 1, 0, 0); }
| 15,726
|
Inet4Address(byte[] addr) { this(addr, null, null); }
|
Inet4Address(byte[] addr, String host) { this(addr, null, null); }
| 15,727
|
Inet4Address(byte[] addr) { this(addr, null, null); }
|
Inet4Address(byte[] addr) { super(addr, host); }
| 15,728
|
public String getHostAddress() { StringBuffer sbuf = new StringBuffer(40); int len = addr.length; int i = 0; for (;;) { sbuf.append(addr[i] & 0xFF); i++; if (i == len) break; sbuf.append('.'); } return sbuf.toString(); }
|
public String getHostAddress() { StringBuffer sbuf = new StringBuffer(40); int len = addr.length; int i = 0; for (;;) { sbuf.append(addr[i] & 0xFF); i++; if (i == len) break; sbuf.append('.'); } return sbuf.toString(); }
| 15,729
|
public boolean isAnyLocalAddress() { byte[] anylocal = { 0, 0, 0, 0 }; return Arrays.equals(addr, anylocal); }
|
public boolean isAnyLocalAddress() { byte[] anylocal = { 0, 0, 0, 0 }; return Arrays.equals(addr, anylocal); }
| 15,730
|
public boolean isLinkLocalAddress() { // XXX: This seems to not exist with IPv4 addresses return false; }
|
public boolean isLinkLocalAddress() { // XXX: This seems to not exist with IPv4 addresses return super.isLinkLocalAddress(); }
| 15,731
|
public boolean isLoopbackAddress() { return addr[0] == 0x7F; }
|
public boolean isLoopbackAddress() { return super.isLoopbackAddress(); }
| 15,732
|
public boolean isMCGlobal() { // XXX: This seems to net exist with IPv4 addresses return false; }
|
public boolean isMCGlobal() { // XXX: This seems to net exist with IPv4 addresses return super.isMCGlobal(); }
| 15,733
|
public boolean isMCLinkLocal() { if (! isMulticastAddress()) return false; return (addr[0] == 0xE0) && (addr[1] == 0x00) && (addr[2] == 0x00); }
|
public boolean isMCLinkLocal() { if (! isMulticastAddress()) return false; return (addr[0] == 0xE0) && (addr[1] == 0x00) && (addr[2] == 0x00); }
| 15,734
|
public boolean isMCNodeLocal() { // XXX: This seems to net exist with IPv4 addresses return false; }
|
public boolean isMCNodeLocal() { // XXX: This seems to net exist with IPv4 addresses return isMCNodeLocal(); }
| 15,735
|
public boolean isMCOrgLocal() { // XXX: This seems to net exist with IPv4 addresses return false; }
|
public boolean isMCOrgLocal() { // XXX: This seems to net exist with IPv4 addresses return isMCOrgLocal(); }
| 15,736
|
public boolean isMCSiteLocal() { // XXX: This seems to net exist with IPv4 addresses return false; }
|
public boolean isMCSiteLocal() { // XXX: This seems to net exist with IPv4 addresses return super.isMCSiteLocal(); }
| 15,737
|
public boolean isMulticastAddress() { return (addr[0] & 0xF0) == 0xE0; }
|
public boolean isMulticastAddress() { return super.isMulticastAddress(); }
| 15,738
|
public boolean isSiteLocalAddress() { // 10.0.0.0/8 if (addr[0] == 0x0A) return true; // XXX: Suns JDK 1.4.1 (on Linux) seems to have a bug here: // it says 172.16.0.0 - 172.255.255.255 are site local addresses // // 172.16.0.0/12 if (addr[0] == 0xAC && (addr[1] & 0xF0) == 0x01) return true; // 192.168.0.0/16 if (addr[0] == 0xC0 && addr[1] == 0xA8) return true; // XXX: Do we need to check more addresses here ? return false; }
|
public boolean isSiteLocalAddress() { // 10.0.0.0/8 if (addr[0] == 0x0A) return true; // XXX: Suns JDK 1.4.1 (on Linux) seems to have a bug here: // it says 172.16.0.0 - 172.255.255.255 are site local addresses // // 172.16.0.0/12 if (addr[0] == 0xAC && (addr[1] & 0xF0) == 0x01) return true; // 192.168.0.0/16 if (addr[0] == 0xC0 && addr[1] == 0xA8) return true; // XXX: Do we need to check more addresses here ? return false; }
| 15,739
|
private Object writeReplace() throws ObjectStreamException { return new InetAddress(addr, hostName, null); }
|
private Object writeReplace() throws ObjectStreamException { return new InetAddress(addr, hostName, null); }
| 15,740
|
public String toString () { return ("[" + getClass ().getName () + ",hgap=" + hgap + ",vgap=" + vgap + ",rows=" + rows + ",cols=" + cols + "]"); }
|
public String toString () { return (getClass ().getName () + "[" + ",hgap=" + hgap + ",vgap=" + vgap + ",rows=" + rows + ",cols=" + cols + "]"); }
| 15,741
|
private void updateSelection() { if (table.getRowSelectionAllowed()) { int lo_row = getRowForPoint(begin); int hi_row = getRowForPoint(curr); ListSelectionModel rowModel = table.getSelectionModel(); if (lo_row != -1 && hi_row != -1) rowModel.setSelectionInterval(lo_row, hi_row); } if (table.getColumnSelectionAllowed()) { int lo_col = getColForPoint(begin); int hi_col = getColForPoint(curr); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); if (lo_col != -1 && hi_col != -1) colModel.setSelectionInterval(lo_col, hi_col); } }
|
private void updateSelection() { if (table.getRowSelectionAllowed()) { int lo_row = getRowForPoint(begin); int hi_row = getRowForPoint(curr); ListSelectionModel rowModel = table.getSelectionModel(); if (lo_row != -1 && hi_row != -1) rowModel.setSelectionInterval(lo_row, hi_row); } if (table.getColumnSelectionAllowed()) { int lo_col = getColForPoint(begin); int hi_col = getColForPoint(curr); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); if (lo_col != -1 && hi_col != -1) colModel.setSelectionInterval(lo_col, hi_col); } }
| 15,742
|
private void updateSelection() { if (table.getRowSelectionAllowed()) { int lo_row = getRowForPoint(begin); int hi_row = getRowForPoint(curr); ListSelectionModel rowModel = table.getSelectionModel(); if (lo_row != -1 && hi_row != -1) rowModel.setSelectionInterval(lo_row, hi_row); } if (table.getColumnSelectionAllowed()) { int lo_col = getColForPoint(begin); int hi_col = getColForPoint(curr); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); if (lo_col != -1 && hi_col != -1) colModel.setSelectionInterval(lo_col, hi_col); } }
|
private void updateSelection() { if (table.getRowSelectionAllowed()) { int lo_row = getRowForPoint(begin); int hi_row = getRowForPoint(curr); ListSelectionModel rowModel = table.getSelectionModel(); if (lo_row != -1 && hi_row != -1) rowModel.setSelectionInterval(lo_row, hi_row); } if (table.getColumnSelectionAllowed()) { int lo_col = getColForPoint(begin); int hi_col = getColForPoint(curr); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); if (lo_col != -1 && hi_col != -1) colModel.setSelectionInterval(lo_col, hi_col); } }
| 15,743
|
Scrollbar(){ this(VERTICAL);}
|
Scrollbar(){ this(VERTICAL);}
| 15,744
|
addAdjustmentListener(AdjustmentListener listener){ adjustment_listeners = AWTEventMulticaster.add(adjustment_listeners, listener); enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK);}
|
addAdjustmentListener(AdjustmentListener listener){ adjustment_listeners = AWTEventMulticaster.add(adjustment_listeners, listener); enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK);}
| 15,745
|
addNotify(){ if (peer == null) peer = getToolkit ().createScrollbar (this); super.addNotify ();}
|
addNotify(){ if (peer == null) peer = getToolkit ().createScrollbar (this); super.addNotify ();}
| 15,746
|
dispatchEventImpl(AWTEvent e){ if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST && e.id >= AdjustmentEvent.ADJUSTMENT_FIRST && (adjustment_listeners != null || (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0)) processEvent(e); else super.dispatchEventImpl(e);}
|
dispatchEventImpl(AWTEvent e){ if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST && e.id >= AdjustmentEvent.ADJUSTMENT_FIRST && (adjustment_listeners != null || (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0)) processEvent(e); else super.dispatchEventImpl(e);}
| 15,747
|
getBlockIncrement(){ return getPageIncrement ();}
|
getBlockIncrement(){ return getPageIncrement ();}
| 15,748
|
getLineIncrement(){ return lineIncrement;}
|
getLineIncrement(){ return lineIncrement;}
| 15,749
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.