Example usage for javax.swing JTable getName

List of usage examples for javax.swing JTable getName

Introduction

In this page you can find the example usage for javax.swing JTable getName.

Prototype

public String getName() 

Source Link

Document

Gets the name of the component.

Usage

From source file:com.vgi.mafscaling.Rescale.java

private boolean getMafTableData(JTable mafTable, ArrayList<Double> voltArray, ArrayList<Double> gsArray) {
    String value;/*w  w w  .j a v  a2s.c  om*/
    for (int i = 0; i < mafTable.getColumnCount(); ++i) {
        for (int j = 0; j < mafTable.getRowCount(); ++j) {
            value = mafTable.getValueAt(j, i).toString();
            if (value.isEmpty())
                return true;
            if (!Utils.validateDouble(value, j, i, mafTable.getName()))
                return false;
        }
        voltArray.add(Double.parseDouble(mafTable.getValueAt(0, i).toString()));
        gsArray.add(Double.parseDouble(mafTable.getValueAt(1, i).toString()));
    }
    if (voltArray.size() != gsArray.size()) {
        JOptionPane.showMessageDialog(null,
                "Data sets (volt/gs) in  " + mafTable.getName() + " have different length", "Invalid Data",
                JOptionPane.ERROR_MESSAGE);
        return false;
    }
    return true;
}

From source file:semaforo.Semaforo.java

public void loadTableCells(JTable TableWeek, int index, Map<String, List<Integer>> ht, int tamano) {
    System.out.println("---------------------------->" + TableWeek.getName());
    Settings settings = Controller.getSettings();

    for (int i = 0; i < tamano - 1; i++) {
        TableWeek.getColumnModel().getColumn(i)
                .setCellRenderer(new ResetCellRenderer(TableWeek.getDefaultRenderer(Object.class),
                        Color.LIGHT_GRAY, Color.LIGHT_GRAY, Color.LIGHT_GRAY, Color.LIGHT_GRAY, i));
    }//from   w  w  w. j  av a2  s . c  om

    int[] my_positions = new int[num_positions];
    boolean[] paint = new boolean[num_positions];

    for (int j = 0; j < num_positions; j++) {
        my_positions[j] = -1;
        paint[j] = false;
    }

    //int num = settings.getTickers().size();
    // if (TableWeek.getModel().getRowCount() > 0) {
    int num = Math.min(settings.getTickers().size(), TableWeek.getModel().getRowCount());
    //   }

    // synchronized (Controller.positionLock) {
    for (int row = 0; row < num; row++) {

        if (ht.get(TableTicker.getValueAt(row, 0)) != null) {
            //                if(row>24)JOptionPane.showMessageDialog(null, row+"");
            List<Integer> listInt = ht
                    .get(TableTicker.getValueAt(row, 0) /*settings.getTickers().get(row).getName()*/);
            my_positions[row] = -1;
            if (!listInt.isEmpty() && settings.getTickers().get(row).isHistory()) {
                //                    int col = ht.get(TableTicker.getValueAt(row, 0)).get(index) + 1;
                int col = ht.get(TableTicker.getValueAt(row, 0)).get(index);
                my_positions[row] = col;
            }

        }
    }

    // }
    //Modify the cell
    // if (num > 0) {
    for (int col = 0; col < tamano/*settings.getTickers().size()*/; col++) {

        //     if (paint[col]) {
        TableWeek.getColumnModel().getColumn(col).setCellRenderer(
                new MyCellRenderer(TableWeek.getDefaultRenderer(Object.class), index, Color.LIGHT_GRAY,
                        Color.LIGHT_GRAY, Color.LIGHT_GRAY, Color.LIGHT_GRAY, my_positions, col));
        //     }

    }
    //  }
}