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

JComponent should have a method to enable/disable adding mnemonic to tooltips

    XMLWordPrintable

    Details

      Description

      Name: rmT116609 Date: 06/17/2004


      A DESCRIPTION OF THE REQUEST :
      There is no way to control the addition of a mnemonic to the end of the text in a tooltip.

      JUSTIFICATION :
      Adding the mnemonic may confuse some users, while other uses may prefer the added help. It would be good to be able to control this behaviour programmatically. The addition of the method would allow code to be added to enable/disable the feature based on user preferences.

      ---------- BEGIN SOURCE ----------
      package gcf.bug.tooltip;

      import java.awt.event.KeyEvent;
      import javax.swing.JButton;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JTabbedPane;

      public class AppMain
      {
          JFrame fJFrameB;
          JFrame fJFrameT;
          
          public AppMain()
          {
              //
              // JButton Frame
              //
              fJFrameB = new JFrame();
              JButton vJButton = new JButton("Dummy");
              vJButton.setMnemonic('D');
              vJButton.setToolTipText("Do nothing");
              fJFrameB.getContentPane().add(vJButton);
              
              //
              // JTabbed Frame
              //
              fJFrameT = new JFrame();
              JTabbedPane vJTabbedPane = new JTabbedPane();
              JPanel vJPanel1 = new JPanel();
              vJTabbedPane.addTab("First", null, vJPanel1, "Number One");
              vJTabbedPane.setMnemonicAt(0, KeyEvent.VK_F);
              JPanel vJPanel2 = new JPanel();
              vJTabbedPane.addTab("Second", null, vJPanel2, "Number Two");
              vJTabbedPane.setMnemonicAt(1, KeyEvent.VK_S);
              fJFrameT.getContentPane().add(vJTabbedPane);
          }
          
          public void show()
          {
              fJFrameB.pack();
              fJFrameB.setVisible(true);
              
              fJFrameT.pack();
              fJFrameT.setLocation(60, 60);
              fJFrameT.setVisible(true);
          }
          
          public static void main(String[] args)
          {
              AppMain vAppMain = new AppMain();
              vAppMain.show();
          }
      }
      ---------- END SOURCE ----------
      (Incident Review ID: 274772)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shickeysunw Shannon Hickey (Inactive)
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: