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

Button.setBounds(x,y,w,h) hides button when x or y is too small

XMLWordPrintable

    • x86
    • linux



      Name: kaC94536 Date: 01/31/2000



         Code below should show a frame with part of the green button visible
      inside. But, unfortunately, there is no button in the window.
         The same behavior observed when other components (Label, Panel) are
      used instead of button.
      ---------------------------- test.java -------------------------------
      import java.awt.*;

      class test {
         
         static int x = -100000;
         
         public static void main(String args[]) {
            Frame f = new Frame();
            f.setSize(300, 300);

            Button b = new Button("test");
            b.setBackground(Color.green);
            f.add(b);
            f.getLayout().removeLayoutComponent(b); // exclude LayoutManager influence

            b.setBounds(x, 30, 270-x, 240);

            f.show();
         }
      }
      ======================================================================

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

            mbronsonsunw Mike Bronson (Inactive)
            kanisimosunw Konstantin Anisimov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: