Thu*_*tha 3 java icons swing jfilechooser
我想从中更改内置的java图标JFileChooser.JFrameclass有一个setIconImage()set icon的设置方法.但我找不到类似的东西JFileChooser.在不更换咖啡杯的情况下,任何人都可以轻松识别我的软件是用java制作的.任何人都可以帮我避免这个吗?
Pet*_*esh 11
IIRC对JFileChooser的图标是从传入的JFrame中采取通过改变对JFrame的图标,你也应该得到在JFileChooser反射的图标变化.
代码:
JFileChooser choice = new JFileChooser()
choice.showOpenDialog(parent);
Run Code Online (Sandbox Code Playgroud)
使用的图标是父级的图标.
这有助于:
JFileChooser fc = new JFileChooser(new File("C:/")){
@Override
protected JDialog createDialog( Component parent ) throws HeadlessException {
JDialog dialog = super.createDialog( parent );
BufferedImage image = new BufferedImage( 16, 16, BufferedImage.TYPE_3BYTE_BGR );
dialog.setIconImage( image );
return dialog;
}
};
fc.showOpenDialog(frame);
Run Code Online (Sandbox Code Playgroud)