Article View: borland.public.jbuilder.java.swing
Article #12223Re: GridBagLayout weirdness!
From: Matt Krevs
Date: Mon, 01 Feb 1999 00:00
Date: Mon, 01 Feb 1999 00:00
620 lines
25350 bytes
25350 bytes
From what I've read, XYLayout does absolute positioning and can get you into trouble if you are deploying cross platform apps or if people are viewing your app on different desktop areas. Also, I dont think XYLayout has any intelligent resizing capabilities. Basically everyone seems to be saying using XYLayout only for initial prototyping and then avoid it like the plague. By the way, I wasnt criticising you code in any way, I was criticising how JBuilder basically forces you to use a bastardised version of GridBagLayout if you want to use the visual designer. I finally gave up and havent actually visually designed anything in JBuilder for about 3 months now. Alex B. Humphreys wrote in message <36B1CF44.9ED1098E@sema4.com>... >You caught me: I'm in an inefficient programmer. > >Setting the minimum size for the image fixed the problem. Thanks. > >Setting the weighty to 1.0 made it get WAY too big. > >What's wrong with XYLayout? > >Matt Krevs wrote: > >> Whoa! >> >> This is a prime example as to why using GridBagConstraints2 is a complete >> mess as soon as you have more than a few components on the screen. >> >> If you use GridBagConstraints you can create 1 constraints object and resue >> it for each component, modifying it slightly for each component. >> >> The first thing that I noticed is that you are using XYLayout. From what I >> hear you should avoid this layout manager like the plague. >> >> What is the minimum size of the image? Are you sure the image is actually >> being sized at 1 pixel. Is it possible that the image is kind of being >> scrolled off the screen? >> >> What happens if you set weighty to 1.0 and fill to GridBagConstraints.BOTH >> for the image control? >> >> It sounds like its related to the fact that the GridControl is trying to hog >> all the room on the dialog. >> >> Alex B. Humphreys wrote in message <36B0CF10.E3F22F6C@sema4.com>... >> >Are you sure you want this? It's certainly not small..... >> > >> >Still, here it is (just the part where I'm adding components to the >> frame -- >> >if you need more, just ask). I hope it helps us find what's going on. >> >Thanks a great deal for your help. >> > >> > this.add(everything_bpanel, new GridBagConstraints2(0, 0, 1, 1, 1.0, >> 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 612, 373)); >> > everything_bpanel.add(tabsetPanel1, new GridBagConstraints2(0, 1, 10, >> 1, >> >1.0, 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > tabsetPanel1.add(time_bpanel, "Time"); >> > time_bpanel.add(time_grid, new GridBagConstraints2(1, 2, 1, 1, 10.0, >> 10.0 >> > >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > time_bpanel.add(status_time, new GridBagConstraints2(1, 4, 1, 1, 0.1, >> 0.1 >> > >> > ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > time_bpanel.add(topTime_bpanel, new GridBagConstraints2(1, 1, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new >> >Insets(0, 0, 0, 0), 5, 5)); >> > topTime_bpanel.add(empTime_tc, new XYConstraints(7, 16, 90, 18)); >> > topTime_bpanel.add(empIDTime_jtf, new XYConstraints(105, 16, 45, 18)); >> > topTime_bpanel.add(empNameTime_jtf, new XYConstraints(150, 16, 175, >> 18)); >> > >> > topTime_bpanel.add(empTime_Lbutton, new XYConstraints(325, 16, 23, >> 18)); >> > topTime_bpanel.add(peTime_jtf, new XYConstraints(105, 36, 129, 18)); >> > topTime_bpanel.add(peTime_tc, new XYConstraints(7, 36, 90, 18)); >> > topTime_bpanel.add(peTime_Lbutton, new XYConstraints(234, 36, 23, 18)); >> > topTime_bpanel.add(statusTime_gbox, new XYConstraints(357, 5, 332, >> 62)); >> > statusTime_gbox.add(notReadyTime_jrb, new XYConstraints(2, 5, 80, 25)); >> > statusTime_gbox.add(readyTime_jrb, new XYConstraints(87, 5, 60, 25)); >> > statusTime_gbox.add(convertedTime_jrb, new XYConstraints(151, 5, 80, >> >25)); >> > statusTime_gbox.add(approvedTime_jcb, new XYConstraints(236, 5, 70, >> 25)); >> > >> > time_bpanel.add(bottomTime_bpanel, new GridBagConstraints2(1, 3, 1, 1, >> >0.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > bottomTime_bpanel.add(totalTime_gbox, new GridBagConstraints2(0, 0, 1, >> 1, >> >1.0, 0.0 >> > ,GridBagConstraints.EAST, GridBagConstraints.NONE, new >> Insets(2, >> >0, 0, 0), 0, 0)); >> > >> > totalTime_gbox.add(regular_tc, new GridBagConstraints2(0, 1, 1, 1, 1.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 3), 0, 0)); >> > totalTime_gbox.add(overtime_tc, new GridBagConstraints2(0, 2, 1, 1, >> 1.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 3), 0, 0)); >> > totalTime_gbox.add(totalT_tc, new GridBagConstraints2(0, 3, 1, 1, 1.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 3), 0, 0)); >> > >> > totalTime_gbox.add(whr1_tc, new GridBagConstraints2(1, 0, 1, 1, 0.0, >> 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr2_tc, new GridBagConstraints2(2, 0, 1, 1, 0.0, >> 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr3_tc, new GridBagConstraints2(3, 0, 1, 1, 0.0, >> 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr4_tc, new GridBagConstraints2(4, 0, 1, 1, 0.0, >> 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr5_tc, new GridBagConstraints2(5, 0, 1, 1, 0.0, >> 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr6_tc, new GridBagConstraints2(6, 0, 1, 1, 0.0, >> 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr7_tc, new GridBagConstraints2(7, 0, 1, 1, 0.0, >> 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr8_tc, new GridBagConstraints2(8, 0, 1, 1, 0.0, >> 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr9_tc, new GridBagConstraints2(9, 0, 1, 1, 0.0, >> 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr10_tc, new GridBagConstraints2(10, 0, 1, 1, 0.0, >> >1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr11_tc, new GridBagConstraints2(11, 0, 1, 1, 0.0, >> >1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr12_tc, new GridBagConstraints2(12, 0, 1, 1, 0.0, >> >1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr13_tc, new GridBagConstraints2(13, 0, 1, 1, 0.0, >> >1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr14_tc, new GridBagConstraints2(14, 0, 1, 1, 0.0, >> >1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr15_tc, new GridBagConstraints2(15, 0, 1, 1, 0.0, >> >1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr16_tc, new GridBagConstraints2(16, 0, 1, 1, 0.0, >> >1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(totalTime_tc, new GridBagConstraints2(17, 0, 1, 1, >> >0.0, 1.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > >> > totalTime_gbox.add(whr1R_jtf, new GridBagConstraints2(1, 1, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr2R_jtf, new GridBagConstraints2(2, 1, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr3R_jtf, new GridBagConstraints2(3, 1, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr4R_jtf, new GridBagConstraints2(4, 1, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr5R_jtf, new GridBagConstraints2(5, 1, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr6R_jtf, new GridBagConstraints2(6, 1, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr7R_jtf, new GridBagConstraints2(7, 1, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr8R_jtf, new GridBagConstraints2(8, 1, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr9R_jtf, new GridBagConstraints2(9, 1, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr10R_jtf, new GridBagConstraints2(10, 1, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr11R_jtf, new GridBagConstraints2(11, 1, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr12R_jtf, new GridBagConstraints2(12, 1, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr13R_jtf, new GridBagConstraints2(13, 1, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr14R_jtf, new GridBagConstraints2(14, 1, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr15R_jtf, new GridBagConstraints2(15, 1, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr16R_jtf, new GridBagConstraints2(16, 1, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(totalR_jtf, new GridBagConstraints2(17, 1, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > >> > totalTime_gbox.add(whr1OT_jtf, new GridBagConstraints2(1, 2, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr2OT_jtf, new GridBagConstraints2(2, 2, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr3OT_jtf, new GridBagConstraints2(3, 2, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr4OT_jtf, new GridBagConstraints2(4, 2, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr5OT_jtf, new GridBagConstraints2(5, 2, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr6OT_jtf, new GridBagConstraints2(6, 2, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr7OT_jtf, new GridBagConstraints2(7, 2, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr8OT_jtf, new GridBagConstraints2(8, 2, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr9OT_jtf, new GridBagConstraints2(9, 2, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr10OT_jtf, new GridBagConstraints2(10, 2, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr11OT_jtf, new GridBagConstraints2(11, 2, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr12OT_jtf, new GridBagConstraints2(12, 2, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr13OT_jtf, new GridBagConstraints2(13, 2, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr14OT_jtf, new GridBagConstraints2(14, 2, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr15OT_jtf, new GridBagConstraints2(15, 2, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr16OT_jtf, new GridBagConstraints2(16, 2, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(totalOT_jtf, new GridBagConstraints2(17, 2, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > >> > totalTime_gbox.add(whr1T_jtf, new GridBagConstraints2(1, 3, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr2T_jtf, new GridBagConstraints2(2, 3, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr3T_jtf, new GridBagConstraints2(3, 3, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr4T_jtf, new GridBagConstraints2(4, 3, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr5T_jtf, new GridBagConstraints2(5, 3, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr6T_jtf, new GridBagConstraints2(6, 3, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr7T_jtf, new GridBagConstraints2(7, 3, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr8T_jtf, new GridBagConstraints2(8, 3, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr9T_jtf, new GridBagConstraints2(9, 3, 1, 1, 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr10T_jtf, new GridBagConstraints2(10, 3, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr11T_jtf, new GridBagConstraints2(11, 3, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr12T_jtf, new GridBagConstraints2(12, 3, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr13T_jtf, new GridBagConstraints2(13, 3, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr14T_jtf, new GridBagConstraints2(14, 3, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr15T_jtf, new GridBagConstraints2(15, 3, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(whr16T_jtf, new GridBagConstraints2(16, 3, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > totalTime_gbox.add(totalT_jtf, new GridBagConstraints2(17, 3, 1, 1, >> 0.0, >> >0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > >> > tabsetPanel1.add(expense_bpanel, "Expense"); >> > expense_bpanel.add(expense_grid, new GridBagConstraints2(0, 2, 1, 1, >> 1.5, >> >5.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > expense_bpanel.add(status_expense, new GridBagConstraints2(0, 4, 1, 1, >> >0.1, 0.1 >> > ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > expense_bpanel.add(topExp_bpanel, new GridBagConstraints2(0, 0, 1, 1, >> >0.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new >> >Insets(0, 0, 0, 0), 5, 5)); >> > topExp_bpanel.add(expNo_tc, new XYConstraints(10, 10, 90, 18)); >> > topExp_bpanel.add(empExp_tc, new XYConstraints(10, 30, 90, 18)); >> > topExp_bpanel.add(payee_tc, new XYConstraints(10, 50, 90, 18)); >> > topExp_bpanel.add(peExp_tc, new XYConstraints(9, 70, 90, 18)); >> > topExp_bpanel.add(expNo_jtf, new XYConstraints(104, 10, 90, 18)); >> > topExp_bpanel.add(empIDExp_jtf, new XYConstraints(105, 30, 45, 18)); >> > topExp_bpanel.add(empNameExp_jtf, new XYConstraints(150, 30, 175, 18)); >> > topExp_bpanel.add(payeeName_jtf, new XYConstraints(150, 50, 175, 18)); >> > topExp_bpanel.add(payeeID_jtf, new XYConstraints(105, 50, 45, 18)); >> > topExp_bpanel.add(peExp_jtf, new XYConstraints(105, 70, 90, 18)); >> > topExp_bpanel.add(expNo_Lbutton, new XYConstraints(194, 10, 23, 18)); >> > topExp_bpanel.add(payee_Lbutton, new XYConstraints(325, 50, 23, 18)); >> > topExp_bpanel.add(empExp_Lbutton, new XYConstraints(325, 30, 23, 18)); >> > topExp_bpanel.add(statusExp_gbox, new XYConstraints(357, 15, 332, 62)); >> > statusExp_gbox.add(notReadyExp_jrb, new XYConstraints(2, 5, 80, 25)); >> > statusExp_gbox.add(readyExp_jrb, new XYConstraints(87, 5, 60, 25)); >> > statusExp_gbox.add(convertedExp_jrb, new XYConstraints(151, 5, 80, >> 25)); >> > statusExp_gbox.add(approvedExp_jcb, new XYConstraints(236, 5, 70, 25)); >> > expense_bpanel.add(bottomExp_bpanel, new GridBagConstraints2(0, 3, 1, >> 1, >> >0.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > bottomExp_bpanel.add(totalExp_gbox, new GridBagConstraints2(0, 0, 1, 1, >> >1.0, 0.0 >> > ,GridBagConstraints.EAST, GridBagConstraints.NONE, new >> Insets(0, >> >0, 0, 0), 0, 0)); >> > totalExp_gbox.add(cost_tc, new XYConstraints(0, 4, 50, 18)); >> > totalExp_gbox.add(totalCost_jtf, new XYConstraints(56, 4, 100, 18)); >> > totalExp_gbox.add(billable_tc, new XYConstraints(166, 4, 74, 18)); >> > totalExp_gbox.add(totalBillable_jtf, new XYConstraints(246, 4, 100, >> 18)); >> > >> > everything_bpanel.add(lookup_button, new GridBagConstraints2(0, 0, 1, >> 1, >> >0.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > everything_bpanel.add(copy_button, new GridBagConstraints2(1, 0, 1, 1, >> >0.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > everything_bpanel.add(add_button, new GridBagConstraints2(2, 0, 1, 1, >> >0.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > everything_bpanel.add(delete_button, new GridBagConstraints2(3, 0, 1, >> 1, >> >0.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > everything_bpanel.add(refresh_button, new GridBagConstraints2(4, 0, 1, >> 1, >> >0.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > everything_bpanel.add(save_button, new GridBagConstraints2(5, 0, 1, 1, >> >0.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > everything_bpanel.add(print_button, new GridBagConstraints2(6, 0, 1, 1, >> >0.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new >> >Insets(0, 0, 0, 0), 0, 0)); >> > everything_bpanel.add(help_button, new GridBagConstraints2(7, 0, 1, 1, >> >0.0, 0.0 >> > ,GridBagConstraints.WEST, GridBagConstraints.NONE, new >> Insets(0, >> >0, 0, 0), 0, 0)); >> > everything_bpanel.add(semaphore_imgT, new GridBagConstraints2(8, 0, 1, >> 1, >> >1.0, 0.0 >> > ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new >> >Insets(3, 0, 0, 0), 0, 0)); >> > >> > >> >Matt Krevs wrote: >> > >> >> Could you post your code? GridBagLayout can get pretty funky. Often the >> >> problem is caused by the constraints of another seemingly unrelated >> >> component. >> >> >> >> Alex B. Humphreys wrote in message <36AF35FC.60C3D4AD@sema4.com>... >> >> >I have a bevel panel on a JFrame with some buttons and a >> >> >TransparentImage at the top and a tabsetpanel underneath. The panel >> >> >uses GridBagLayout. On one of the tabs (which also uses gridbaglayout), >> >> >I have a grid. Now here's the weird thing: when I assign columns to >> >> >the grid (either by grid.setColumns() or dataSet.setColumns() and >> >> >grid.setDataSet()), the image at the top of my frame disappears!!!!! >> >> >(Actually it shrinks down to 1X1 pixel) >> >> > >> >> >What could be going on? Why are these things related? And how can I >> >> >fix/workaround this problem?!? Thanks! >> >> > >> >> >The image is being placed on the screen with: >> >> > >> >> > big_bpanel.add(myImg, new GridBagConstraints2(8, 0, 1, 1, 1.0, 0.0 >> >> > ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new >> >> >Insets(3, 0, 0, 0), 0, 0)); >> >> > >> >> > >> > >
Technical Details
Message-ID:
<792mfg$cdd3@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36AF35FC.60C3D4AD@sema4.com> <78o24a$2sl4@forums.borland.com> <36B0CF10.E3F22F6C@sema4.com> <78qna2$53o15@forums.borland.com> <36B1CF44.9ED1098E@sema4.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e77b8e33679e9888 X-Google-Attributes: gid111d45,public From: "Matt Krevs" <mattkrevs@flex.com.au> Subject: Re: GridBagLayout weirdness! Date: 1999/02/01 Message-ID: <792mfg$cdd3@forums.borland.com> X-Deja-AN: 439161051 References: <36AF35FC.60C3D4AD@sema4.com> <78o24a$2sl4@forums.borland.com> <36B0CF10.E3F22F6C@sema4.com> <78qna2$53o15@forums.borland.com> <36B1CF44.9ED1098E@sema4.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.swing