Search in sources :

Example 26 with JTable

use of javax.swing.JTable in project pcgen by PCGen.

the class CampaignPanel method setupDisplay.

/**
	 * @see pcgen.gui2.converter.panel.ConvertSubPanel#setupDisplay(javax.swing.JPanel, pcgen.cdom.base.CDOMObject)
	 */
@Override
public void setupDisplay(JPanel panel, final CDOMObject pc) {
    panel.setLayout(new GridBagLayout());
    JLabel introLabel = new JLabel("Please select the Campaign(s) to Convert:");
    GridBagConstraints gbc = new GridBagConstraints();
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
    gbc.insets = new Insets(25, 25, 5, 25);
    panel.add(introLabel, gbc);
    final CampaignTableModel model = new CampaignTableModel(gameModeCampaigns, folderName);
    final JTable table = new JTable(model) {

        //Implement table cell tool tips.
        @Override
        public String getToolTipText(MouseEvent e) {
            java.awt.Point p = e.getPoint();
            int rowIndex = rowAtPoint(p);
            int colIndex = columnAtPoint(p);
            String tip = String.valueOf(getValueAt(rowIndex, colIndex));
            return tip;
        }
    };
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent event) {
            pc.removeListFor(ListKey.CAMPAIGN);
            int[] selRows = table.getSelectedRows();
            if (selRows.length == 0) {
                saveSourceSelection(pc);
                fireProgressEvent(ProgressEvent.NOT_ALLOWED);
            } else {
                for (int row : selRows) {
                    Campaign selCampaign = (Campaign) model.getValueAt(row, 0);
                    pc.addToListFor(ListKey.CAMPAIGN, selCampaign);
                }
                saveSourceSelection(pc);
                fireProgressEvent(ProgressEvent.ALLOWED);
            }
        }
    });
    JScrollPane listScroller = new JScrollPane(table);
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 1.0, 1.0);
    gbc.fill = GridBagConstraints.BOTH;
    panel.add(listScroller, gbc);
    initSourceSelection(model, table);
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) GridBagLayout(java.awt.GridBagLayout) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JLabel(javax.swing.JLabel) ListSelectionListener(javax.swing.event.ListSelectionListener) Campaign(pcgen.core.Campaign) JTable(javax.swing.JTable)

Example 27 with JTable

use of javax.swing.JTable in project pcgen by PCGen.

the class TableUtils method createDefaultTable.

public static JTable createDefaultTable() {
    JTable table = new JTable();
    table.setFillsViewportHeight(true);
    return table;
}
Also used : JTable(javax.swing.JTable)

Example 28 with JTable

use of javax.swing.JTable in project ACS by ACS-Community.

the class ErrorTreeCellRenderer method getMembersTable.

/**
	 * This method initializes jTable2	
	 * 	
	 * @return javax.swing.JTable	
	 */
private JTable getMembersTable() {
    if (membersTable == null) {
        membersTable = new JTable();
        membersTable.setEnabled(false);
    }
    return membersTable;
}
Also used : JTable(javax.swing.JTable)

Example 29 with JTable

use of javax.swing.JTable in project ACS by ACS-Community.

the class JDynAct method buildWindow.

/** Build the GUI
	 *
	 */
private void buildWindow() {
    Container rootCnt = getContentPane();
    rootCnt.setLayout(new BorderLayout());
    // The container with labels and combo boxes
    Container firstCnt = new Container();
    firstCnt.setLayout(new GridLayout(4, 2));
    firstCnt.add(new JLabel("Name"));
    nameCB = new JComboBox();
    nameCB.setEditable(true);
    nameCB.addItem("*");
    nameCB.addItem("PIPPO");
    nameCB.addItem("PLUTO");
    firstCnt.add(nameCB);
    firstCnt.add(new JLabel("IDL interface"));
    idlCB = new JComboBox();
    idlCB.addItem("*");
    idlCB.addItem("IDL:alma/acsexmplLamp/Lamp:1.0");
    idlCB.addItem("IDL:alma/MOUNT_ACS/Mount:1.0");
    idlCB.addItem("IDL:alma/demo/HelloDemo:1.0");
    idlCB.setEditable(true);
    firstCnt.add(idlCB);
    firstCnt.add(new JLabel("Implementation"));
    implCB = new JComboBox();
    implCB.addItem("*");
    implCB.addItem("acsexmplLampImpl");
    implCB.addItem("acsexmplMountImpl");
    implCB.addItem("alma.demo.HelloDemoImpl.HelloDemoHelper");
    implCB.addItem("demoImpl.HelloDemo");
    implCB.addItem("acsexmplHelloWorldClient");
    implCB.setEditable(true);
    firstCnt.add(implCB);
    firstCnt.add(new JLabel("Container"));
    containerCB = new JComboBox();
    containerCB.addItem("*");
    containerCB.addItem("bilboContainer");
    containerCB.addItem("frodoContainer");
    containerCB.addItem("aragornContainer");
    containerCB.setEditable(true);
    firstCnt.add(containerCB);
    // The container with the activate button
    Container secondCnt = new Container();
    secondCnt.setLayout(new FlowLayout());
    JButton activateB = new JButton("Activate");
    activateB.addActionListener(this);
    secondCnt.add(activateB, "Center");
    // The container with activated container
    MyTableModel tableModel = new MyTableModel();
    activatedT = new JTable(tableModel);
    activatedT.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = activatedT.getSelectionModel();
    JScrollPane scrollP = new JScrollPane(activatedT);
    activatedT.setPreferredScrollableViewportSize(new Dimension(400, 90));
    MyCellRendererr cellR = new MyCellRendererr();
    TableColumnModel tcm = activatedT.getColumnModel();
    TableColumn tc = tcm.getColumn(2);
    tc.setCellRenderer(cellR);
    MyCellEditor cellE = new MyCellEditor(this);
    tc.setCellEditor(cellE);
    Container thirdCnt = new Container();
    thirdCnt.setLayout(new FlowLayout());
    thirdCnt.add(scrollP, "North");
    // Add the container to the main container
    rootCnt.add(firstCnt, "North");
    rootCnt.add(secondCnt, "Center");
    rootCnt.add(thirdCnt, "South");
}
Also used : JScrollPane(javax.swing.JScrollPane) FlowLayout(java.awt.FlowLayout) JComboBox(javax.swing.JComboBox) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) ListSelectionModel(javax.swing.ListSelectionModel) TableColumnModel(javax.swing.table.TableColumnModel) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn) Container(java.awt.Container) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable)

Example 30 with JTable

use of javax.swing.JTable in project joda-time by JodaOrg.

the class DateTimeBrowser method resetDefaults.

/*
     * resetDefaults
     */
private void resetDefaults(TableView tView) {
    Object[] colNames = tView.getColNames();
    Object[][] tableValues = tView.getCalcdValues();
    // dumpObjs( tableValues, System.out);
    JTable table = new JTable(tableValues, colNames);
    tView.setViewColumnsWidth(table);
    setTitle(tView.getViewTitle());
    //
    if (mainSP != null)
        getContentPane().remove(mainSP);
    mainSP = new JScrollPane(table);
    getContentPane().add(mainSP, "Center");
    validate();
}
Also used : JScrollPane(javax.swing.JScrollPane) JTable(javax.swing.JTable)

Aggregations

JTable (javax.swing.JTable)223 JScrollPane (javax.swing.JScrollPane)127 JPanel (javax.swing.JPanel)100 JButton (javax.swing.JButton)68 JLabel (javax.swing.JLabel)68 Dimension (java.awt.Dimension)60 BorderLayout (java.awt.BorderLayout)58 BoxLayout (javax.swing.BoxLayout)48 ActionEvent (java.awt.event.ActionEvent)46 TableColumn (javax.swing.table.TableColumn)43 ActionListener (java.awt.event.ActionListener)38 TableColumnModel (javax.swing.table.TableColumnModel)33 FlowLayout (java.awt.FlowLayout)28 JTextField (javax.swing.JTextField)28 JComboBox (javax.swing.JComboBox)24 TableRowSorter (javax.swing.table.TableRowSorter)23 MouseEvent (java.awt.event.MouseEvent)21 ArrayList (java.util.ArrayList)16 Container (java.awt.Container)15 DefaultCellEditor (javax.swing.DefaultCellEditor)15