programacion example ejemplo create java swing netbeans jlabel

java - example - private jlabel



Subrayado JLabel (2)

Estoy tratando de hacer un JLabel subrayado. Busqué en todas partes, pero no obtuve nada. Incluso en las propiedades, no hay ninguna opción para subrayar el JLabel. ¿Que puedo hacer?


JLabel label = new JLabel("<HTML><U>YOUR TEXT HERE</U></HTML>"); label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

O

JLabel label = new JLabel("Underlined Label"); Font font = label.getFont(); Map attributes = font.getAttributes(); attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); label.setFont(font.deriveFont(attributes));


JLabel label = new JLabel("Underlined Label"); Font font = label.getFont(); Map attributes = font.getAttributes(); attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); label.setFont(font.deriveFont(attributes));