0

I'm writing a plugin for IntelliJ and need to allow the user to select a file. All the coding works fine but I can see in some other parts that they use a textbox with a right-aligned flat icon.

JTextField with flat icon

I was wondering if anyone knowns if there is a ready to use Swing / JX textbox or other component that can be used. I saw some posts about combining labels, borders etc but those were posted well over 5 years ago so hopefully there is something more out-of-the-box available

Tim
  • 11
  • 4
  • What is a "textbox". I'm not aware of that component. – camickr Oct 08 '20 at 20:19
  • *"ready to use Swing .. well over 5 years ago"* It's likely been more than 5 years since Oracle added new components to Swing, so .. no there is not some new component to cover this specific need. Perhaps there is a third party equivalent. BTW - by 'textbox' what do you mean? At first I was thought it was a `JTextArea` but the screenshot shows only single line text components, like a `JTextField` - one with a (disabled?) icon on the RHS. @camickr is not the only one who is uncertain of the requirement! – Andrew Thompson Oct 09 '20 at 04:50
  • Sorry for the unclarity, I meant the JTextField but with a clickable icon. In the example it's a (flat) folder/map icon, when you click it it will open the file dialog. Something like that I would like to replicate. Again, getting the code to work is not the problem, only finding I component which will allow me a similar display as the one from the 'Shell path' – Tim Oct 09 '20 at 05:35

1 Answers1

0

Thanks for replies. I found the component in the IntelliJ UI library. To be specific, it was located as: com.intellij.openapi.ui.TextFieldWithBrowseButton;

All the Swing components are in the com.intellij.ui package which is where I was searching initially.

Tim
  • 11
  • 4