UIManager.getDefaults().put("TitledBorder.font", Font.BOLD);
contentPanel.setBorder(new TitledBorder("Client Downloader"));
일을 시도하지만 그것은 볼드 아닙니다. 그냥 간격이 떨어져 보였다.
잘못된 방법입니까?
UIManager.getDefaults().put("TitledBorder.font", Font.BOLD);
contentPanel.setBorder(new TitledBorder("Client Downloader"));
일을 시도하지만 그것은 볼드 아닙니다. 그냥 간격이 떨어져 보였다.
잘못된 방법입니까?
귀하는이 질문에 수락 된 것으로 표시하지만 의견은 작동하지 않는다고 말합니다. 나는 그것이 작동해서는 안된다는 것에 동의 할 것입니다.
Font.BOLD
는 (는) 글꼴이 아닙니다. Font의 프로퍼티입니다. 당신이 글꼴을 변경하려면 당신은 할 수 있습니다 :
TitledBorder border = new TitledBorder(...);
border.setTitleFont(border.getTitleFont().deriveFont(Font.BOLD + Font.ITALIC));
나는 그냥 금속 LAF의 기본은 굵은 글꼴 것을 나에게 나타납니다 이후 코드가 작동을 보여 이탤릭을 추가했다.
테두리를 만들 때 글꼴을 설정하십시오. 다음과 같이하십시오 :
new TitledBorder(new LineBorder(Color.WHITE, 1), "Client Downloader",
TitledBorder.LEFT, TitledBorder.TOP, Font.BOLD);
실제로 작동하지 않습니다. : | – Kyle
다음과 같이 코드 변경 글꼴 또는 글꼴 크기를 시도해 볼 수 있습니다.
UIManager.getDefaults().put("TitledBorder.font", new javax.swing.plaf.FontUIResource(new Font("Arial", Font.BOLD, 12))) ;
TitledBorder의 당신이 글꼴을 지정할 수 있습니다 생성자 >>>
public TitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont)
지정된 경계, 타이틀로, TitledBorder의 인스턴스를 생성을 갖고있는 것 같아요, 타이틀의 위치 가지런 히 해 타이틀의 배치, 제목 -세례반.
매개 변수 : 테두리 - 경계 제목 - 경계가 titleJustification를 표시해야합니다 제목 - 제목 titlePosition에 대한 정당화 - 제목 titlefont 나에 대한 위치 - 타이틀을 렌더링하는 폰트
그리고 심지어 색 :
public TitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont, Color titleColor)
는 지정된 경계, 타이틀, 타이틀의 정당성, 타이틀의 폰트 및 컬러 타이틀로 TitledBorder 인스턴스를 생성.
매개 변수 : 테두리 - 경계 제목 - 경계가 titleJustification를 표시해야합니다 제목 - 제목 titlePosition에 대한 정당화 - 제목 titlefont 나에 대한 위치 - 제목 titleColor의 글꼴 - 색상 제목
에도 createTitledBorder가 있습니다
public static TitledBorder createTitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont, Color titleColor)
매개 변수 : 경계 - 타이틀을 추가하는 Border 오브젝트를 제목 - 다음 중 하나 - 제목의 정당성 지정하는 정수 - 제목 titleJustification의 텍스트가 포함 된 문자열 :
TitledBorder.LEFT
TitledBorder.CENTER
TitledBorder.RIGHT
TitledBorder.LEADING
TitledBorder.TRAILING
TitledBorder.DEFAULT_JUSTIFICATION (leading)
titlePosition - 관계에있는 텍스트의 수직 위치를 지정하는 정수 `
TitledBorder.ABOVE_TOP
TitledBorder.TOP (sitting on the top line)
TitledBorder.BELOW_TOP
TitledBorder.ABOVE_BOTTOM
TitledBorder.BOTTOM (sitting on the bottom line)
TitledBorder.BELOW_BOTTOM
TitledBorder.DEFAULT_POSITION (top)
`titlefont 나 - 제목 글꼴을 titleColor를 지정하는 Font 객체 - 제목 색상
,691을 지정하는 Color 객체 : 다음 중 하나 - 국경반환 값 : TitledBorder 개체
+1 흥미롭게도 L & F 데모 중 일부는 Metal의 굵은 글꼴 사용을 명시 적으로 해제합니다. http://download.oracle.com/javase/tutorial/uiswing/examples/components/FileChooserDemo2Project/src/components/FileChooserDemo2.java – trashgod
답변을 보내 주셔서 감사합니다. =) 나는 그것을 작동시키기 위해 다른 폰트를 사용했다 : UIManager.put ("TitledBorder.font", new Font ("Tahoma", Font.BOLD, 11)); – Kyle