首页 > 编程知识 正文

gridview编辑指定列,fieldset怎么设置宽度

时间:2023-05-05 20:31:49 阅读:63333 作者:244

Ihaveafnddx(3, 2 ) as follows with美丽的朋友、 2 jtextfieldsandajbutton.iaddthemasshowninthepicorcode.everythingisjustfinebutthejtextfieldsizeistoobigandittobeas showhowhtttthetthettthettheas avetriedsayingjtf3. setpreferredsize (新维) x,y ); but it didn ' tchangethedimensionatall.oneothersolutionwastomakethefnddxsomewhatfnddx (3,2,1,50 ) for example (by ading Thanks a lot

copying _ panel.set layout (newfnddx (3,2 );

copying _ panel.set background (new color (200,221,242 );

jlabelJL4=newjlabel('from: ',SwingConstants.CENTER );

JTextField jtf3=new JTextField (;

jlabelJL5=newjlabel('to: ',SwingConstants.CENTER );

JTextField jtf4=new JTextField (;

JLabel jl6=new JLabel (;

JbuttonJB2=newJbutton('go );

copying_Panel.add(JL4;

copying_Panel.add(JTF3;

copying_Panel.add(JL5;

copying_Panel.add(JTF4;

copying_Panel.add(JL6;

copying_Panel.add(JB2;

That's how fnddx works,itprovidesequalspacetoallthecomponents.instead,considerusingagridbaglayoutinstead。

copying _ panel.set layout (newgridbaglayout ) );

copying _ panel.set background (new color (200,221,242 );

jlabelJL4=newjlabel('from: ',SwingConstants.CENTER );

jextfieldJTF3=newjtextfield(10;

jlabelJL5=newjlabel('to: ',SwingConstants.CENTER );

jextfieldJTF4=newjtextfield(10;

JbuttonJB2=newJbutton('go );

gridbagconstraintsgbc=newgridbagconstraints (;

gbc.gridx=0;

gbc.gridy=0;

copying_Panel.add(JL4,gbc );

gbc.gridy;

copying_Panel.add(JL5,gbc );

gbc.anchor=gridbag constraints.east;

gbc.fill=gridbag constraints.horizontal;

gbc.gridx;

gbc.gridy=0;

copying_Panel.add(JTF3,gbc );

gbc.gridy;

copying_Panel.add(JTF4,gbc );

gbc.anchor=gridbag constraints.west;

gbc.fill=gridbag constraints.none;

gbc.gridy;

copying_Panel.add(JB2,gbc );

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。