java JInternalFrame中的自定义大小按钮

java JInternalFrame中的自定义大小按钮,java,swing,jinternalframe,Java,Swing,Jinternalframe,我正在swing中制作一个简单的GUI。我有一个JInternalFrame,在这个框架中我添加了两个按钮,但它们的大小超出了我的预期。我想看看这些按钮在我的大小,但他们的大小没有得到改变。我还使用了setSized()funtionj。这里是输出- 这是我的密码 /*making of sign in headerFrame and all its dimension and size and location are initialized here*/ JInternalFrame si

我正在swing中制作一个简单的GUI。我有一个
JInternalFrame
,在这个框架中我添加了两个按钮,但它们的大小超出了我的预期。我想看看这些按钮在我的大小,但他们的大小没有得到改变。我还使用了
setSized()
funtionj。这里是输出-

这是我的密码

/*making of sign in headerFrame and all its dimension and size and location are initialized here*/
 JInternalFrame signframe=new JInternalFrame("signframe", false, false, false, false);
 signframe.setLayout(new GridLayout(3, 1,5,6));
 signframe.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
 signframe.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
 BasicInternalFrameTitlePane signtitlePane =
         (BasicInternalFrameTitlePane) ((BasicInternalFrameUI) signframe.getUI()).getNorthPane();  
 signframe.remove(signtitlePane);
 signframe.setBorder(null);
 signframe.setBackground(Color.ORANGE);
 signframe.setSize(250, 150);
 //end of the sign frame

 //location of the sign frame in the screen
 signframe.setLocation(30,60);

 //make the gui for the Sign frame
 //make sign button for the sign frame
 JButton signbutton=new JButton("SIGN IN");
 signbutton.setSize(20, 20);
 JButton signbutton2=new JButton("SIGN IN2");
 signbutton.setSize(20, 20);
 signbutton.resize(30, 40);
 signbutton2.setPreferredSize(getSize());

 //add action lister to the sign in button
 signbutton.addActionListener(new ActionListener() {

    @Override
    public void actionPerformed(ActionEvent e) {
        // TODO Auto-generated method stub

    }
});


 //adding the signbutton to signframe
 signframe.add(signbutton);
 signframe.add(signbutton2);

 //making the sign frame visible
 signframe.setVisible(true);
 //adding the sign frame into the destop pane
 desktoppane.add(signframe);


 //should be in the ends
 c.add(desktoppane);
 setVisible(true);

你的问题是?考虑提供一个说明你的问题的方法。这将减少混乱和更好的响应参见(是)。可以通过更改字体大小或设置边距来更改按钮的大小…当然
signframe.setLayout(新的GridLayout(3,1,5,6)) <代码> GridLayout <代码>将弹出组件来填充可用的空间,但如M.DealMeCalror所建议的那样发布一个MCVE。