Example usage for javax.swing.table DefaultTableCellRenderer setToolTipText

List of usage examples for javax.swing.table DefaultTableCellRenderer setToolTipText

Introduction

In this page you can find the example usage for javax.swing.table DefaultTableCellRenderer setToolTipText.

Prototype

@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.")
public void setToolTipText(String text) 

Source Link

Document

Registers the text to display in a tool tip.

Usage

From source file:OAT.ui.util.UiUtil.java

public static void setupColumns(JTable table) {
    for (int i = 0; i < table.getColumnCount(); i++) {
        DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
        TableColumn column = table.getColumnModel().getColumn(i);
        Class columnClass = table.getColumnClass(i);
        String columnName = table.getColumnName(i);
        renderer.setToolTipText(columnName);

        if (columnClass.getSuperclass().equals(Number.class)) {
            renderer.setHorizontalAlignment(DefaultTableCellRenderer.RIGHT);
        }/*www  .  j a  v a2 s. c  o m*/

        if (table.isEnabled()) {
            if (columnName.equals("Currency")) {
                //addComboCell(column, Product.CURRENCIES);
            } else if (columnName.equals("Holidays")) {
                //column.setCellEditor(new FileChooserCellEditor());
            }
        }

        column.setCellRenderer(renderer);
    }
}

From source file:TableRenderDemo.java

public void setUpSportColumn(JTable table, TableColumn sportColumn) {
    // Set up the editor for the sport cells.
    JComboBox comboBox = new JComboBox();
    comboBox.addItem("Snowboarding");
    comboBox.addItem("Rowing");
    comboBox.addItem("Knitting");
    comboBox.addItem("Speed reading");
    comboBox.addItem("Pool");
    comboBox.addItem("None of the above");
    sportColumn.setCellEditor(new DefaultCellEditor(comboBox));

    // Set up tool tips for the sport cells.
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for combo box");
    sportColumn.setCellRenderer(renderer);
}

From source file:components.TableRenderDemo.java

public void setUpSportColumn(JTable table, TableColumn sportColumn) {
    //Set up the editor for the sport cells.
    JComboBox comboBox = new JComboBox();
    comboBox.addItem("Snowboarding");
    comboBox.addItem("Rowing");
    comboBox.addItem("Knitting");
    comboBox.addItem("Speed reading");
    comboBox.addItem("Pool");
    comboBox.addItem("None of the above");
    sportColumn.setCellEditor(new DefaultCellEditor(comboBox));

    //Set up tool tips for the sport cells.
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for combo box");
    sportColumn.setCellRenderer(renderer);
}

From source file:logdruid.ui.table.StatRecordingEditorTable.java

public void setUpTypeColumn(JTable theTable, TableColumn TypeColumn) {
    // Set up the editor for the Type cells.
    JComboBox comboBox = new JComboBox();
    comboBox.addItem("word");
    comboBox.addItem("string");
    comboBox.addItem("long");
    comboBox.addItem("double");
    comboBox.addItem("date");
    comboBox.addItem("percent");
    TypeColumn.setCellEditor(new DefaultCellEditor(comboBox));

    // Set up tool tips for the Type cells.
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for combo box");
    TypeColumn.setCellRenderer(renderer);
}

From source file:logdruid.ui.table.EventRecordingEditorTable.java

public void setUpProcessingColumn(JTable theTable, TableColumn typeColumn) {
    JComboBox functionComboBox = new JComboBox();
    functionComboBox.addItem("capture");
    functionComboBox.addItem("duration");
    functionComboBox.addItem("occurrences");
    functionComboBox.addItem("sum");
    typeColumn.setCellEditor(new DefaultCellEditor(functionComboBox));
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for combo box");
    typeColumn.setCellRenderer(renderer);
}

From source file:logdruid.ui.table.EventRecordingEditorTable.java

public void setUpTypeColumn(JTable theTable, TableColumn typeColumn) {
    // Set up the editor for the type cells.
    JComboBox comboBox = new JComboBox();
    comboBox.addItem("word");
    comboBox.addItem("string");
    comboBox.addItem("long");
    comboBox.addItem("double");
    comboBox.addItem("date");
    comboBox.addItem("percent");

    typeColumn.setCellEditor(new DefaultCellEditor(comboBox));

    // Set up tool tips for the type cells.
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for combo box");
    typeColumn.setCellRenderer(renderer);
}

From source file:edu.harvard.mcz.imagecapture.VerbatimClassifyDialog.java

/**
 * This method initializes jTableNumbers   
 *    /*from w w  w . ja  v a 2 s  . c  o  m*/
 * @return javax.swing.JTable   
 */
private JTable getJTableNumbers() {
    if (jTableNumbers == null) {
        jTableNumbers = new JTable(new NumberTableModel());
        JComboBox<String> jComboNumberTypes = new JComboBox<String>();
        jComboNumberTypes.setModel(new DefaultComboBoxModel<String>(NumberLifeCycle.getDistinctTypes()));
        jComboNumberTypes.setEditable(true);
        TableColumn typeColumn = jTableNumbers.getColumnModel().getColumn(NumberTableModel.COLUMN_TYPE);
        DefaultCellEditor comboBoxEditor = new DefaultCellEditor(jComboNumberTypes);
        //TODO: enable autocomplete for numbertypes picklist.
        //AutoCompleteDecorator.decorate((JComboBox) comboBoxEditor.getComponent());
        typeColumn.setCellEditor(comboBoxEditor);
        DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
        renderer.setToolTipText("Click for pick list of number types.");
        typeColumn.setCellRenderer(renderer);
    }
    return jTableNumbers;
}

From source file:com.att.aro.ui.view.menu.tools.RegexWizard.java

private void configVDTagsComboBox(JTable table, int columnIndex) {

    TableColumnModel columnModel = table.getColumnModel();
    TableColumn comboColumn = columnModel.getColumn(columnIndex);

    JComboBox<String> comboBox = new JComboBox<>();

    EnumSet<VideoDataTags> allVDTags = EnumSet.allOf(VideoDataTags.class);
    for (VideoDataTags videoDataTag : allVDTags) {
        comboBox.addItem(videoDataTag.toString());
    }/*from   ww w  .jav  a 2  s. co  m*/

    comboColumn.setCellEditor(new DefaultCellEditor(comboBox));

    /*
     * allows clearing a problem when cell editor is interrupted, very deep problem. 
     * Only shows if: (A) combobox selection is interupted, (B) dialog is
     * closed , and (C) Wizard is entered from the menu in this exact order
     */
    cellEditor = comboColumn.getCellEditor();

    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText(ResourceBundleHelper.getMessageString("videoTab.tooltip"));
    comboColumn.setCellRenderer(renderer);

}

From source file:com.view.PortfolioManagerWindow.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*w  w  w.jav a  2 s.c om*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    logOutButton = new javax.swing.JButton();
    PMPlatformTabbedPane = new javax.swing.JTabbedPane();
    PendingOrders = new javax.swing.JPanel();
    PendingOrderRequests = new javax.swing.JScrollPane();
    PMPendingOrdersTable = new javax.swing.JTable();
    PMPendingOrderFilter = new javax.swing.JButton();
    FilterOptionsPMPending = new javax.swing.JComboBox<>();
    FilterTextPMPending = new javax.swing.JTextField();
    ClearFilterPMPendingOrder = new javax.swing.JButton();
    PMEOD = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    PMEODBoughtScrollPane = new javax.swing.JScrollPane();
    PMEODBoughtTable = new javax.swing.JTable();
    PMEODSoldScrollPane = new javax.swing.JScrollPane();
    PMEODSoldTable = new javax.swing.JTable();
    jLabel3 = new javax.swing.JLabel();
    FilterTextPMEOD = new javax.swing.JTextField();
    FilterOptionsPMEOD = new javax.swing.JComboBox<>();
    PMEODFilter = new javax.swing.JButton();
    ClearFilterPMEOD = new javax.swing.JButton();
    CreateOrder = new javax.swing.JPanel();
    PMSelectTraderOptions = new javax.swing.JComboBox<>();
    jLabel5 = new javax.swing.JLabel();
    PMSendOrderScrollPane = new javax.swing.JScrollPane();
    PMSendOrderTable = new javax.swing.JTable();
    PMSendOrder = new javax.swing.JButton();
    PMAddOrderRow = new javax.swing.JButton();
    PMOrderHistory = new javax.swing.JPanel();
    PMOrderHistoryScrollPane = new javax.swing.JScrollPane();
    PMOrderHistoryTable = new javax.swing.JTable();
    FilterTextPMOrderHistory = new javax.swing.JTextField();
    FilterOptionsPMOrderHistory = new javax.swing.JComboBox<>();
    PMOrderHistoryFilter = new javax.swing.JButton();
    ClearFilterPMOrderHistory = new javax.swing.JButton();
    ChangePassword = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("MoneyTree Trading Platform: Portfolio Manager");
    setMinimumSize(new java.awt.Dimension(1024, 768));
    getContentPane().setLayout(new java.awt.GridBagLayout());

    logOutButton.setText("Logout");
    logOutButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            logOutButtonActionPerformed(evt);
        }
    });
    getContentPane().add(logOutButton, new java.awt.GridBagConstraints());

    PMPlatformTabbedPane.setMinimumSize(new java.awt.Dimension(150, 65));

    PMPendingOrdersTable.setBackground(new java.awt.Color(102, 102, 102));
    PMPendingOrdersTable
            .setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
    String[] CurrencyValues = { "USD", "GBP" };
    PMPendingOrdersTable.setForeground(new java.awt.Color(255, 255, 255));
    PMPendingOrdersTable.setModel(com.controller.CPMOrderMANIAC.getPRTableModel());
    PMPendingOrdersTable.setGridColor(new java.awt.Color(255, 255, 255));
    PMPendingOrdersTable.getTableHeader().setReorderingAllowed(false);
    PendingOrderRequests.setViewportView(PMPendingOrdersTable);

    PMPendingOrderFilter.setText("Filter");
    PMPendingOrderFilter.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            PMPendingOrderFilterActionPerformed(evt);
        }
    });

    FilterOptionsPMPending.setModel(new javax.swing.DefaultComboBoxModel<>(
            new String[] { "Order ID", "Portfolio ID", "Symbol", "Quantity", "Action", "Stop Price",
                    "Limit Price", "Account Type", "Order Type", "Assigned To" }));

    FilterTextPMPending.setText("Filter Text");

    ClearFilterPMPendingOrder.setText("Clear Filter");
    ClearFilterPMPendingOrder.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ClearFilterPMPendingOrderActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout PendingOrdersLayout = new javax.swing.GroupLayout(PendingOrders);
    PendingOrders.setLayout(PendingOrdersLayout);
    PendingOrdersLayout.setHorizontalGroup(
            PendingOrdersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            PendingOrdersLayout.createSequentialGroup()
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(PendingOrderRequests, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            801, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap())
                    .addGroup(PendingOrdersLayout.createSequentialGroup().addContainerGap()
                            .addComponent(FilterTextPMPending, javax.swing.GroupLayout.PREFERRED_SIZE, 281,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(FilterOptionsPMPending, javax.swing.GroupLayout.PREFERRED_SIZE, 126,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18).addComponent(PMPendingOrderFilter).addGap(18, 18, 18)
                            .addComponent(ClearFilterPMPendingOrder)
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    PendingOrdersLayout.setVerticalGroup(PendingOrdersLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PendingOrdersLayout.createSequentialGroup().addContainerGap()
                    .addComponent(PendingOrderRequests, javax.swing.GroupLayout.PREFERRED_SIZE, 183,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(PendingOrdersLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(FilterTextPMPending, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(FilterOptionsPMPending, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(PMPendingOrderFilter).addComponent(ClearFilterPMPendingOrder))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    PMPlatformTabbedPane.addTab("Pending Order Requests", PendingOrders);

    jLabel2.setText("Bought");

    PMEODBoughtTable.setModel(CPMEndOfDay.getBuyTableModel());
    PMEODBoughtScrollPane.setViewportView(PMEODBoughtTable);

    PMEODSoldTable.setModel(CPMEndOfDay.getSellTableModel());
    PMEODSoldScrollPane.setViewportView(PMEODSoldTable);

    jLabel3.setText("Sold");

    FilterTextPMEOD.setText("Filter By");

    FilterOptionsPMEOD.setModel(new javax.swing.DefaultComboBoxModel<>(
            new String[] { "Portfolio ID", "Symbol", "Quantity", "Price" }));

    PMEODFilter.setText("Filter");
    PMEODFilter.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            PMEODFilterActionPerformed(evt);
        }
    });

    ClearFilterPMEOD.setText("Clear Filter");
    ClearFilterPMEOD.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ClearFilterPMEODActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout PMEODLayout = new javax.swing.GroupLayout(PMEOD);
    PMEOD.setLayout(PMEODLayout);
    PMEODLayout.setHorizontalGroup(PMEODLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PMEODLayout.createSequentialGroup()
                    .addGroup(PMEODLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(PMEODLayout.createSequentialGroup().addGap(124, 124, 124)
                                    .addComponent(FilterTextPMEOD, javax.swing.GroupLayout.PREFERRED_SIZE, 350,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(FilterOptionsPMEOD, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            126, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18).addComponent(PMEODFilter))
                            .addGroup(PMEODLayout.createSequentialGroup().addGroup(PMEODLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(PMEODLayout.createSequentialGroup().addGap(234, 234, 234)
                                            .addComponent(jLabel2)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                            PMEODLayout.createSequentialGroup()
                                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(PMEODBoughtScrollPane,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 273,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(18, 18, 18)))
                                    .addGroup(PMEODLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(PMEODSoldScrollPane,
                                                    javax.swing.GroupLayout.Alignment.TRAILING,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 280,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    PMEODLayout.createSequentialGroup().addComponent(jLabel3)
                                                            .addGap(132, 132, 132)))))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(ClearFilterPMEOD).addGap(55, 55, 55)));
    PMEODLayout.setVerticalGroup(PMEODLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PMEODLayout.createSequentialGroup().addContainerGap()
                    .addGroup(PMEODLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3).addComponent(jLabel2))
                    .addGroup(PMEODLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PMEODLayout.createSequentialGroup().addGap(15, 15, 15).addComponent(
                                    PMEODSoldScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 271,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(PMEODLayout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(PMEODBoughtScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            268, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(21, 21, 21)
                    .addGroup(PMEODLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(PMEODFilter)
                            .addComponent(FilterOptionsPMEOD, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(FilterTextPMEOD, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ClearFilterPMEOD))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    PMPlatformTabbedPane.addTab("EOD", PMEOD);

    PMSelectTraderOptions.setModel(new javax.swing.DefaultComboBoxModel<>(TraderNames));
    PMSelectTraderOptions.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            PMSelectTraderOptionsActionPerformed(evt);
        }
    });

    jLabel5.setText("Select Trader to Assign To:");

    PMSendOrderTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][] { { null, null, null, null, null, null, null, null, null } },
            new String[] { "Portfolio ID", "Stock Exchange", "Symbol", "Quantity", "Action", "Order Type",
                    "Stop Price", "Limit Price", "Account Type" }) {
        Class[] types = new Class[] { java.lang.Long.class, java.lang.String.class, java.lang.String.class,
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.Double.class,
                java.lang.Double.class, java.lang.String.class };

        public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
        }
    });
    TableColumn col2 = PMSendOrderTable.getColumnModel().getColumn(1);
    col2.setCellEditor(new myComboBoxEditor(StockExchange));
    col2.setCellRenderer(new MyComboBoxRenderer(StockExchange));
    TableColumn col1 = PMSendOrderTable.getColumnModel().getColumn(4);
    col1.setCellEditor(new myComboBoxEditor(ActionItems));
    col1.setCellRenderer(new MyComboBoxRenderer(ActionItems));
    TableColumn col5 = PMSendOrderTable.getColumnModel().getColumn(5);
    col5.setCellEditor(new myComboBoxEditor(OrderType));
    col5.setCellRenderer(new MyComboBoxRenderer(OrderType));
    TableColumn col3 = PMSendOrderTable.getColumnModel().getColumn(8);
    col3.setCellEditor(new myComboBoxEditor(AccountType));
    col3.setCellRenderer(new MyComboBoxRenderer(AccountType));
    /////////////////////////////////////GG
    TableColumn col4 = PMSendOrderTable.getColumnModel().getColumn(2);

    CSVReader csv = new CSVReader();
    ArrayList<String> symbolList = csv.loadSymbol();

    Java2sAutoComboBox comboBox = new Java2sAutoComboBox(symbolList);
    comboBox.setDataList(symbolList);
    comboBox.setMaximumRowCount(5);
    col4.setCellEditor(new DefaultCellEditor(comboBox));
    //Set up tool tips for the sport cells.
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for combo box");
    col4.setCellRenderer(renderer);

    /////////////////////////////////////gg
    PMSendOrderScrollPane.setViewportView(PMSendOrderTable);

    PMSendOrder.setText("Send Order");
    PMSendOrder.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            PMSendOrderActionPerformed(evt);
        }
    });

    PMAddOrderRow.setText("Add Row");
    PMAddOrderRow.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            PMAddOrderRowActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout CreateOrderLayout = new javax.swing.GroupLayout(CreateOrder);
    CreateOrder.setLayout(CreateOrderLayout);
    CreateOrderLayout.setHorizontalGroup(CreateOrderLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PMSendOrderScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, CreateOrderLayout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(CreateOrderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, CreateOrderLayout
                                    .createSequentialGroup().addComponent(jLabel5).addGap(18, 18, 18)
                                    .addComponent(PMSelectTraderOptions, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            137, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(213, 213, 213).addComponent(PMSendOrder).addContainerGap())
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                    CreateOrderLayout.createSequentialGroup().addComponent(PMAddOrderRow)
                                            .addGap(109, 109, 109)))));
    CreateOrderLayout.setVerticalGroup(CreateOrderLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CreateOrderLayout.createSequentialGroup().addGap(5, 5, 5).addGroup(CreateOrderLayout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(CreateOrderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5).addComponent(PMSelectTraderOptions,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(PMSendOrder)).addGap(28, 28, 28)
                    .addComponent(PMSendOrderScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18).addComponent(PMAddOrderRow)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    PMPlatformTabbedPane.addTab("Create Order", CreateOrder);

    PMOrderHistoryTable.setBackground(new java.awt.Color(102, 102, 102));
    PMOrderHistoryTable
            .setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
    PMOrderHistoryTable.setForeground(new java.awt.Color(255, 255, 255));
    PMOrderHistoryTable.setModel(com.controller.CPMOrderMANIAC.getOHTableModel());
    PMOrderHistoryTable.setGridColor(new java.awt.Color(255, 255, 255));
    PMOrderHistoryTable.getTableHeader().setReorderingAllowed(false);
    PMOrderHistoryScrollPane.setViewportView(PMOrderHistoryTable);

    FilterTextPMOrderHistory.setText("Filter By");

    FilterOptionsPMOrderHistory.setModel(new javax.swing.DefaultComboBoxModel<>(
            new String[] { "Order ID", "Portfolio ID", "Symbol", "Quantity", "Action", "Stop Price",
                    "Limit Price", "Account Type", "Order Type", "Assigned To" }));

    PMOrderHistoryFilter.setText("Filter");
    PMOrderHistoryFilter.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            PMOrderHistoryFilterActionPerformed(evt);
        }
    });

    ClearFilterPMOrderHistory.setText("Clear Filter");
    ClearFilterPMOrderHistory.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ClearFilterPMOrderHistoryActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout PMOrderHistoryLayout = new javax.swing.GroupLayout(PMOrderHistory);
    PMOrderHistory.setLayout(PMOrderHistoryLayout);
    PMOrderHistoryLayout
            .setHorizontalGroup(
                    PMOrderHistoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PMOrderHistoryLayout.createSequentialGroup().addContainerGap()
                                    .addGroup(PMOrderHistoryLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(PMOrderHistoryScrollPane)
                                            .addGroup(PMOrderHistoryLayout.createSequentialGroup()
                                                    .addComponent(FilterTextPMOrderHistory,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 281,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(18, 18, 18)
                                                    .addComponent(FilterOptionsPMOrderHistory,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 126,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(18, 18, 18).addComponent(PMOrderHistoryFilter)
                                                    .addGap(18, 18, 18).addComponent(ClearFilterPMOrderHistory)
                                                    .addGap(0, 0, Short.MAX_VALUE)))
                                    .addContainerGap()));
    PMOrderHistoryLayout.setVerticalGroup(PMOrderHistoryLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PMOrderHistoryLayout.createSequentialGroup()
                    .addComponent(PMOrderHistoryScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 187,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(PMOrderHistoryLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(FilterTextPMOrderHistory, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(FilterOptionsPMOrderHistory, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(PMOrderHistoryFilter).addComponent(ClearFilterPMOrderHistory))
                    .addGap(0, 0, Short.MAX_VALUE)));

    PMPlatformTabbedPane.addTab("Executed Order History", PMOrderHistory);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.ipady = 127;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 85);
    getContentPane().add(PMPlatformTabbedPane, gridBagConstraints);

    ChangePassword.setText("Change Password");
    ChangePassword.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ChangePasswordActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(11, 610, 0, 85);
    getContentPane().add(ChangePassword, gridBagConstraints);

    pack();
}

From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java

/**
 * This method initializes jTable   /*from w ww.j a v a 2s . c  o m*/
 *    
 * @return javax.swing.JTable   
 */
private JTable getJTable() {
    if (jTableNumbers == null) {
        jTableNumbers = new JTable(new NumberTableModel());
        JComboBox<String> jComboNumberTypes = new JComboBox<String>();
        jComboNumberTypes.setModel(new DefaultComboBoxModel<String>(NumberLifeCycle.getDistinctTypes()));
        jComboNumberTypes.setEditable(true);
        TableColumn typeColumn = jTableNumbers.getColumnModel().getColumn(NumberTableModel.COLUMN_TYPE);
        DefaultCellEditor comboBoxEditor = new DefaultCellEditor(jComboNumberTypes);
        //TODO: enable autocomplete for numbertypes picklist.
        //AutoCompleteDecorator.decorate((JComboBox) comboBoxEditor.getComponent());
        typeColumn.setCellEditor(comboBoxEditor);
        DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
        renderer.setToolTipText("Click for pick list of number types.");
        typeColumn.setCellRenderer(renderer);
        jTableNumbers.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent e) {
                thisPane.setStateToDirty();
            }
        });

        jTableNumbers.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                if (e.isPopupTrigger()) {
                    clickedOnNumsRow = ((JTable) e.getComponent()).getSelectedRow();
                    jPopupNumbers.show(e.getComponent(), e.getX(), e.getY());
                }
            }

            @Override
            public void mouseReleased(MouseEvent e) {
                if (e.isPopupTrigger()) {
                    clickedOnNumsRow = ((JTable) e.getComponent()).getSelectedRow();
                    jPopupNumbers.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        });

        jPopupNumbers = new JPopupMenu();
        JMenuItem mntmDeleteRow = new JMenuItem("Delete Row");
        mntmDeleteRow.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    if (clickedOnNumsRow >= 0) {
                        int ok = JOptionPane.showConfirmDialog(thisPane, "Delete the selected number?",
                                "Delete Number", JOptionPane.OK_CANCEL_OPTION);
                        if (ok == JOptionPane.OK_OPTION) {
                            log.debug("deleting numbers row " + clickedOnNumsRow);
                            ((NumberTableModel) jTableNumbers.getModel()).deleteRow(clickedOnNumsRow);
                            setStateToDirty();
                        } else {
                            log.debug("number row delete canceled by user.");
                        }
                    } else {
                        JOptionPane.showMessageDialog(thisPane,
                                "Unable to select row to delete.  Try empting number and type and pressing Save.");
                    }
                } catch (Exception ex) {
                    log.error(ex.getMessage());
                    JOptionPane.showMessageDialog(thisPane,
                            "Failed to delete a number row. " + ex.getMessage());
                }
            }
        });
        jPopupNumbers.add(mntmDeleteRow);
    }
    return jTableNumbers;
}