< prev index next >
src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
Print this page
*** 478,492 ****
if (r.x == 0) r.x = frame.getWidth()-frame.getInsets().right;
titleX = menuBar.getX() + menuBar.getWidth() + 2;
titleW = r.x - titleX - 3;
title = getTitle(frame.getTitle(), fm, titleW);
} else {
! titleX = menuBar.getX() - 2
! - SwingUtilities2.stringWidth(frame,fm,title);
}
! SwingUtilities2.drawString(frame, g, title, titleX, baseline);
g.setFont(f);
}
}
/**
--- 478,493 ----
if (r.x == 0) r.x = frame.getWidth()-frame.getInsets().right;
titleX = menuBar.getX() + menuBar.getWidth() + 2;
titleW = r.x - titleX - 3;
title = getTitle(frame.getTitle(), fm, titleW);
} else {
! titleX = menuBar.getX() - 2 - SwingUtilities2
! .getTextUIDrawing(frame).getStringWidth(frame, fm, title);
}
! SwingUtilities2.getTextUIDrawing(frame)
! .drawString(frame, g, title, titleX, baseline);
g.setFont(f);
}
}
/**
*** 513,523 ****
* @param fm an instance of {@code FontMetrics}
* @param availTextWidth an available text width
* @return the title.
*/
protected String getTitle(String text, FontMetrics fm, int availTextWidth) {
! return SwingUtilities2.clipStringIfNecessary(
frame, fm, text, availTextWidth);
}
/**
* Post a WINDOW_CLOSING-like event to the frame, so that it can
--- 514,524 ----
* @param fm an instance of {@code FontMetrics}
* @param availTextWidth an available text width
* @return the title.
*/
protected String getTitle(String text, FontMetrics fm, int availTextWidth) {
! return SwingUtilities2.getTextUIDrawing(frame).getClippedString(
frame, fm, text, availTextWidth);
}
/**
* Post a WINDOW_CLOSING-like event to the frame, so that it can
*** 644,661 ****
width += 19;
}
FontMetrics fm = frame.getFontMetrics(getFont());
String frameTitle = frame.getTitle();
! int title_w = frameTitle != null ? SwingUtilities2.stringWidth(
frame, fm, frameTitle) : 0;
int title_length = frameTitle != null ? frameTitle.length() : 0;
// Leave room for three characters in the title.
if (title_length > 3) {
! int subtitle_w = SwingUtilities2.stringWidth(
! frame, fm, frameTitle.substring(0, 3) + "...");
width += (title_w < subtitle_w) ? title_w : subtitle_w;
} else {
width += title_w;
}
--- 645,664 ----
width += 19;
}
FontMetrics fm = frame.getFontMetrics(getFont());
String frameTitle = frame.getTitle();
! int title_w = frameTitle != null ? SwingUtilities2
! .getTextUIDrawing(frame).getStringWidth(
frame, fm, frameTitle) : 0;
int title_length = frameTitle != null ? frameTitle.length() : 0;
// Leave room for three characters in the title.
if (title_length > 3) {
! int subtitle_w = SwingUtilities2.getTextUIDrawing(frame)
! .getStringWidth(frame, fm,
! frameTitle.substring(0, 3) + "...");
width += (title_w < subtitle_w) ? title_w : subtitle_w;
} else {
width += title_w;
}
< prev index next >