1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 package org.openoffice.setup.PanelHelper; 29 30 import java.awt.Color; 31 import java.awt.ComponentOrientation; 32 import java.awt.Font; 33 import javax.swing.JTextArea; 34 import javax.swing.UIManager; 35 import org.openoffice.setup.InstallData; 36 37 public class PanelLabel extends JTextArea { 38 39 static private Color BackgroundColor; 40 static private Color TextColor; 41 static private Font TextFont; 42 43 public PanelLabel() { 44 } 45 46 public PanelLabel(String text, int rows, int columns) { 47 super(text, rows, columns); 48 init(true); 49 } 50 51 public PanelLabel(String text, boolean multiline) { 52 super(text); 53 init(multiline); 54 } 55 56 public PanelLabel(String text) { 57 super(text); 58 init(false); 59 } 60 61 private void init(boolean multiline) { 62 setEditable(false); 63 setBackground(BackgroundColor); 64 setForeground(TextColor); 65 setFont(TextFont); 66 setFocusable(false); 67 68 InstallData data = InstallData.getInstance(); 69 if ( data.useRtl() ) { setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } 70 71 if (multiline) { 72 setLineWrap(true); 73 setWrapStyleWord(true); 74 } 75 } 76 77 static { 78 BackgroundColor = (Color)UIManager.get("Label.background"); 79 TextColor = (Color)UIManager.get("Label.foreground"); 80 TextFont = ((Font)UIManager.get("Label.font")).deriveFont(Font.PLAIN); 81 } 82 } 83