Package jpianotrain.gui

Source Code of jpianotrain.gui.VLTableCellRenderer

package jpianotrain.gui;

import java.awt.Component;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

import jpianotrain.staff.Chord;
import jpianotrain.staff.Note;

public class VLTableCellRenderer extends DefaultTableCellRenderer {
  public Component getTableCellRendererComponent(JTable table,
                      Object val,
                      boolean isSelected,
                      boolean hasFocus,
                      int row,
                      int column) {
    if (val instanceof Note) {
      Note n=(Note)val;
      return super.getTableCellRendererComponent(table,
                        n.getName(),
                        isSelected,
                        hasFocus,
                        row,
                        column);
    } else if (val instanceof Chord) {
      Chord c=(Chord)val;
      return super.getTableCellRendererComponent(table,
                        c.toShortString(),
                        isSelected,
                        hasFocus,
                        row,
                        column);
    } else {
      return super.getTableCellRendererComponent(table,
                        val,
                        isSelected,
                        hasFocus,
                        row,
                        column);
    }
  }
}
TOP

Related Classes of jpianotrain.gui.VLTableCellRenderer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.