Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4134077

Metal,Window:If JInternalFrame's title text is long last must be ellipsis

XMLWordPrintable

    • beta
    • generic, x86
    • generic, windows_nt
    • Verified

      JInternalFrame:
      If title text is longer than the frame's width, title text's last part should be ellipsis. However title text is drawn until the end of frame width and control buttons like close, minimize button are overlayed on top of frame title text only in Metal and Window looks.

      1) Run SwingSet in WindowNT.
      2) Select 'Internal Frame' tab.
      3) Make title very long for example 30 characters.
      4) Create one.
      5) Title text is drawn under control buttons.
      bae-chul.kim@eng 1998-04-30

      Name: krT82822 Date: 03/15/2000


      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      The title text shown on a JInternalFrame needs to be clipped, or more correctly
      be adjusted to use the "..." suffix like JLabel does, when there isn't enough
      room for all the text. This is how native Windows MDI sessions behave. This
      results in the title text showing through behind the frame control buttons(ie
      minimize, maximize and close) which appears very unprofessional. The problem can
      be seen in both the Metal and Windows LFs (I didn't check Motif). You'll only
      see the problem w/ Metal for frames that aren't iconified, but for Windows
      you'll see it all the time. By adjusting the width of the frame you can see
      varying amounts of the title text behind the control buttons.

      Use the following test app to see the problem:
      import java.awt.event.*;
      import java.awt.*;
      import javax.swing.*;

      public class JDesktopPanePaintBug extends JFrame {
         public static void main(String[] args) {
            try {
               
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            } catch (Exception x) {}
            new JDesktopPanePaintBug();
         }

         public JDesktopPanePaintBug() {
            addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {
                  System.exit(0);
               }}
            );

            JDesktopPane desktop = new JDesktopPane();
            desktop.putClientProperty("JDesktopPane.dragMode", "outline");
            desktop.setBorder(BorderFactory.createLineBorder(Color.red, 3));
            setContentPane(desktop);

            JInternalFrame iframe = new JInternalFrame("This is a test frame long title", true, false, true, true);
            iframe.setOpaque(true);
            iframe.setBackground(Color.white);
            iframe.setBounds(10,10,200,200);
            iframe.setVisible(true);
            desktop.add(iframe);

            iframe = new JInternalFrame("Short title", true, false, true, true);
            iframe.setOpaque(true);
            iframe.setBackground(Color.white);
            iframe.setBounds(30,30,200,200);
            iframe.setVisible(true);
            desktop.add(iframe);

            pack();
            setBounds(300, 300, 500, 300);
            setVisible(true);
         }
      }
      (Review ID: 102442)
      ======================================================================

            hgajewsksunw Hania Gajewska (Inactive)
            bkimsunw Bae-chul Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: