ハイコントラスト・モードは視覚障害者の方を支援します。
Microsoft Windows システムでは、ハイコントラスト・モードは「コントロール パネル」から使用できます (Windows 7 の「コンピューターの簡単操作センター」およびその他の Windows バージョンの同等機能)。
Java™
でハイコントラスト・モードを検出するには、IlvSwingUtil.isHighContrastModeユーティリティーを使用します。
ハイコントラスト・モードは、すべての標準 Swing GUI 要素 (JPanel、JButton など) に影響を及ぼします。
カスタム Swing 要素の場合は、ハイコントラスト・モードに適応するためには、専用のコードを必要とすることがあります。
JViews Framework では、ラベルのフォントをより大きいものに設定したり、グラフィック・オブジェクトの色をより明るいものに設定したりできますが、ハイコントラスト・モードをオンに切り替えるワンステップ API はありません。
ご使用のアプリケーションでハイコントラスト・モードをサポートするには、次のコード例に示すように、ビュー背景を適切に設定し、すべてのオブジェクトに対して、それらの色、フォント、およびサイズを繰り返し設定します。
void setHighContrast(IlvManager manager, IlvManagerView mgrview, boolean on) { // set the selection handle color to light or dark depending on the mode manager.deSelectAll(true); IlvHandlesSelection.defaultHandleColor = on ? new Color(180,180,255) : Color.black; //the view background mgrview.setBackground(on ? Color.black : Color.white); Font normalContrastFont = new Font("dialog", "bold", 12); Font highContrastFont = new Font("dialog", "bold", 16); IlvGraphicEnumeration e = grapher.getObjects(true); while (e.hasMoreElements()) { IlvGraphic g = e.nextElement(); if (g instanceof IlvText) { IlvText text = (IlvText)g; text.setForeground(on ? Color.white : Color.black); text.setFont(on ? highContrastFont : normalContrastFont); } else if (g instanceof ...) { ... other adaptions for other graphic objects ... } } mgrview.repaint(); }
JViews Framework のアクセシビリティー機能を説明するサンプルが <installdir>/jviews-frameworkxx/samples/accessibility にあります。