private void layoutMacStyle(Container c) { int spacing = getHorSpacing(); int h = getHeight(); // assumes all buttons have the same dimensions these dimensions include the borders int buttonHeight = h - getVerSpacing(); int buttonWidth = buttonHeight + 10; int x = 0; int y = Math.max(0, ((h - buttonHeight) / 2) - 1); if (frame.isClosable()) { closeButton.setBounds(x, y, buttonWidth, buttonHeight); x += spacing + buttonWidth; } if (frame.isMaximizable() && !isPalette) { maxButton.setBounds(x, y, buttonWidth, buttonHeight); x += spacing + buttonWidth; } if (frame.isIconifiable() && !isPalette) { iconButton.setBounds(x, y, buttonWidth, buttonHeight); x += spacing + buttonWidth; } buttonsWidth = x; }
public Dimension minimumLayoutSize(Container c) { int width = 30; if (frame.isClosable()) { width += 21; } if (frame.isMaximizable()) { width += 16 + (frame.isClosable() ? 10 : 4); } if (frame.isIconifiable()) { width += 16 + (frame.isMaximizable() ? 2 : (frame.isClosable() ? 10 : 4)); } FontMetrics fm = getFontMetrics(getFont()); String frameTitle = frame.getTitle(); int title_w = frameTitle != null ? fm.stringWidth(frameTitle) : 0; int title_length = frameTitle != null ? frameTitle.length() : 0; if (title_length > 2) { int subtitle_w = fm.stringWidth(frame.getTitle().substring(0, 2) + "..."); width += (title_w < subtitle_w) ? title_w : subtitle_w; } else { width += title_w; } int height = paletteTitleHeight; if (!isPalette) { int fontHeight = fm.getHeight() + 7; Icon icon = frame.getFrameIcon(); int iconHeight = 0; if (icon != null) { iconHeight = Math.min(icon.getIconHeight(), 18); } iconHeight += 5; height = Math.max(fontHeight, iconHeight); } return new Dimension(width, height); }
public void layoutDefault(Container c) { boolean leftToRight = JTattooUtilities.isLeftToRight(frame); int spacing = getHorSpacing(); int w = getWidth(); int h = getHeight(); // assumes all buttons have the same dimensions these dimensions include the borders int buttonHeight = h - getVerSpacing(); int buttonWidth = buttonHeight + 10; int x = leftToRight ? w - spacing : 0; int y = Math.max(0, ((h - buttonHeight) / 2) - 1); if (frame.isClosable()) { x += leftToRight ? -buttonWidth : spacing; closeButton.setBounds(x, y, buttonWidth, buttonHeight); if (!leftToRight) { x += buttonWidth; } } if (frame.isMaximizable() && !isPalette) { x += leftToRight ? -spacing - buttonWidth : spacing; maxButton.setBounds(x, y, buttonWidth, buttonHeight); if (!leftToRight) { x += buttonWidth; } } if (frame.isIconifiable() && !isPalette) { x += leftToRight ? -spacing - buttonWidth : spacing; iconButton.setBounds(x, y, buttonWidth, buttonHeight); if (!leftToRight) { x += buttonWidth; } } buttonsWidth = leftToRight ? w - x : x; }