1*9a1eeea9SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*9a1eeea9SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*9a1eeea9SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*9a1eeea9SAndrew Rist * distributed with this work for additional information 6*9a1eeea9SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*9a1eeea9SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*9a1eeea9SAndrew Rist * "License"); you may not use this file except in compliance 9*9a1eeea9SAndrew Rist * with the License. You may obtain a copy of the License at 10*9a1eeea9SAndrew Rist * 11*9a1eeea9SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*9a1eeea9SAndrew Rist * 13*9a1eeea9SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*9a1eeea9SAndrew Rist * software distributed under the License is distributed on an 15*9a1eeea9SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9a1eeea9SAndrew Rist * KIND, either express or implied. See the License for the 17*9a1eeea9SAndrew Rist * specific language governing permissions and limitations 18*9a1eeea9SAndrew Rist * under the License. 19*9a1eeea9SAndrew Rist * 20*9a1eeea9SAndrew Rist *************************************************************/ 21*9a1eeea9SAndrew Rist 22*9a1eeea9SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package org.openoffice.setup.PanelHelper; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import java.awt.Color; 27cdf0e10cSrcweir import java.awt.ComponentOrientation; 28cdf0e10cSrcweir import java.awt.Font; 29cdf0e10cSrcweir import javax.swing.JTextArea; 30cdf0e10cSrcweir import javax.swing.UIManager; 31cdf0e10cSrcweir import org.openoffice.setup.InstallData; 32cdf0e10cSrcweir 33cdf0e10cSrcweir public class PanelLabel extends JTextArea { 34cdf0e10cSrcweir 35cdf0e10cSrcweir static private Color BackgroundColor; 36cdf0e10cSrcweir static private Color TextColor; 37cdf0e10cSrcweir static private Font TextFont; 38cdf0e10cSrcweir PanelLabel()39cdf0e10cSrcweir public PanelLabel() { 40cdf0e10cSrcweir } 41cdf0e10cSrcweir PanelLabel(String text, int rows, int columns)42cdf0e10cSrcweir public PanelLabel(String text, int rows, int columns) { 43cdf0e10cSrcweir super(text, rows, columns); 44cdf0e10cSrcweir init(true); 45cdf0e10cSrcweir } 46cdf0e10cSrcweir PanelLabel(String text, boolean multiline)47cdf0e10cSrcweir public PanelLabel(String text, boolean multiline) { 48cdf0e10cSrcweir super(text); 49cdf0e10cSrcweir init(multiline); 50cdf0e10cSrcweir } 51cdf0e10cSrcweir PanelLabel(String text)52cdf0e10cSrcweir public PanelLabel(String text) { 53cdf0e10cSrcweir super(text); 54cdf0e10cSrcweir init(false); 55cdf0e10cSrcweir } 56cdf0e10cSrcweir init(boolean multiline)57cdf0e10cSrcweir private void init(boolean multiline) { 58cdf0e10cSrcweir setEditable(false); 59cdf0e10cSrcweir setBackground(BackgroundColor); 60cdf0e10cSrcweir setForeground(TextColor); 61cdf0e10cSrcweir setFont(TextFont); 62cdf0e10cSrcweir setFocusable(false); 63cdf0e10cSrcweir 64cdf0e10cSrcweir InstallData data = InstallData.getInstance(); 65cdf0e10cSrcweir if ( data.useRtl() ) { setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 66cdf0e10cSrcweir 67cdf0e10cSrcweir if (multiline) { 68cdf0e10cSrcweir setLineWrap(true); 69cdf0e10cSrcweir setWrapStyleWord(true); 70cdf0e10cSrcweir } 71cdf0e10cSrcweir } 72cdf0e10cSrcweir 73cdf0e10cSrcweir static { 74cdf0e10cSrcweir BackgroundColor = (Color)UIManager.get("Label.background"); 75cdf0e10cSrcweir TextColor = (Color)UIManager.get("Label.foreground"); 76cdf0e10cSrcweir TextFont = ((Font)UIManager.get("Label.font")).deriveFont(Font.PLAIN); 77cdf0e10cSrcweir } 78cdf0e10cSrcweir } 79