View Javadoc
1   package com.jsql.view.swing.console;
2   
3   import com.jsql.util.LogLevelUtil;
4   
5   import javax.swing.text.SimpleAttributeSet;
6   import javax.swing.text.StyleConstants;
7   
8   /**
9    * A textpane with color.
10   */
11  public class SimpleConsoleAdapter extends AbstractColoredConsole {
12      
13      private final SimpleAttributeSet attributeTimestamp = new SimpleAttributeSet();
14      
15      /**
16       * Create adapter for console.
17       * @param tabName Default text
18       */
19      public SimpleConsoleAdapter(String tabName, String placeholder) {
20          super(tabName, placeholder);
21          StyleConstants.setForeground(this.attributeTimestamp, LogLevelUtil.COLOR_GRAY);  // timestamp color
22      }
23  
24      @Override
25      public SimpleAttributeSet getColorAttribute() {
26          return this.attributeTimestamp;
27      }
28  }