01: /*
02: * LogArea.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.sql;
13:
14: import java.awt.Color;
15: import javax.swing.JTextArea;
16: import javax.swing.border.Border;
17: import javax.swing.border.EmptyBorder;
18: import workbench.gui.components.TextComponentMouseListener;
19: import workbench.resource.Settings;
20:
21: /**
22: * @author support@sql-workbench.net
23: */
24: public class LogArea extends JTextArea {
25: private static final Border logBorder = new EmptyBorder(0, 2, 0, 0);
26:
27: public LogArea() {
28: // Save the default background while the log component is enabled/editable
29: // because we want to use that color when turning off editing again
30: // The JGoodies look and feel displays the area in gray if it is not editable
31: Color bg = getBackground();
32:
33: setBorder(logBorder);
34: setFont(Settings.getInstance().getMsgLogFont());
35: setEditable(false);
36: setLineWrap(true);
37: setWrapStyleWord(true);
38:
39: // Now that the text area is set to readonly, re-apply the default background color
40: setBackground(bg);
41: addMouseListener(new TextComponentMouseListener());
42: }
43:
44: }
|