Java GUI中的JFileChooser怎么设置选择框的宽度和高度

2024-11-17 08:17:20
推荐回答(2个)
回答(1):

JFileChooser j = new JFileChooser("F:\\Program Design\\JAVA program") ;
这里的参数用String就没有问题。

回答(2):

Methods inherited from class java.awt.Component
public void setSize(Dimension d)

Resizes this component so that it has width d.width
and height d.height.
This method changes layout-related information, and therefore,
invalidates the component hierarchy.

Parameters:
d - the dimension specifying the new size
of this component

public void setSize(int width, int height)

Resizes this component so that it has width width
and height height.
This method changes layout-related information, and therefore,
invalidates the component hierarchy.

Parameters:
width - the new width of this component in pixels
height - the new height of this component in pixels