2017-01-12 15 views
0

UIManagerを使用してこれまでのところアプリケーションUIのスタイルを設定しています。 ServiceUI.printDialogを使って作成した印刷ダイアログを除いて、すべてがうまくいきます。私はそれが私のUIスタイルの多くを継承しているのを見ます。暗い背景と白いテキストが、問題は、グループのラベルの色は変更されていません。私はこれらを以下の画像で囲んだ。Java Swing印刷ダイアログGroupLayoutラベルの色

enter image description here

次のように印刷ダイアログを作成するために使用されるコードは次のとおりです。次のように

PrintService[] availableServices = PrintServiceLookup 
        .lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PRINTABLE, null); 

PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService(); 

PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet(); 

attributes.add(new Copies(1)); 
attributes.add(MediaSizeName.ISO_A4); 
attributes.add(new JobName(MainFrame.this.survey.jobName + "-Summary", null)); 

Dimension centre = ETools.getCentredWindowDim(new Dimension(300, 300)); 

PrintService service = ServiceUI.printDialog(null, 
        centre.width, centre.height, availableServices, 
        defaultService, null, attributes); 

UIManagerコードは次のとおりです。

private void styleUserInterface() { 

    UIManager.put("Panel.background", Color.decode(Colors.BG)); 

    UIManager.put("TextField.background", Color.decode(Colors.TEXT_BG)); 
    UIManager.put("TextField.foreground", Color.decode(Colors.FONT_GRAY)); 
    UIManager.put("TextField.border", BorderFactory.createLineBorder(Color.decode(Colors.LIGHT_GRAY), 1)); 

    UIManager.put("Label.foreground", Color.decode(Colors.FONT_WHITE)); 

    UIManager.put("Button.background", Color.decode(Colors.BUTTON_BG)); 
    UIManager.put("Button.foreground", Color.decode(Colors.FONT_WHITE)); 
    UIManager.put("Button.border", BorderFactory.createCompoundBorder(
      BorderFactory.createLineBorder(Color.decode(Colors.LIGHT_GRAY), 1), 
      BorderFactory.createEmptyBorder(GAP_STANDARD, 
        GAP_STANDARD, 
        GAP_STANDARD, 
        GAP_STANDARD))); 

    UIManager.put("ComboBox.background", Color.decode(Colors.TEXT_BG)); 
    UIManager.put("ComboBox.foreground", Color.decode(Colors.FONT_GRAY)); 
    UIManager.put("ComboBox.border", BorderFactory.createLineBorder(Color.decode(Colors.LIGHT_GRAY), 1)); 

    UIManager.put("RadioButton.background", Color.decode(Colors.BG)); 
    UIManager.put("RadioButton.foreground", Color.decode(Colors.FONT_WHITE)); 

    UIManager.put("CheckBox.background", Color.decode(Colors.BG)); 
    UIManager.put("CheckBox.foreground", Color.decode(Colors.FONT_WHITE)); 
    UIManager.put("CheckBox.disabledText", Color.decode(Colors.FONT_DISABLED)); 
} 

私のパネルの周囲に境界線もありません私の暗い背景色で満たされています。これについての助けがあれば幸いです!ありがとう。

答えて

0

私は、次を使用して `というUIManager」を使用して、これらのラベルの色を変更する方法を考え出し:

UIManager.put("TitledBorder.titleColor", Color.WHITE)); 
関連する問題