gt:         if (m_acolumns != null) {
context: /*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package com.openbravo.pos.sales;
  
  import java.awt.Color;
  import java.awt.Component;
  import java.awt.Rectangle;
  import java.io.Serializable;
  import javax.swing.JLabel;
  import javax.swing.JTable;
  import javax.swing.border.Border;
  import javax.swing.border.EmptyBorder;
  import javax.swing.table.DefaultTableCellRenderer;
  import javax.swing.table.TableCellRenderer;
  import sun.swing.DefaultLookup;
  
  public class DefaultTicketCellRenderer extends JLabel
          implements TableCellRenderer, Serializable {
  
      /**
       * An empty <code>Border</code>. This field might not be used. To change the
       * <code>Border</code> used by this renderer override the
       * <code>getTableCellRendererComponent</code> method and set the border of
       * the returned component directly.
       */
      private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
      private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
      protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
  
      // We need a place to store the color the JLabel should be returned
      // to after its foreground and background colors have been set
      // to the selection background color.
      // These ivars will be made protected when their names are finalized.
      private Color unselectedForeground;
      private Color unselectedBackground;
  
      /**
       * Creates a default table cell renderer.
       */
      private final JTicketLines.ColumnTicket[] m_acolumns;
  
      public DefaultTicketCellRenderer(JTicketLines.ColumnTicket[] acolumns) {
          super();
          setOpaque(true);
          setBorder(getNoFocusBorder());
          setName("Table.cellRenderer");
          m_acolumns = acolumns;
      }
  
      private Border getNoFocusBorder() {
          Border border = DefaultLookup.getBorder(this, ui, "Table.cellNoFocusBorder");
          if (System.getSecurityManager() != null) {
              if (border != null) {
                  return border;
              }
              return SAFE_NO_FOCUS_BORDER;
          } else if (border != null) {
              if (noFocusBorder == null || noFocusBorder == DEFAULT_NO_FOCUS_BORDER) {
                  return border;
              }
          }
          return noFocusBorder;
      }
  
      /**
       * Overrides <code>JComponent.setForeground</code> to assign the
       * unselected-foreground color to the specified color.
       *
       * @param c set the foreground color to this value
       */
      public void setForeground(Color c) {
          super.setForeground(c);
          unselectedForeground = c;
      }
  
      /**
       * Overrides <code>JComponent.setBackground</code> to assign the
       * unselected-background color to the specified color.
       *
       * @param c set the background color to this value
       */
      public void setBackground(Color c) {
          super.setBackground(c);
          unselectedBackground = c;
      }
  
      /**
       * Notification from the <code>UIManager</code> that the look and feel
       * [L&amp;F] has changed. Replaces the current UI object with the latest
       * version from the <code>UIManager</code>.
       *
       * @see JComponent#updateUI
       */
      public void updateUI() {
          super.updateUI();
          setForeground(null);
          setBackground(null);
      }
  
      // implements javax.swing.table.TableCellRenderer
      /**
       *
       * Returns the default table cell renderer.
       * <p>
       * During a printing operation, this method will be called with
       * <code>isSelected</code> and <code>hasFocus</code> values of
       * <code>false</code> to prevent selection and focus from appearing in the
       * printed output. To do other customization based on whether or not the
       * table is being printed, check the return value from
       * {@link javax.swing.JComponent#isPaintingForPrint()}.
       *
       * @param table the <code>JTable</code>
       * @param value the value to assign to the cell at
       * <code>[row, column]</code>
       * @param isSelected true if cell is selected
       * @param hasFocus true if cell has focus
       * @param row the row of the cell to render
       * @param column the column of the cell to render
       * @return the default table cell renderer
       * @see javax.swing.JComponent#isPaintingForPrint()
       */
      public Component getTableCellRendererComponent(JTable table, Object value,
              boolean isSelected, boolean hasFocus, int row, int column) {
          if (table == null) {
              return this;
          }
  
          Color fg = null;
          Color bg = null;
  
          JTable.DropLocation dropLocation = table.getDropLocation();
          if (dropLocation != null
                  && !dropLocation.isInsertRow()
                  && !dropLocation.isInsertColumn()
                  && dropLocation.getRow() == row
                  && dropLocation.getColumn() == column) {
  
              fg = DefaultLookup.getColor(this, ui, "Table.dropCellForeground");
              bg = DefaultLookup.getColor(this, ui, "Table.dropCellBackground");
  
              isSelected = true;
          }
  
          if (isSelected) {
              super.setForeground(fg == null ? table.getSelectionForeground()
                      : fg);
              super.setBackground(bg == null ? table.getSelectionBackground()
                      : bg);
          } else if (table.isRowSelected(row)) {
              fg = fg == null ? table.getSelectionForeground() : fg;
              bg = bg == null ? table.getSelectionBackground() : bg;
              float scale = 0.98f;
              Color fgr = new Color((int) (fg.getRed() * scale), (int) (fg.getGreen() * scale), (int) (scale * fg.getBlue()));
              Color bgr = new Color((int) (bg.getRed() * scale), (int) (bg.getGreen() * scale), (int) (scale * bg.getBlue()));
              super.setForeground(fgr);
              super.setBackground(bgr);
          } else {
              Color background = unselectedBackground != null
                      ? unselectedBackground
                      : table.getBackground();
              if (background == null || background instanceof javax.swing.plaf.UIResource) {
                  Color alternateColor = DefaultLookup.getColor(this, ui, "Table.alternateRowColor");
                  if (alternateColor != null && row % 2 != 0) {
                      background = alternateColor;
                  }
              }
              super.setForeground(unselectedForeground != null
                      ? unselectedForeground
                      : table.getForeground());
              super.setBackground(background);
          }
  
          setFont(table.getFont());
  
          if (hasFocus) {
              Border border = null;
              if (isSelected) {
                  border = DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder");
              }
              if (border == null) {
                  border = DefaultLookup.getBorder(this, ui, "Table.focusCellHighlightBorder");
              }
              setBorder(border);
  
              if (!isSelected && table.isCellEditable(row, column)) {
                  Color col;
                  col = DefaultLookup.getColor(this, ui, "Table.focusCellForeground");
                  if (col != null) {
                      super.setForeground(col);
                  }
                  col = DefaultLookup.getColor(this, ui, "Table.focusCellBackground");
                  if (col != null) {
                      super.setBackground(col);
                  }
              }
          } else {
              setBorder(getNoFocusBorder());
          }
  
          setValue(value);
  
          setVerticalAlignment(javax.swing.SwingConstants.TOP);
  