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

Linux: getLocation works incorrectly in KDE

    XMLWordPrintable

Details

    • linux-rc1
    • x86
    • linux
    • Verified

    Description



      Name: skR10017 Date: 06/30/2000



      The following test creates a frame with four buttons.
      getLocation function returns location of the first button component.
      getComponentAt should return the same component if it's location is
      specified as arguments but under
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b09)
      getComponentAt returns null.
      ( It's probably because x coordinate returned by getLocation is less than zero. )

      JCK 1.3 java/awt/Layout/GridBagLayoutTest fails due to this reason.

      This bug is reproduced only under KDE display manager. Under Enlightment(GNOME) display manager
      test passes. Previous Linux JDKs work fine with both display managers.

      --------------------------test.java-----------------
      import java.awt.*;

      public class test {

          public static void main(String[] argv) {

              Frame c = new Frame();
              GridBagLayout gridbag = new GridBagLayout();
              GridBagConstraints constraints = new GridBagConstraints();
              c.setLayout(gridbag);
              constraints.fill = GridBagConstraints.BOTH;
              constraints.weightx = 1.0;
              for(int i=0;i<4;i++)
              {
                  Button btn=new Button("Button");
                  if(i==3)constraints.gridwidth = GridBagConstraints.REMAINDER;

                  gridbag.setConstraints(btn, constraints);
                  c.add(btn);
              }
              c.setLocation(100, 100);
              c.setSize(150, 150);
              c.setVisible(true);
              c.doLayout();

              Point l=c.getComponent(0).getLocation();
              System.out.println("First button location="+l);
              System.out.println("Component at="+c.getComponentAt(l.x,l.y));
              System.exit(0);
          }
      }
      -----------------------output------------------------------
      under Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b09):

      Note that linux-4 has enlightment logged in, linux-9 has KDE logged in:

      [kotl@linux-4 Layout]$ export DISPLAY=linux-4:0
      [kotl@linux-4 Layout]$ java test
      First button location=java.awt.Point[x=6,y=77]
      Component at=java.awt.Button[button0,6,77,37x22,label=Button]

      [kotl@linux-4 Layout]$ export DISPLAY=linux-9:0
      [kotl@linux-4 Layout]$ java test
      First button location=java.awt.Point[x=-1,y=64]
      Component at=null
                   ^^^^ here test fails
      [kotl@linux-4 Layout]$

      under previous build (build 1.3.0beta-b08) everything works fine:

      [kotl@linux-4 Layout]$ export DISPLAY=linux-4:0
      [kotl@linux-4 Layout]$ /export/home/b08/bin/java test
      First button location=java.awt.Point[x=6,y=77]
      Component at=java.awt.Button[button0,6,77,37x22,label=Button]

      [kotl@linux-4 Layout]$ export DISPLAY=linux-9:0
      [kotl@linux-4 Layout]$ /export/home/b08/bin/java test
      First button location=java.awt.Point[x=3,y=88]
      Component at=java.awt.Button[button0,3,88,38x22,label=Button]
      [kotl@linux-4 Layout]$
      --------------------------------------------------------------


      ======================================================================

      Attachments

        Activity

          People

            mbronsonsunw Mike Bronson (Inactive)
            kotlsunw Kotl Kotl (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: