문제
JBUTTONS 중 하나의 하이퍼 링크를 위해 글꼴 밑줄과 파란색을 만들어야하지만 글꼴 클래스는이 작업을 수행 할 수있는 분명한 방법이없는 것 같습니다. Graphics 클래스로 이것을 표시하지 않기 때문에 AdributedText를 사용할 수 없습니다. 어쨌든 내가 이것을 달성 할 수 있습니까? jbutton의 제목이 파란색이고 밑줄이 필요합니다.
해결책 3
나는 내 문자열을 ..... 태그로 둘러싸여 텍스트를 밑줄을 할 수 없다는 문제를 해결하게되었습니다.
다른 팁
답장하기에는 너무 늦었습니다. 그러나 어쨌든, 나는 그것을 여기에 게시 할 것입니다. 어쩌면 누군가에게 도움이 될 것입니다.
JButton button = new JButton("Label");
HashMap<TextAttribute, Object> textAttrMap = new HashMap<TextAttribute, Object>();
textAttrMap.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
textAttrMap.put(TextAttribute.FOREGROUND, Color.BLUE);
button.setFont(button.getFont().deriveFont(textAttrMap));
ref : http://docs.oracle.com/javase/tutorial/2d/text/examples/attriptedtext.java
JButton button = new JButton("OK");
button.setBackground(Color.blue);
Font buttonFont=new Font(button.getFont().getName(),Font.UNDERLINED+Font.BOLD,button.getFont().getSize());
button.setFont(buttonFont);
제휴하지 않습니다 StackOverflow