193 break; 194 } 195 totalTextWidth += nextCharWidth; 196 } 197 text = text.substring(0, nChars) + clipString; 198 } 199 200 if (!wasTextShortened) { 201 // center it! 202 startXPosition = (totalWidth - (totalTextWidth + iconWidth)) / 2; 203 if (startXPosition < fThisLeftSideTotal) { 204 startXPosition = fThisLeftSideTotal; 205 } 206 } 207 208 if (isSelected || fIsUtility) { 209 g.setColor(Color.lightGray); 210 } else { 211 g.setColor(Color.white); 212 } 213 SwingUtilities2.drawString(frame, g, text, x + startXPosition + iconWidth, y + baseline + 1); 214 215 if (isSelected || fIsUtility) { 216 g.setColor(selectedTextColor); 217 } else { 218 g.setColor(notSelectedTextColor); 219 } 220 221 SwingUtilities2.drawString(frame, g, text, x + startXPosition + iconWidth, y + baseline); 222 g.setFont(f); 223 } 224 225 // sja fix x & y 226 final int iconYPostion = (metrics.titleBarHeight - getIconHeight(frame)) / 2; 227 paintTitleIcon(g, frame, x + startXPosition, y + iconYPostion); 228 } 229 230 public int getWhichButtonHit(final JInternalFrame frame, final int x, final int y) { 231 int buttonHit = -1; 232 233 final Insets i = frame.getInsets(); 234 int startX = i.left + metrics.leftSidePadding - 1; 235 if (isInsideYButtonArea(i, y) && x >= startX) { 236 if (x <= (startX + metrics.buttonWidth)) { 237 if (frame.isClosable()) { 238 buttonHit = kCloseButton; 239 } 240 } else { 241 startX += metrics.buttonWidth + metrics.buttonPadding; | 193 break; 194 } 195 totalTextWidth += nextCharWidth; 196 } 197 text = text.substring(0, nChars) + clipString; 198 } 199 200 if (!wasTextShortened) { 201 // center it! 202 startXPosition = (totalWidth - (totalTextWidth + iconWidth)) / 2; 203 if (startXPosition < fThisLeftSideTotal) { 204 startXPosition = fThisLeftSideTotal; 205 } 206 } 207 208 if (isSelected || fIsUtility) { 209 g.setColor(Color.lightGray); 210 } else { 211 g.setColor(Color.white); 212 } 213 SwingUtilities2.getTextUIDrawing(frame) 214 .drawString(frame, g, text, 215 x + startXPosition + iconWidth, 216 y + baseline + 1); 217 218 if (isSelected || fIsUtility) { 219 g.setColor(selectedTextColor); 220 } else { 221 g.setColor(notSelectedTextColor); 222 } 223 224 SwingUtilities2.getTextUIDrawing(frame) 225 .drawString(frame, g, text, 226 x + startXPosition + iconWidth, 227 y + baseline); 228 g.setFont(f); 229 } 230 231 // sja fix x & y 232 final int iconYPostion = (metrics.titleBarHeight - getIconHeight(frame)) / 2; 233 paintTitleIcon(g, frame, x + startXPosition, y + iconYPostion); 234 } 235 236 public int getWhichButtonHit(final JInternalFrame frame, final int x, final int y) { 237 int buttonHit = -1; 238 239 final Insets i = frame.getInsets(); 240 int startX = i.left + metrics.leftSidePadding - 1; 241 if (isInsideYButtonArea(i, y) && x >= startX) { 242 if (x <= (startX + metrics.buttonWidth)) { 243 if (frame.isClosable()) { 244 buttonHit = kCloseButton; 245 } 246 } else { 247 startX += metrics.buttonWidth + metrics.buttonPadding; |