Can you tell me which Java开发者_JAVA百科 components I should use to achieve the same result as on picture?
After clicking on the link FileChooser is opened.
A JEditorPane
with HTML markup inside.
You'll have to add a HyperlinkListener
to trigger some action when the link is clicked.
I'd recommend using a dialog. Either a generic JOptionPane
, or undecorated JDialog
. You can then decorate a JLabel
to look like a hyperlink, and then register a MouserListener
that will open the JFileChooser
.
- The background could be a JPanel within a JDialog or JFrame
- Use JLabel as an image to show the icon "i".
- Use JLabel as the hyperlink for "Click here". See this for how achieve hyperlink with JLabel
- Add an action to the label to open JFileChooser.
精彩评论