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

Core dumping Java application with one menu button (no label, no menu items).

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P1 P1
    • None
    • 1.0
    • client-libs
    • None
    • sparc
    • solaris_2.4

      import java.awt.*;
      public class testcase extends java.applet.Applet {

      // a slot to hold an arbitrary object pointer that can
      // be filled in by the app. and referenced in actions
      public Object arg;

      public Choice menubutton_1;

      //methods to support form introspection
      public static String names[] = {
      "menubutton_1",
      };
      public String[] getNames() {
      return names;
      }

      //There should be an easier way to do this
      public Object[] getWidgets() {
      Object[] list = new Object[1];
      list[0] = menubutton_1;
      return list;
      }

      public void init() {

      // main panel
      GridBagLayout grid = new GridBagLayout();
      int rowHeights[] = {0,30,30,30};
      int columnWidths[] = {0,30,30,30};
      double rowWeights[] = {0.0,0.0,0.0,0.0};
      double columnWeights[] = {0.0,0.0,0.0,0.0};
      grid.rowHeights = rowHeights;
      grid.columnWidths = columnWidths;
      grid.rowWeights = rowWeights;
      grid.columnWeights = columnWeights;

      menubutton_1 = new Choice();
      /* menubutton_1.addItem("xyz"); */
      this.add(menubutton_1);

      // Geometry management
      GridBagConstraints con = new GridBagConstraints();
      reset(con);
      con.gridx = 2;
      con.gridy = 2;
      con.anchor = GridBagConstraints.CENTER;
      con.fill = GridBagConstraints.NONE;
      grid.setConstraints(menubutton_1, con);


      // Resize behavior management and parent heirarchy
      setLayout(grid);

      // Give the application a chance to do its initialization
      super.init();
      }

      public boolean handleEvent(Event event) {
      return super.handleEvent(event);
      }

      public static void main(String[] args) {
          Frame f = new Frame("testcase Test");
          testcase win = new testcase();
          win.init();
          f.add("Center", win);
          f.pack();
          f.show();
      }

      private void reset(GridBagConstraints con) {
          con.gridx = GridBagConstraints.RELATIVE;
          con.gridy = GridBagConstraints.RELATIVE;
          con.gridwidth = 1;
          con.gridheight = 1;
       
          con.weightx = 0;
          con.weighty = 0;
          con.anchor = GridBagConstraints.CENTER;
          con.fill = GridBagConstraints.NONE;
       
          con.insets = new Insets(0, 0, 0, 0);
          con.ipadx = 0;
          con.ipady = 0;
      }

      }

            amfowler Anne Fowler (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: