• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser min size

 
Neh Agarwal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am creating a JFileChooser on click of a button, which is resizable. I don't want the user to be able to resie it.

How can I do that?

Please Help!

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Neh Agarwal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent!

works perfectly fine!

Thanks a ton!
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't a ComponentListener and its componentShown method be a little bit better? In your code there could potentially be dozens of actions between showing the dialog and the execution of the runnable.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Wouldn't a ComponentListener and its componentShown method be a little bit better?

normally, yes.

I've only ever done fileChooser.showOpenDialog(...), which is when the dialog is created,
meaning getting access to the dialog has to be coded prior to that line, and delayed until after creation.

I don't have time at present to read/test if the dialog can be created, similar to optionPane.createDialog, then shown.
if it can, componentListener would be the way to go.
 
Neh Agarwal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How will we use ComponentShown method in this case to not allow the user to resize the JFileChooser?

The code provided above creates problem sometimes if the user opens the chooser n closes it several times!

Please Advice!

Neha
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!