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

JTextArea-Motif LAF-keyboard and mouse non-standard behavior

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs



      Name: skT88420 Date: 07/01/99


      We were using TextArea in our applets but wanted to avoid
       some of the problems of mixing lightweight and heavyweight
       components. Switching to JTextArea (JTextField shows the same
       problem) we discovered that the standard window-to-window
       mouse cut-and-paste between the applet and the rest of our
       Motif CDE desktop stopped functioning.

       For TextArea, you can drag MB1 to select text in any Motif
       window (including the TextArea) then click MB2 at the location
       in TextArea where the selected text is to be inserted. This
       does not work for JTextArea.

       For TextArea, hitting the backspace key deletes the character
       before the cursor, for JTextArea it deletes the character
       following the cursor.

       I have the following e-mail response regarding the problem

      Return-path: <###@###.###>
      Received: from stsci.edu (tnm.stsci.edu)
       by avion.stsci.edu (PMDF V5.0-7 #11544) id
       <###@###.###> for ###@###.###; Tue,
       22 Sep 1998 12:40:26 -0500 (EST)
      Received: by stsci.edu (SMI-8.6/SMI-SVR4-DNI-8.0) id MAA13516; Tue,
       22 Sep 1998 12:40:17 -0400
      Received: from mercury.sun.com(192.9.25.1) by tnm.stsci.edu via smap (V2.0)
       id xma013510; Tue, 22 Sep 1998 12:39:57 -0400
      Received: from Eng.Sun.COM (engmail2 [129.146.1.25])
       by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id JAA16684; Tue,
       22 Sep 1998 09:39:50 -0700
      Received: from taller.eng.sun.com (taller.Eng.Sun.COM [129.144.250.34])
       by Eng.Sun.COM (SMI-8.6/SMI-5.3) with SMTP id JAA00329; Tue,
       22 Sep 1998 09:39:48 -0700
      Received: from Eng.Sun.COM by taller.eng.sun.com (SMI-8.6/SMI-SVR4)
       id JAA20151; Tue, 22 Sep 1998 09:39:13 -0700
      Date: Tue, 22 Sep 1998 09:30:48 -0700
      From: Timothy Prinzing <###@###.###>
      Subject: Re: JTextArea vs. TextArea...nice but I want my mouse back.
      To: Opusmgr <###@###.###>
      Cc: ###@###.###, ###@###.###
      Reply-to: ###@###.###
      Message-id: <###@###.###>
      Organization: JavaSoft
      MIME-version: 1.0
      X-Mailer: Mozilla 4.05 [en] (WinNT; U)
      Content-type: text/plain; charset=us-ascii
      Content-transfer-encoding: 7bit
      References: <###@###.###>

      The Motif LAF Caret implementation should be providing that
      behavior, but currently it doesn't. You can however install
      your own caret that adds it (The Caret is a MouseListener
      implementation that gets attached when the caret is installed,
      and detached when the caret is replaced).

      1.Exact steps to reproduce the problem.

       See above
                         

      2.Java SOURCE CODE that demonstrates the problem, if possible.
                         

      import java.io.*;
      import java.text.*;
      import java.util.*;
      import java.applet.*;
      import java.lang.*;
      import java.awt.*;
      import java.awt.event.*;
      import java.awt.image.*;
      import javax.swing.*;
      import javax.swing.text.*;
      import java.awt.event.ActionListener;
      import java.awt.event.WindowListener;
      import java.awt.event.ActionEvent;
      import java.awt.event.WindowEvent;



      public class Junk extends JApplet {

           
         boolean inAnApplet;
         public void init() {
              try {
                   UIManager.setLookAndFeel(
                   UIManager.getSystemLookAndFeelClassName());
              } catch (Exception e) {
                   System.err.println("Couldn't use the system "
                                       + "look and feel: " + e);
              }
              JunkLayout window = new JunkLayout();
              window.setTitle("Junk Window");
              window.pack();
              window.setVisible(true);
         }
         public class JunkLayout extends JFrame {
           
            JTextArea reportArea;
            JButton quit_button;
            WindowEvent close_me = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
            SwitchOff quitClick = new SwitchOff();
            JPanel panel;
            JFrame parentFrame;
            Window JunkWindow = this;
            ProgressLabel progress;
            

            public JunkLayout() {
               parentFrame =this;

      GridBagLayout gridbag = new GridBagLayout();
               GridBagConstraints c = new GridBagConstraints();
       
               // makepane(gridbag,c);
               panel = new JPanel(gridbag);
               panel.setFont(new Font("SansSerif", Font.PLAIN, 14));

        c.anchor = GridBagConstraints.SOUTH;
               makequit("Quit", gridbag, c);
              
      c.anchor = GridBagConstraints.NORTH;
      c.gridwidth = GridBagConstraints.REMAINDER;
               c.gridheight = GridBagConstraints.REMAINDER;
               c.fill = GridBagConstraints.BOTH;
               c.weightx = 1.0;
      c.weighty=0.8;
               makearea(gridbag, c);
       
       
                addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                          dispose();
                  }
               });
                   
             getContentPane().add("Center", panel);

          }


          public class SwitchOff implements ActionListener {
                 public void actionPerformed(ActionEvent e) {
                     
      JunkWindow.dispatchEvent(close_me);
             
                 }

          }
            public void makearea(
                                    GridBagLayout gridbag,
                                    GridBagConstraints c) {
               reportArea = new JTextArea();
               gridbag.setConstraints(reportArea, c);
      panel.add(reportArea);
          
            }
             public void makequit(String name,
                                      GridBagLayout gridbag,
                                      GridBagConstraints c) {

               quit_button = new JButton(name);
               gridbag.setConstraints(quit_button, c);
               quit_button.addActionListener(quitClick);
               quit_button.setBorder(BorderFactory.createRaisedBevelBorder());
               panel.add(quit_button);
            }

      }




      }
       




      3.Exact text of any error message(s) that appeared.


      None.
                         

      4.Any trace information.

      None.

      5.The output of the commands "java -version" and "java -fullversion".
                         
      lacerta> java -version
      java version "1.2"
      Classic VM (build JDK-1.2-V, green threads, sunwjit)
      lacerta> java -fullversion
      java full version "JDK-1.2-V"
      lacerta>


      6.Include additional configuration information that you think is relevant to the problem
        (e.g. the type of sound card for an audio problem).

      Motif CDE
      (Review ID: 85095)
      ======================================================================

            tprinzing Tim Prinzing (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: