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);
}
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;
}
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;
}
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");
}
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();
}
Aggregations