< prev index next >
src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
Print this page
*** 724,740 ****
if (frame.isIconifiable()) {
width += buttonDim.width;
}
FontMetrics fm = frame.getFontMetrics(titlePane.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;
}
--- 724,742 ----
if (frame.isIconifiable()) {
width += buttonDim.width;
}
FontMetrics fm = frame.getFontMetrics(titlePane.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;
}
*** 998,1011 ****
int y = aee.evaluate(getStringAttr(attrs, "y"));
String title = jif.getTitle();
if (title != null) {
FontMetrics fm = SwingUtilities2.getFontMetrics(jif, g);
! title = SwingUtilities2.clipStringIfNecessary(jif, fm, title,
calculateTitleArea(jif).width);
g.setColor(color);
! SwingUtilities2.drawString(jif, g, title, x, y + fm.getAscent());
}
}
protected Dimension calculateButtonSize(JComponent titlePane) {
int buttonHeight = getInt("button_height");
--- 1000,1015 ----
int y = aee.evaluate(getStringAttr(attrs, "y"));
String title = jif.getTitle();
if (title != null) {
FontMetrics fm = SwingUtilities2.getFontMetrics(jif, g);
! title = SwingUtilities2.getTextUIDrawing(jif)
! .getClippedString(jif, fm, title,
calculateTitleArea(jif).width);
g.setColor(color);
! SwingUtilities2.getTextUIDrawing(jif)
! .drawString(jif, g, title, x, y + fm.getAscent());
}
}
protected Dimension calculateButtonSize(JComponent titlePane) {
int buttonHeight = getInt("button_height");
*** 1087,1097 ****
protected int calculateTitleTextWidth(Graphics g, JInternalFrame jif) {
String title = jif.getTitle();
if (title != null) {
Rectangle r = calculateTitleArea(jif);
! return Math.min(SwingUtilities2.stringWidth(jif,
SwingUtilities2.getFontMetrics(jif, g), title), r.width);
}
return 0;
}
--- 1091,1101 ----
protected int calculateTitleTextWidth(Graphics g, JInternalFrame jif) {
String title = jif.getTitle();
if (title != null) {
Rectangle r = calculateTitleArea(jif);
! return Math.min(SwingUtilities2.getTextUIDrawing(jif).getStringWidth(jif,
SwingUtilities2.getFontMetrics(jif, g), title), r.width);
}
return 0;
}
< prev index next >