use of javax.swing.table.DefaultTableModel in project gephi by gephi.
the class PaletteGeneratorPanel method generate.
private void generate() {
int colorCount = Integer.parseInt(colorCountLabel.getText());
int paletteCount = colorCount;
if (limitColorsCheckbox.isSelected()) {
paletteCount = ((Number) limitColorSpinner.getValue()).intValue();
}
selectedPalette = PaletteManager.getInstance().generatePalette(paletteCount, selectedPreset);
if (paletteCount < colorCount) {
Color[] cols = Arrays.copyOf(selectedPalette.getColors(), colorCount);
for (int i = paletteCount; i < cols.length; i++) {
cols[i] = Color.LIGHT_GRAY;
}
selectedPalette = new Palette(cols);
}
String[] columnNames = new String[] { "Color" };
DefaultTableModel model = new DefaultTableModel(columnNames, colorCount) {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
colorTable.setModel(model);
TableColumn colorCol = colorTable.getColumnModel().getColumn(0);
colorCol.setCellRenderer(new ColorCellRenderer());
int row = 0;
for (Color c : selectedPalette.getColors()) {
model.setValueAt(c, row++, 0);
}
}
use of javax.swing.table.DefaultTableModel in project nhin-d by DirectProject.
the class PKCS11SecretKeyManager method initUI.
private void initUI() {
this.getContentPane().setLayout(new BorderLayout(5, 5));
// Top Panel
JPanel topPanel = new JPanel();
topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
addAESKeyButton = new JButton("Add AES Key");
addAESKeyButton.setSize(new Dimension(30, 100));
addGenericKeyButton = new JButton("Add Text Key");
addGenericKeyButton.setSize(new Dimension(30, 100));
removeKeyButton = new JButton("Remove Key(s)");
removeKeyButton.setSize(new Dimension(30, 100));
topPanel.add(addAESKeyButton);
topPanel.add(addGenericKeyButton);
topPanel.add(removeKeyButton);
this.getContentPane().add(topPanel, BorderLayout.NORTH);
// Middle and list panel
JPanel midPanel = new JPanel();
midPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
midPanel.setLayout(new BorderLayout(5, 5));
JLabel keyListLabel = new JLabel("Secret Keys:");
Object[][] data = {};
String[] columnNames = { "Key Alias", "Key Type", "Key Value" };
keyDataModel = new DefaultTableModel(data, columnNames);
keyDataTable = new JTable(keyDataModel);
JScrollPane scrollPane = new JScrollPane(keyDataTable);
keyDataTable.setFillsViewportHeight(true);
midPanel.add(keyListLabel, BorderLayout.NORTH);
midPanel.add(scrollPane, BorderLayout.CENTER);
this.getContentPane().add(midPanel, BorderLayout.CENTER);
// Bottom Panel
JPanel bottomPanel = new JPanel();
bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
quitButton = new JButton("Quit");
quitButton.setSize(new Dimension(30, 100));
bottomPanel.add(quitButton);
this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
}
use of javax.swing.table.DefaultTableModel in project nhin-d by DirectProject.
the class PKCS11SecretKeyManagerUI method initUI.
private void initUI() {
this.getContentPane().setLayout(new BorderLayout(5, 5));
// Top Panel
JPanel topPanel = new JPanel();
topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
addAESKeyButton = new JButton("Add AES Key");
addAESKeyButton.setSize(new Dimension(30, 100));
addGenericKeyButton = new JButton("Add Text Key");
addGenericKeyButton.setSize(new Dimension(30, 100));
removeKeyButton = new JButton("Remove Key(s)");
removeKeyButton.setSize(new Dimension(30, 100));
topPanel.add(addAESKeyButton);
topPanel.add(addGenericKeyButton);
topPanel.add(removeKeyButton);
this.getContentPane().add(topPanel, BorderLayout.NORTH);
// Middle and list panel
JPanel midPanel = new JPanel();
midPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
midPanel.setLayout(new BorderLayout(5, 5));
JLabel keyListLabel = new JLabel("Secret Keys:");
Object[][] data = {};
String[] columnNames = { "Key Alias", "Key Type", "Key Value" };
keyDataModel = new DefaultTableModel(data, columnNames);
keyDataTable = new JTable(keyDataModel);
JScrollPane scrollPane = new JScrollPane(keyDataTable);
keyDataTable.setFillsViewportHeight(true);
midPanel.add(keyListLabel, BorderLayout.NORTH);
midPanel.add(scrollPane, BorderLayout.CENTER);
this.getContentPane().add(midPanel, BorderLayout.CENTER);
// Bottom Panel
JPanel bottomPanel = new JPanel();
bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
quitButton = new JButton("Quit");
quitButton.setSize(new Dimension(30, 100));
bottomPanel.add(quitButton);
this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
}
use of javax.swing.table.DefaultTableModel in project azure-tools-for-java by Microsoft.
the class SubscriptionsDialog method setSubscriptions.
private void setSubscriptions() {
DefaultTableModel model = (DefaultTableModel) table.getModel();
for (SubscriptionDetail sd : sdl) {
model.addRow(new Object[] { sd.isSelected(), sd.getSubscriptionName(), sd.getSubscriptionId() });
}
model.fireTableDataChanged();
}
use of javax.swing.table.DefaultTableModel in project azure-tools-for-java by Microsoft.
the class WarSelectDialog method doOKAction.
@Override
protected void doOKAction() {
DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
int i = table.getSelectedRow();
if (i < 0) {
JOptionPane.showMessageDialog(contentPane, "Please select an artifact", "Select Artifact Status", JOptionPane.INFORMATION_MESSAGE);
return;
}
selectedArtifact = artifactList.get(i);
super.doOKAction();
}
Aggregations