Package org.td.ui

Source Code of org.td.ui.ApplicationFrame

package org.td.ui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.ResourceBundle;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;

import com.jidesoft.swing.JideBoxLayout;
import com.jidesoft.swing.JideTabbedPane;
import java.util.Date;
import javax.swing.JButton;
import javax.swing.table.TableColumn;
import org.td.ui.table.components.CalendarCellRenderer;



public class ApplicationFrame extends JFrame {

    private JPanel headerPanel;
    private JPanel mainPanel;
    private JideTabbedPane tabbedPane;
    private JTable table;
    private final ResourceBundle i18n;
    private final String[] titles;

    public ApplicationFrame(ResourceBundle resource) {
        i18n = resource;
       
        titles = new String[]{
                    i18n.getString("table"),
                    i18n.getString("chart"),
                    i18n.getString("risk"),
                    i18n.getString("input")
                };
        initComponents();
        layoutComponents();
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        pack();
    }

    private void initComponents() {
        this.setTitle("Trader's Diary");
        headerPanel = new JPanel();
        mainPanel = new JPanel();
        tabbedPane = new JideTabbedPane();

        table = new JTable();
        // table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);


        JScrollPane tableScroll = new JScrollPane(table);
        tabbedPane.addTab(i18n.getString("table"), tableScroll);
       
//        MarginRate rate = ConnectionHandler.getConnection().getMarginRateByBrokerId(new Integer(0));
//
//        for (int i = 0; i < titles.length; i++) {
//            JScrollPane scrollPane = new JScrollPane(new JTextArea("Broker Id: " + rate.getBrokerId() + " Short: " + rate.getShortMargin() + " Long: " + rate.getLongMargin()));
//            scrollPane.setPreferredSize(new Dimension(530, 530));
//            tabbedPane.addTab(titles[i], scrollPane);
//            tabbedPane.setMnemonicAt(i, mnemonics[i]);
//        }
    }

    private void layoutComponents() {

        this.getContentPane().add(mainPanel);

        mainPanel.setLayout(new JideBoxLayout(mainPanel, JideBoxLayout.Y_AXIS));
        mainPanel.setPreferredSize(new Dimension(600, 450));

        headerPanel.setPreferredSize(new Dimension(600, 40));
        headerPanel.setMinimumSize(new Dimension(0, 0));
        mainPanel.add(headerPanel, JideBoxLayout.FIX);

        tabbedPane.setPreferredSize(new Dimension(600, 400));
        tabbedPane.setMinimumSize(new Dimension(0, 0));
        mainPanel.add(tabbedPane, JideBoxLayout.VARY);
    }

  public JTable getTable() {
    return table;
  }
   
   
}
TOP

Related Classes of org.td.ui.ApplicationFrame

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.