Example usage for javax.swing JTable AUTO_RESIZE_ALL_COLUMNS

List of usage examples for javax.swing JTable AUTO_RESIZE_ALL_COLUMNS

Introduction

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

Prototype

int AUTO_RESIZE_ALL_COLUMNS

To view the source code for javax.swing JTable AUTO_RESIZE_ALL_COLUMNS.

Click Source Link

Document

During all resize operations, proportionately resize all columns.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Object[][] cellData = { { "1-1", "1-2" }, { "2-1", "2-2" } };
    String[] columnNames = { "col1", "col2" };

    JTable table = new JTable(cellData, columnNames);

    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
}

From source file:MainClass.java

public static void main(String args[]) {
    String rows[][] = { { "A", "a" }, { "B", "b" }, { "E", "e" } };
    String headers[] = { "Upper", "Lower" };

    final int modeKey[] = { JTable.AUTO_RESIZE_ALL_COLUMNS, JTable.AUTO_RESIZE_LAST_COLUMN,
            JTable.AUTO_RESIZE_NEXT_COLUMN, JTable.AUTO_RESIZE_OFF, JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS };

    final JTable table = new JTable(rows, headers);
    JScrollPane scrollPane = new JScrollPane(table);

    String modes[] = { "Resize All Columns", "Resize Last Column", "Resize Next Column", "Resize Off",
            "Resize Subsequent Columns" };

    final JComboBox resizeModeComboBox = new JComboBox(modes);
    int defaultMode = 4;
    table.setAutoResizeMode(modeKey[defaultMode]);
    resizeModeComboBox.setSelectedIndex(defaultMode);
    ItemListener itemListener = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            int index = resizeModeComboBox.getSelectedIndex();
            table.setAutoResizeMode(modeKey[index]);
        }//  w  w w.ja  v  a 2  s . c o  m
    };
    resizeModeComboBox.addItemListener(itemListener);

    JFrame frame = new JFrame("Resizing Table");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(resizeModeComboBox, BorderLayout.NORTH);
    frame.add(scrollPane, BorderLayout.CENTER);

    frame.setSize(300, 150);
    frame.setVisible(true);
}

From source file:ResizeTable.java

public static void main(String args[]) {

    final Object rowData[][] = { { "1", "one", "I" }, { "2", "two", "II" }, { "3", "three", "III" } };
    final String columnNames[] = { "#", "English", "Roman" };

    final JTable table = new JTable(rowData, columnNames);
    JScrollPane scrollPane = new JScrollPane(table);

    String modes[] = { "Resize All Columns", "Resize Last Column", "Resize Next Column", "Resize Off",
            "Resize Subsequent Columns" };

    final int modeKey[] = { JTable.AUTO_RESIZE_ALL_COLUMNS, JTable.AUTO_RESIZE_LAST_COLUMN,
            JTable.AUTO_RESIZE_NEXT_COLUMN, JTable.AUTO_RESIZE_OFF, JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS };

    JComboBox resizeModeComboBox = new JComboBox(modes);

    ItemListener itemListener = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            JComboBox source = (JComboBox) e.getSource();
            int index = source.getSelectedIndex();
            table.setAutoResizeMode(modeKey[index]);
        }//ww  w . j  a v a2 s  .  c o m
    };
    resizeModeComboBox.addItemListener(itemListener);

    JFrame frame = new JFrame("Resizing Table");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(resizeModeComboBox, BorderLayout.NORTH);
    frame.add(scrollPane, BorderLayout.CENTER);

    frame.setSize(300, 150);
    frame.setVisible(true);

}

From source file:ResizeTable.java

public static void main(String args[]) {

    Object rowData[][] = { { "1", "one", "ichi - \u4E00", "un", "I" },
            { "2", "two", "ni - \u4E8C", "deux", "II" }, { "3", "three", "san - \u4E09", "trois", "III" },
            { "4", "four", "shi - \u56DB", "quatre", "IV" }, { "5", "five", "go - \u4E94", "cinq", "V" },
            { "6", "six", "roku - \u516D", "treiza", "VI" }, { "7", "seven", "shichi - \u4E03", "sept", "VII" },
            { "8", "eight", "hachi - \u516B", "huit", "VIII" }, { "9", "nine", "kyu - \u4E5D", "neur", "IX" },
            { "10", "ten", "ju - \u5341", "dix", "X" } };

    String columnNames[] = { "#", "English", "Japanese", "French", "Roman" };

    final JTable table = new JTable(rowData, columnNames);
    JScrollPane scrollPane = new JScrollPane(table);

    String modes[] = { "Resize All Columns", "Resize Last Column", "Resize Next Column", "Resize Off",
            "Resize Subsequent Columns" };
    final int modeKey[] = { JTable.AUTO_RESIZE_ALL_COLUMNS, JTable.AUTO_RESIZE_LAST_COLUMN,
            JTable.AUTO_RESIZE_NEXT_COLUMN, JTable.AUTO_RESIZE_OFF, JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS };
    JComboBox resizeModeComboBox = new JComboBox(modes);
    int defaultMode = 4;
    table.setAutoResizeMode(modeKey[defaultMode]);
    resizeModeComboBox.setSelectedIndex(defaultMode);
    ItemListener itemListener = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            JComboBox source = (JComboBox) e.getSource();
            int index = source.getSelectedIndex();
            table.setAutoResizeMode(modeKey[index]);
        }/*from   w w w  .  j  a va 2s  .c om*/
    };
    resizeModeComboBox.addItemListener(itemListener);

    JFrame frame = new JFrame("Resizing Table");
    Container contentPane = frame.getContentPane();

    contentPane.add(resizeModeComboBox, BorderLayout.NORTH);
    contentPane.add(scrollPane, BorderLayout.CENTER);

    frame.setSize(300, 150);
    frame.setVisible(true);
}

From source file:ListProperties.java

public static void main(String args[]) {
    final JFrame frame = new JFrame("List Properties");

    final CustomTableModel model = new CustomTableModel();
    model.uiDefaultsUpdate(UIManager.getDefaults());
    TableSorter sorter = new TableSorter(model);

    JTable table = new JTable(sorter);
    TableHeaderSorter.install(sorter, table);

    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

    Container content = frame.getContentPane();

    JScrollPane scrollPane = new JScrollPane(table);
    content.add(scrollPane, BorderLayout.CENTER);
    frame.setSize(400, 400);/* w  w w  . j  a v a  2  s .  c om*/
    frame.setVisible(true);
}

From source file:ListProperties.java

public static void main(String args[]) {
    final JFrame frame = new JFrame("List Properties");

    final CustomTableModel model = new CustomTableModel();
    model.uiDefaultsUpdate(UIManager.getDefaults());
    TableSorter sorter = new TableSorter(model);

    JTable table = new JTable(sorter);
    TableHeaderSorter.install(sorter, table);

    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

    UIManager.LookAndFeelInfo looks[] = UIManager.getInstalledLookAndFeels();

    ActionListener actionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            final String lafClassName = actionEvent.getActionCommand();
            Runnable runnable = new Runnable() {
                public void run() {
                    try {
                        UIManager.setLookAndFeel(lafClassName);
                        SwingUtilities.updateComponentTreeUI(frame);
                        // Added
                        model.uiDefaultsUpdate(UIManager.getDefaults());
                    } catch (Exception exception) {
                        JOptionPane.showMessageDialog(frame, "Can't change look and feel", "Invalid PLAF",
                                JOptionPane.ERROR_MESSAGE);
                    }/*from w  w w.j a  v  a  2  s.  c o m*/
                }
            };
            SwingUtilities.invokeLater(runnable);
        }
    };

    JToolBar toolbar = new JToolBar();
    for (int i = 0, n = looks.length; i < n; i++) {
        JButton button = new JButton(looks[i].getName());
        button.setActionCommand(looks[i].getClassName());
        button.addActionListener(actionListener);
        toolbar.add(button);
    }

    Container content = frame.getContentPane();
    content.add(toolbar, BorderLayout.NORTH);
    JScrollPane scrollPane = new JScrollPane(table);
    content.add(scrollPane, BorderLayout.CENTER);
    frame.setSize(400, 400);
    frame.setVisible(true);
}

From source file:com.intuit.tank.tools.debugger.VariableDialog.java

public VariableDialog(AgentDebuggerFrame f, Map<String, String> variables) {
    super(f, true);
    this.f = f;//from   ww  w . j  a va2  s . c  o  m
    setLayout(new BorderLayout());
    setTitle("View Edit Project Variables");
    DefaultTableModel model = new DefaultTableModel();
    model.addColumn("Variable Name");
    model.addColumn("Variable Value");
    List<String> keys = new ArrayList<String>(variables.keySet());
    Collections.sort(keys);
    for (String key : keys) {
        Object[] data = new Object[2];
        data[0] = key;
        data[1] = variables.get(key);
        model.addRow(data);
    }
    table = new JTable(model);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.getSelectionModel().addListSelectionListener(this);
    table.setGridColor(Color.GRAY);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    table.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    table.setShowGrid(true);
    table.getTableHeader().setReorderingAllowed(false);

    JScrollPane sp = new JScrollPane(table);
    JPanel panel = new JPanel(new BorderLayout());

    panel.add(table.getTableHeader(), BorderLayout.NORTH);
    panel.add(sp, BorderLayout.CENTER);

    add(panel, BorderLayout.CENTER);
    add(createButtonPanel(), BorderLayout.SOUTH);
    setSize(new Dimension(800, 600));
    setBounds(new Rectangle(getSize()));
    setPreferredSize(getSize());
    WindowUtil.centerOnParent(this);
}

From source file:SampleSortingTableModel.java

public SortableTableModelAbstractTableModel() {
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    JTable tableOrig = new JTable(model);
    tableOrig.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    JTable tableSorted = new JTable(new SampleSortingTableModel(model, 0));
    tableSorted.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    JPanel panel = new JPanel(new GridLayout(1, 2));
    panel.add(new JScrollPane(tableOrig));
    panel.add(new JScrollPane(tableSorted));
    getContentPane().add(panel, BorderLayout.CENTER);
    pack();/*from   ww  w .j a va  2  s  . c  o m*/
}

From source file:Interface.ResultadoJanela.java

public ResultadoJanela(List<Resultado> tar, List<Resultado> jac, List<Resultado> och, List<Resultado> sbi) {
    //  super("Resultado");
    CategoryDataset dataset;//from   ww w  . ja  v a2 s .c  o m

    //---------------------gerando resultados tarantula-------------------------------------
    dataset = gerarDataset(tar, jac, och, sbi);
    JFreeChart chart = gerarGrafico(dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setDomainZoomable(true);

    JLabel lAjuda = new JLabel("Ajuda", JLabel.RIGHT);
    lAjuda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icone_informacao.gif"))); // NOI18N
    lAjuda.setPreferredSize(new Dimension(50, 50));
    lAjuda.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            lAjudaMouseClicked(evt);
        }
    });

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(lAjuda, BorderLayout.BEFORE_FIRST_LINE);
    panel.add(chartPanel, BorderLayout.LINE_START);
    JLabel lTabela = new JLabel("Tabela de Resultados", JLabel.CENTER);
    panel.add(lTabela, BorderLayout.SOUTH);

    JTable table = new JTable(criarValores(tar, jac, och, sbi), criarColunas());

    // Adiciona o JTable dentro do painel
    JScrollPane scrollPane = new JScrollPane(table);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

    panel.add(scrollPane, BorderLayout.SOUTH);

    JFrame frame = new JFrame();
    frame.setTitle("JLoc - Resultado");
    frame.setVisible(true);
    frame.add(panel);

    frame.pack();
    frame.setVisible(true);
}

From source file:com.std.StockPanel.java

public void setHistoricalData() {
    this.setLayout(new BorderLayout());
    nameAndChangePanel.setLayout(new BoxLayout(nameAndChangePanel, BoxLayout.PAGE_AXIS));
    nameAndChangePanel.add(nameLbl);//w  w w  .  j  ava2s  .  co m
    nameAndChangePanel.add(priceChangePercentLbl);

    data = new Object[30][2];
    String[] colnames = { "1", "2" };

    GridBagConstraints c = new GridBagConstraints();
    dataAndGraph.setLayout(new GridBagLayout());
    c.anchor = GridBagConstraints.NORTHWEST;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 0;
    c.gridheight = 1;
    c.insets = new Insets(0, 20, 0, 20);
    dataAndGraph.add(nameAndChangePanel, c);
    c.weightx = 0;
    c.weighty = 1;
    c.insets = new Insets(0, 20, 0, 0);
    //c.ipady = 20;
    c.gridx = 0;
    c.gridy = 1;
    remainingInfoTable = new StockTable(data, colnames);
    remainingInfoTable.setShowGrid(false);
    remainingInfoTable.setTableHeader(null);
    remainingInfoTable.setBackground(this.getBackground());
    remainingInfoTable.setFocusable(false);
    remainingInfoTable.setColumnSelectionAllowed(false);
    remainingInfoTable.setRowSelectionAllowed(false);
    remainingInfoTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    dataAndGraph.add(remainingInfoTable, c);
    this.add(dataAndGraph, BorderLayout.CENTER);

    c.anchor = GridBagConstraints.NORTHWEST;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 0;
    c.gridheight = 2;
    //c.ipady = 20;
    c.gridx = 1;
    c.gridy = 0;
    dataAndGraph.add(chartPane, c);
    chartPane.setVisible(false);
    this.add(dataAndGraph, BorderLayout.CENTER);

    Test.show_hist_data(currentStock, b);
    currentStock.calculate_beta(sp500, 1200);

    nameLbl.setText(currentStock.get_name() + " (" + currentStock.get_symbol() + ")");
    nameLbl.setFont(new Font(nameLbl.getName(), Font.BOLD, 24));
    priceChangePercentLbl.setText(currentStock.get_price() + " ");
    String message = currentStock.get_change() + " " + currentStock.get_percent_change();
    if (Double.parseDouble(currentStock.get_change()) < 0)
        priceChangePercentLbl.setText(String.format("<html>%s<font color='red'>%s</font></html>",
                priceChangePercentLbl.getText(), message));
    else
        priceChangePercentLbl.setText(String.format("<html>%s<font color='green'>%s</font></html>",
                priceChangePercentLbl.getText(), message));
    priceChangePercentLbl.setFont(new Font(priceChangePercentLbl.getName(), Font.PLAIN, 15));

    data[0][0] = "Prev Close: " + currentStock.get_prev_close();
    data[1][0] = "Open: " + currentStock.get_open_price();
    data[2][0] = "Bid: " + currentStock.get_bid();
    data[3][0] = "Ask: " + currentStock.get_ask();
    data[4][0] = "One Year Target: " + currentStock.get_one_year_target();
    data[5][0] = "Ebita: " + currentStock.get_ebitda();
    data[0][1] = "Day Range: " + currentStock.get_days_range();
    data[1][1] = "52 Week Range: " + currentStock.get_year_range();
    data[2][1] = "Volume: " + currentStock.get_volume();
    data[3][1] = "Average Daily Volume: " + currentStock.get_avg_daily_volume();
    data[4][1] = "Market Cap: " + currentStock.get_market_cap();
    data[5][1] = "P/E: " + currentStock.get_pe();
    data[6][1] = "EPS: " + currentStock.get_earnings_per_share();
    data[7][1] = "Dividend (Yield): " + currentStock.get_dividend_per_share() + "("
            + currentStock.get_dividend_yield() + ")";
    data[6][0] = "Reveune:" + currentStock.get_revenue();
    data[7][0] = "Earnings Estimate: " + currentStock.get_earnings_estimate_current_year();
    data[8][0] = "Beta: " + currentStock.get_beta();
    data[8][1] = "PEG Ratio: " + currentStock.get_peg_ratio();
    data[9][0] = "Short Ratio: " + currentStock.get_short_ratio();

    data[11][0] = "50 Day MA: " + currentStock.get_fiftyday_moving_avg();
    data[12][0] = "200 Day MA: " + currentStock.get_twohundredday_moving_avg();
    if (currentStock.get_change_from_fiftyday_moving_avg() != null
            && currentStock.get_change_from_fiftyday_moving_avg().contains("-")) {
        data[13][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Change 50 Day MA: ",
                currentStock.get_change_from_fiftyday_moving_avg());
        data[14][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Percent 50 Day MA: ",
                currentStock.get_percent_change_from_fiftyday_moving_avg());

    } else {
        data[13][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Change 50 Day MA: ",
                currentStock.get_change_from_fiftyday_moving_avg());
        data[14][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Percent 50 Day MA: ",
                currentStock.get_percent_change_from_fiftyday_moving_avg());
    }
    if (currentStock.get_change_from_twohundredday_moving_avg() != null
            && currentStock.get_change_from_twohundredday_moving_avg().contains("-")) {
        data[15][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Change 200 Day MA: ",
                currentStock.get_change_from_twohundredday_moving_avg());
        data[16][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Percent 200 Day MA: ",
                currentStock.get_percent_change_from_twohundredday_moving_avg());
    } else {
        data[15][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Change 200 Day MA: ",
                currentStock.get_change_from_twohundredday_moving_avg());
        data[16][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Percent 200 Day MA: ",
                currentStock.get_percent_change_from_twohundredday_moving_avg());
    }
    data[17][0] = "Year High: " + currentStock.get_year_high();
    data[18][0] = "Year Low: " + currentStock.get_year_low();
    if (currentStock.get_change_from_year_high() != null
            && currentStock.get_change_from_year_high().contains("-")) {
        data[19][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year High Change: ",
                currentStock.get_change_from_year_high());
        data[20][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year High Percent: ",
                currentStock.get_percent_change_from_year_high());
    } else {
        data[19][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year High Change: ",
                currentStock.get_change_from_year_high());
        data[20][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year High Percent: ",
                currentStock.get_percent_change_from_year_high());
    }
    if (currentStock.get_change_from_year_low() != null
            && currentStock.get_change_from_year_low().contains("-")) {
        data[21][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year Low Change: ",
                currentStock.get_change_from_year_low());
        data[22][0] = String.format("<html>%s<font color='red'>%s</font></html>", "Year Low Percent:  ",
                currentStock.get_percent_change_from_year_low());
    } else {
        data[21][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year Low Change: ",
                currentStock.get_change_from_year_low());
        data[22][0] = String.format("<html>%s<font color='green'>%s</font></html>", "Year Low Percent:  ",
                currentStock.get_percent_change_from_year_low());
    }
    if (currentStock.get_five_day_change()[0] != null && currentStock.get_five_day_change()[0].contains("-"))
        data[11][1] = String.format("<html>%s<font color='red'>%s</font></html>", "5D Change: ",
                currentStock.get_five_day_change()[0] + " (" + currentStock.get_five_day_change()[1] + ")");
    else
        data[11][1] = String.format("<html>%s<font color='green'>%s</font></html>", "5D Change: ",
                currentStock.get_five_day_change()[0] + " (" + currentStock.get_five_day_change()[1] + ")");
    if (currentStock.get_one_month_change()[0] != null && currentStock.get_one_month_change()[0].contains("-"))
        data[12][1] = String.format("<html>%s<font color='red'>%s</font></html>", "1M Change: ",
                currentStock.get_one_month_change()[0] + " (" + currentStock.get_one_month_change()[1] + ")");
    else
        data[12][1] = String.format("<html>%s<font color='green'>%s</font></html>", "1M Change: ",
                currentStock.get_one_month_change()[0] + " (" + currentStock.get_one_month_change()[1] + ")");
    if (currentStock.get_three_month_change()[0] != null
            && currentStock.get_three_month_change()[0].contains("-"))
        data[13][1] = String.format("<html>%s<font color='red'>%s</font></html>", "3M Change: ",
                currentStock.get_three_month_change()[0] + " (" + currentStock.get_three_month_change()[1]
                        + ")");
    else
        data[13][1] = String.format("<html>%s<font color='green'>%s</font></html>", "3M Change: ",
                currentStock.get_three_month_change()[0] + " (" + currentStock.get_three_month_change()[1]
                        + ")");
    if (currentStock.get_six_month_change()[0] != null && currentStock.get_six_month_change()[0].contains("-"))
        data[14][1] = String.format("<html>%s<font color='red'>%s</font></html>", "6M Change: ",
                currentStock.get_six_month_change()[0] + " (" + currentStock.get_six_month_change()[1] + ")");
    else
        data[14][1] = String.format("<html>%s<font color='green'>%s</font></html>", "6M Change: ",
                currentStock.get_six_month_change()[0] + " (" + currentStock.get_six_month_change()[1] + ")");
    if (currentStock.get_ytd_change()[0] != null && currentStock.get_ytd_change()[0].contains("-"))
        data[15][1] = String.format("<html>%s<font color='red'>%s</font></html>", "YTD Change: ",
                currentStock.get_ytd_change()[0] + " (" + currentStock.get_ytd_change()[1] + ")");
    else
        data[15][1] = String.format("<html>%s<font color='green'>%s</font></html>", "YTD Change: ",
                currentStock.get_ytd_change()[0] + " (" + currentStock.get_ytd_change()[1] + ")");
    if (currentStock.get_one_year_change()[0] != null && currentStock.get_one_year_change()[0].contains("-"))
        data[16][1] = String.format("<html>%s<font color='red'>%s</font></html>", "1Y Change: ",
                currentStock.get_one_year_change()[0] + " (" + currentStock.get_one_year_change()[1] + ")");
    else
        data[16][1] = String.format("<html>%s<font color='green'>%s</font></html>", "1Y Change: ",
                currentStock.get_one_year_change()[0] + " (" + currentStock.get_one_year_change()[1] + ")");
    if (currentStock.get_five_year_change()[0] != null && currentStock.get_five_year_change()[0].contains("-"))
        data[17][1] = String.format("<html>%s<font color='red'>%s</font></html>", "5Y Change: ",
                currentStock.get_five_year_change()[0] + " (" + currentStock.get_five_year_change()[1] + ")");
    else
        data[17][1] = String.format("<html>%s<font color='green'>%s</font></html>", "5Y Change: ",
                currentStock.get_five_year_change()[0] + " (" + currentStock.get_five_year_change()[1] + ")");
    if (currentStock.get_ten_year_change()[0] != null && currentStock.get_ten_year_change()[0].contains("-"))
        data[18][1] = String.format("<html>%s<font color='red'>%s</font></html>", "10Y Change: ",
                currentStock.get_ten_year_change()[0] + " (" + currentStock.get_ten_year_change()[1] + ")");
    else
        data[18][1] = String.format("<html>%s<font color='green'>%s</font></html>", "10Y Change: ",
                currentStock.get_ten_year_change()[0] + " (" + currentStock.get_ten_year_change()[1] + ")");
    if (currentStock.get_max_year_change()[0] != null && currentStock.get_max_year_change()[0].contains("-"))
        data[19][1] = String.format("<html>%s<font color='red'>%s</font></html>", "Max Change: ",
                currentStock.get_max_year_change()[0] + " (" + currentStock.get_max_year_change()[1] + ")");
    else
        data[19][1] = String.format("<html>%s<font color='green'>%s</font></html>", "Max Change: ",
                currentStock.get_max_year_change()[0] + " (" + currentStock.get_max_year_change()[1] + ")");

    data[24][0] = "Earnings Est Next Quarter: " + currentStock.get_earnings_estimate_next_quarter();
    data[25][0] = "Earnings Est Current Year: " + currentStock.get_earnings_estimate_current_year();
    data[26][0] = "Earnings Est Next Year: " + currentStock.get_earnings_estimate_next_year();
    data[24][1] = "P/E Est Current Year: " + currentStock.get_price_eps_estimate_current_year();
    data[25][1] = "P/E Est Next Year: " + currentStock.get_price_eps_estimate_next_year();
    remainingInfoTable.setFont(new Font(remainingInfoTable.getName(), Font.PLAIN, 15));
    remainingInfoTable.packColumn(0, 4);
    remainingInfoTable.packColumn(1, 4);

    try {
        dataAndGraph.remove(chartPane);
        chartPane = new JTabbedPane();
        chartPane.setVisible(true);
        ChartPanel intradayChart = new IntradayChart(currentStock).getChartPanel();
        intradayChart.setPopupMenu(graphMenu);
        chartPane.addTab("1d", intradayChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_1);

        ChartPanel fivedayChart = new FiveDayChart(currentStock).getChartPanel();
        fivedayChart.setPopupMenu(graphMenu);
        chartPane.addTab("5d", fivedayChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_2);

        ChartPanel onemonthChart = new OneMonthChart(currentStock).getChartPanel();
        onemonthChart.setPopupMenu(graphMenu);
        chartPane.addTab("1m", onemonthChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_3);

        ChartPanel threemonthChart = new ThreeMonthChart(currentStock).getChartPanel();
        threemonthChart.setPopupMenu(graphMenu);
        chartPane.addTab("3m", threemonthChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_4);

        ChartPanel sixmonthChart = new SixMonthChart(currentStock).getChartPanel();
        sixmonthChart.setPopupMenu(graphMenu);
        chartPane.addTab("6m", sixmonthChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_5);

        ChartPanel ytdChart = new YTDChart(currentStock).getChartPanel();
        ytdChart.setPopupMenu(graphMenu);
        chartPane.addTab("ytd", ytdChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_6);

        ChartPanel oneyearChart = new OneYearChart(currentStock).getChartPanel();
        oneyearChart.setPopupMenu(graphMenu);
        chartPane.addTab("1y", oneyearChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_7);

        ChartPanel fiveyearChart = new FiveYearChart(currentStock).getChartPanel();
        fiveyearChart.setPopupMenu(graphMenu);
        chartPane.addTab("5y", fiveyearChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_8);

        ChartPanel tenyearChart = new TenYearChart(currentStock).getChartPanel();
        tenyearChart.setPopupMenu(graphMenu);
        chartPane.addTab("10y", tenyearChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_9);

        ChartPanel maxChart = new MaxChart(currentStock).getChartPanel();
        maxChart.setPopupMenu(graphMenu);
        chartPane.addTab("max", maxChart);
        chartPane.setMnemonicAt(0, KeyEvent.VK_0);

        c = new GridBagConstraints();
        c.anchor = GridBagConstraints.NORTHWEST;
        c.fill = GridBagConstraints.BOTH;
        c.weightx = 1;
        c.weighty = 0;
        c.gridheight = 2;
        //c.ipady = 20;
        c.gridx = 1;
        c.gridy = 0;
        dataAndGraph.add(chartPane, c);

    } catch (ParseException ex) {
        Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
    }
    chartPane.revalidate();
    chartPane.repaint();
    revalidate();
    repaint();
    finished = true;
}