可选择的 JLabel,而不仅仅是 JTextfield [英] Selectable JLabel, without just a JTextfield

查看:59
本文介绍了可选择的 JLabel,而不仅仅是 JTextfield的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够选择 JLabel 中的文本.我在网上阅读了一些关于使用 JTextfield 模拟 JLabel 的指南,但是这对我没有用,因为我的 JLabel 将跨越多行.那么关于如何做到这一点,或者是否有可能,有什么想法吗?

I need to be able to select the text in a JLabel. Ive read some guides on the net that talk about using a JTextfield to simulate a JLabel, however this is no use to me as I my JLabel will span multiple lines. So any ideas on how to do this or if it's even possible?

推荐答案

您可以使用不可编辑的 JTextArea,它允许多行和可选择的文本,并且在视觉上看起来与 JLabel.

You can use a non-editable JTextArea which allows for multiple lines and selectable text, and visually looks the same as a JLabel.

我认为使用 JLabel 是不可能的(至少我不知道如何)

I do not think it is possible with a JLabel (at least I do not know how)

这篇关于可选择的 JLabel,而不仅仅是 JTextfield的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆