/** Create the panel */ public LabelsPage(Preferences prefs) { super(); title_ = "Define position labels for state devices"; helpText_ = "State devices with discrete positions, such as filter changers or objective turrets, etc. can have mnemonic labels assigned for each position.\n\n" + "Select the device in the left-hand list and edit corresponding position labels in the right-hand list.\n\n" + "Use the 'Read' button to read label info from the hardware. This will override your changes!\n\n"; setHelpFileName("conf_labels_page.html"); prefs_ = prefs; setLayout(null); final JScrollPane labelsScrollPane = new JScrollPane(); labelsScrollPane.setBounds(186, 10, 269, 254); add(labelsScrollPane); labelTable_ = new JTable(); labelTable_.setModel(new LabelTableModel()); labelTable_.setAutoCreateColumnsFromModel(false); labelTable_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); InputMap im = labelTable_.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "none"); labelsScrollPane.setViewportView(labelTable_); GUIUtils.setClickCountToStartEditing(labelTable_, 1); GUIUtils.stopEditingOnLosingFocus(labelTable_); final JScrollPane devScrollPane = new JScrollPane(); devScrollPane.setBounds(10, 10, 162, 255); add(devScrollPane); devTable_ = new JTable(); DevTableModel m = new DevTableModel(); devTable_.setModel(m); devTable_.getSelectionModel().addListSelectionListener(new SelectionListener(devTable_)); devTable_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); devScrollPane.setViewportView(devTable_); final JButton readButton = new JButton(); readButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { // read labels from hardware readFromHardware(); } }); readButton.setText("Read"); readButton.setBounds(469, 10, 93, 23); add(readButton); final JButton resetButton = new JButton(); resetButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { // read labels from hardware resetLabels(); } }); resetButton.setText("Reset"); resetButton.setBounds(469, 43, 93, 23); add(resetButton); }
protected void createWidgets() { ReadOnlyTableModel<B> model = new ReadOnlyTableModel<>(getAssignments()); model.addColumn( "Profesor", "request", new ToStringConverter<Request>() { @Override public String convert(Request aRequest) { return aRequest.getProfessor().getName(); } }); model.addColumn( "Materia", "request", new ToStringConverter<Request>() { @Override public String convert(Request aRequest) { return aRequest.getSubject().getName(); } }); assignmentsTable = new JTable(model); assignmentsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); assignmentsTable .getSelectionModel() .addListSelectionListener( AssignmentsDetailWindow.this::whenAssignmentsTableSelectionChanged); periodDetail = new JTextArea(); periodDetail.setPreferredSize(new Dimension(480, 100)); periodDetail.setEditable(false); createOtherWidgets(); }
public CFSecuritySwingISOTimezoneFinderJPanel(ICFSecuritySwingSchema argSchema) { super(); final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } swingSchema = argSchema; dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane( dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader( new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); add(dataScrollPane); loadData(true); doLayout(); swingIsInitializing = false; }
// </editor-fold> private void fillTable(JTable resultTable) { String col[] = {"ID", "Clave", "Nombre", "Estatus"}; tableModel = new DefaultTableModel(col, 0) { @Override public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; // The 0 argument is number rows. resultList .stream() .forEach( (next) -> { tableModel.addRow( new Object[] { next.getProId(), next.getProCode(), next.getProName(), next.getProStatus() }); }); resultTable.setModel(tableModel); resultTable.getColumn("ID").setMinWidth(0); resultTable.getColumn("ID").setMaxWidth(0); resultTable.setColumnSelectionAllowed(false); resultTable.setCellSelectionEnabled(false); resultTable.setRowSelectionAllowed(true); resultTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); }
public ReceiveAddressDialog(JDialog parent) { super(parent, "Receive Addresses", Dialog.ModalityType.DOCUMENT_MODAL); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); tableModel = new AddressTableModel(columnNames, columnClasses); table = new AddressTable(tableModel, columnTypes); table.setRowSorter(new TableRowSorter<>(tableModel)); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane = new JScrollPane(table); JPanel tablePane = new JPanel(); tablePane.setBackground(Color.WHITE); tablePane.add(Box.createGlue()); tablePane.add(scrollPane); tablePane.add(Box.createGlue()); JPanel buttonPane = new ButtonPane( this, 10, new String[] {"New", "new"}, new String[] {"Copy", "copy"}, new String[] {"Edit", "edit"}, new String[] {"Done", "done"}); buttonPane.setBackground(Color.white); JPanel contentPane = new JPanel(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.setOpaque(true); contentPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); contentPane.setBackground(Color.WHITE); contentPane.add(tablePane); contentPane.add(buttonPane); setContentPane(contentPane); }
private void init_tbl_chats() { tbl_chats_ALM = new ArrayListModel(); tbl_chats_M = new TblchatsModel(tbl_chats_ALM); tbl_chats.setModel(tbl_chats_M); tbl_chats.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); int[] tbl_widths_chats = {58, 100, 0, 0, 0}; for (int i = 0, n = tbl_widths_chats.length; i < n; i++) { if (i == 1) { continue; } TableWidthUtilities.setColumnWidth(tbl_chats, i, tbl_widths_chats[i]); } Dimension d = tbl_chats.getTableHeader().getPreferredSize(); d.height = 0; tbl_chats.getTableHeader().setPreferredSize(d); tbl_chats.getTableHeader().setFont(new java.awt.Font("Arial", 0, 12)); tbl_chats.setRowHeight(65); tbl_chats.setFont(new java.awt.Font("Arial", 0, 12)); tbl_chats.getColumnModel().getColumn(0).setCellRenderer(new TableRender.set2()); tbl_chats.getColumnModel().getColumn(1).setCellRenderer(new TableRender.set3()); tbl_chats.getTableHeader().setResizingAllowed(true); tbl_chats.setShowGrid(false); tbl_chats.setShowHorizontalLines(true); tbl_chats.setShowVerticalLines(false); tbl_chats.getColumnModel().getColumn(1).setCellRenderer(new Html()); }
private JTable createTabla(DefaultTableModel tableModel) { JTable table = new JTable(); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setCellSelectionEnabled(false); table.setColumnSelectionAllowed(false); table.setModel(tableModel); table.setRowSelectionAllowed(true); table.getColumnModel().getColumn(0).setResizable(false); table.getColumnModel().getColumn(0).setPreferredWidth(75); table.getColumnModel().getColumn(0).setMinWidth(75); table.getColumnModel().getColumn(0).setMaxWidth(75); table.getColumnModel().getColumn(1).setResizable(false); table.getColumnModel().getColumn(1).setPreferredWidth(125); table.getColumnModel().getColumn(1).setMinWidth(125); table.getColumnModel().getColumn(1).setMaxWidth(125); table.getColumnModel().getColumn(2).setPreferredWidth(50); table.getColumnModel().getColumn(2).setMinWidth(50); table.getColumnModel().getColumn(2).setMaxWidth(50); table.getColumnModel().getColumn(3).setPreferredWidth(85); table.getColumnModel().getColumn(3).setMinWidth(85); table.getColumnModel().getColumn(3).setMaxWidth(85); table.setBounds(10, 420, 350, 125); return table; }
private void initTableVisualProperties(JTable table) { table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); table.setIntercellSpacing(new java.awt.Dimension(0, 0)); // set the color of the table's JViewport table.getParent().setBackground(table.getBackground()); // we'll get the parents width so we can use that to set the column sizes. double pw = table.getParent().getParent().getPreferredSize().getWidth(); // #88174 - Need horizontal scrollbar for library names // ugly but I didn't find a better way how to do it table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); TableColumn column = table.getColumnModel().getColumn(0); column.setMinWidth(226); column.setWidth(((int) pw / 2) - 1); column.setPreferredWidth(((int) pw / 2) - 1); column.setMinWidth(75); column = table.getColumnModel().getColumn(1); column.setMinWidth(226); column.setWidth(((int) pw / 2) - 1); column.setPreferredWidth(((int) pw / 2) - 1); column.setMinWidth(75); this.addComponentListener(new TableColumnSizeComponentAdapter(table)); }
public void initializePropertyTable() { scrollPane_ = new JScrollPane(); scrollPane_.setFont(new Font("Arial", Font.PLAIN, 10)); scrollPane_.setBorder(new BevelBorder(BevelBorder.LOWERED)); getContentPane().add(scrollPane_); springLayout_.putConstraint( SpringLayout.SOUTH, scrollPane_, -5, SpringLayout.SOUTH, getContentPane()); springLayout_.putConstraint( SpringLayout.NORTH, scrollPane_, scrollPaneTop_, SpringLayout.NORTH, getContentPane()); springLayout_.putConstraint( SpringLayout.EAST, scrollPane_, -5, SpringLayout.EAST, getContentPane()); springLayout_.putConstraint( SpringLayout.WEST, scrollPane_, 5, SpringLayout.WEST, getContentPane()); table_ = new JTable(); table_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); table_.setAutoCreateColumnsFromModel(false); scrollPane_.setViewportView(table_); table_.setModel(data_); if (numColumns_ == 3) { table_.addColumn(new TableColumn(0, 200, new PropertyNameCellRenderer(), null)); table_.addColumn( new TableColumn(1, 75, new PropertyUsageCellRenderer(), new PropertyUsageCellEditor())); table_.addColumn( new TableColumn( 2, 200, new PropertyValueCellRenderer(true), new PropertyValueCellEditor(true))); } else if (numColumns_ == 2) { table_.addColumn(new TableColumn(0, 200, new PropertyNameCellRenderer(), null)); table_.addColumn( new TableColumn( 1, 200, new PropertyValueCellRenderer(false), new PropertyValueCellEditor(false))); } }
BindToNewBeanStep(@NotNull final WizardData data) { myData = data; myTableModel = new MyTableModel(); myTable.setModel(myTableModel); myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myScrollPane.getViewport().setBackground(myTable.getBackground()); myTable.setSurrendersFocusOnKeystroke(true); // Customize "Form Property" column { final TableColumn column = myTable.getColumnModel().getColumn(0 /*Form Property*/); column.setCellRenderer(new FormPropertyTableCellRenderer(myData.myProject)); } // Customize "Bean Property" column { final TableColumn column = myTable.getColumnModel().getColumn(1 /*Bean Property*/); column.setCellRenderer(new BeanPropertyTableCellRenderer()); column.setCellEditor(new BeanPropertyTableCellEditor()); final DefaultCellEditor editor = (DefaultCellEditor) myTable.getDefaultEditor(Object.class); editor.setClickCountToStart(1); } myChkGetData.setSelected(true); myChkGetData.setEnabled(false); myChkSetData.setSelected(true); myChkSetData.setEnabled(false); myChkIsModified.setSelected(myData.myGenerateIsModified); }
private void initComponents() { JPanel listPane = new JPanel(); JScrollPane listScrollPane = new JScrollPane(); JPanel shortcutEditPane = new JPanel(); CbAction action = new CbAction(this); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(buildFilterPanel()); listPane.setLayout(new java.awt.GridLayout()); // This is the list of shortcuts: shortcutTable.setModel(model); shortcutTable.getSelectionModel().addListSelectionListener(new CbAction(this)); shortcutTable.setFillsViewportHeight(true); shortcutTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); shortcutTable.setAutoCreateRowSorter(true); TableColumnModel mod = shortcutTable.getColumnModel(); mod.getColumn(0).setCellRenderer(new ShortcutTableCellRenderer(true)); mod.getColumn(1).setCellRenderer(new ShortcutTableCellRenderer(false)); listScrollPane.setViewportView(shortcutTable); listPane.add(listScrollPane); add(listPane); // and here follows the edit area. I won't object to someone re-designing it, it looks, um, // "minimalistic" ;) shortcutEditPane.setLayout(new java.awt.GridLayout(5, 2)); cbDefault.setAction(action); cbDefault.setText(tr("Use default")); cbShift.setAction(action); cbShift.setText(SHIFT); // see above for why no tr() cbDisable.setAction(action); cbDisable.setText(tr("Disable")); cbCtrl.setAction(action); cbCtrl.setText(CTRL); // see above for why no tr() cbAlt.setAction(action); cbAlt.setText(ALT); // see above for why no tr() tfKey.setAction(action); tfKey.setModel(new DefaultComboBoxModel(keyList.values().toArray())); cbMeta.setAction(action); cbMeta.setText(META); // see above for why no tr() shortcutEditPane.add(cbDefault); shortcutEditPane.add(new JLabel()); shortcutEditPane.add(cbShift); shortcutEditPane.add(cbDisable); shortcutEditPane.add(cbCtrl); shortcutEditPane.add(new JLabel(tr("Key:"), SwingConstants.LEFT)); shortcutEditPane.add(cbAlt); shortcutEditPane.add(tfKey); shortcutEditPane.add(cbMeta); shortcutEditPane.add(new JLabel(tr("Attention: Use real keyboard keys only!"))); action.actionPerformed(null); // init checkboxes add(shortcutEditPane); }
private void initUI() { tblMain.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); refresh(); btAdd.addActionListener( e -> { PropertyForm.start(null); refresh(); }); btEdit.addActionListener(e -> editAction()); btRemove.addActionListener( e -> { Instance instance = ((InstanceTableModel) tblMain.getModel()).getItem(tblMain.getSelectedRow()); if (instance != null && !instance.isNew()) { int dialogButton = JOptionPane.YES_NO_OPTION; int dialogResult = JOptionPane.showConfirmDialog(null, "Remove row ?", "Confirm", dialogButton); if (dialogResult == 0) { ConfigHelper.getInstance().remove(instance); refresh(); } } }); btRun.addActionListener(e -> this.startLoad(this)); progressBar.setMinimum(0); progressBar.setStringPainted(true); tblMain.addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent me) { if (me.getClickCount() == 2) { editAction(); } } }); }
/** * This method initializes jTableTitular * * @return javax.swing.JTable */ private JTable getJTableTitular() { if (jTableTitular == null) { jTableTitular = new JTable(); tablepersonamodel = new TablePersonaModel(); TableSorted tblSorted = new TableSorted(tablepersonamodel); tblSorted.setTableHeader(jTableTitular.getTableHeader()); jTableTitular.setModel(tblSorted); jTableTitular.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableTitular.setCellSelectionEnabled(false); jTableTitular.setColumnSelectionAllowed(false); jTableTitular.setRowSelectionAllowed(true); jTableTitular.getTableHeader().setReorderingAllowed(false); ArrayList lst = new ArrayList(); lst.add(new Persona()); ((TablePersonaModel) ((TableSorted) jTableTitular.getModel()).getTableModel()).setData(lst); /* EdicionOperations oper = new EdicionOperations(); try { ArrayList lstVias = oper.obtenerViasCatastro(); ((TableViasCatastroModel)((TableSorted)jTableViasCatastro.getModel()).getTableModel()).setData(lstVias); } catch (DataException e1) { e1.printStackTrace(); } */ } return jTableTitular; }
public void update() { infoPanel.update(); Object[][] history = new Object[account.getHistory().size()][5]; int i = 0; for (Transaction t : account.getHistory()) { history[i][0] = t.getType(); BigDecimal amount; BigDecimal balance; if (account.getType().isLoan()) { amount = (t.getType().isPositive() ? t.getAmount().negate() : t.getAmount()); balance = t.getBalance().negate(); } else { amount = (t.getType().isPositive() ? t.getAmount() : t.getAmount().negate()); balance = t.getBalance(); } history[i][1] = FORMATTER.valueToString(amount); history[i][2] = FORMATTER.valueToString(balance); history[i][3] = t.getTimestamp(); history[i][4] = t.getFraudStatus(); i++; } historyTable.setModel( new javax.swing.table.DefaultTableModel( history, new String[] {"Type", "Amount", "Balance", "Month", "Flag"}) { @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } }); historyTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); historyTable.revalidate(); }
/** Erzeugt die Tabelle für die Anzeige der Medien. */ private void erzeugeMedienTable() { JScrollPane medienAuflisterScrollPane = new JScrollPane(); medienAuflisterScrollPane.setBorder( BorderFactory.createTitledBorder( null, "Medien", TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION, UIConstants.HEADER_FONT)); medienAuflisterScrollPane.setBackground(UIConstants.BACKGROUND_COLOR); medienAuflisterScrollPane.getVerticalScrollBar().setBackground(UIConstants.BACKGROUND_COLOR); medienAuflisterScrollPane.getHorizontalScrollBar().setBackground(UIConstants.BACKGROUND_COLOR); _ausleiheMedienTableModel = new MedienverwaltungMedienTableModel(); _medienTable = new JTable(); _medienTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); medienAuflisterScrollPane.setViewportView(_medienTable); _medienTable.setModel(_ausleiheMedienTableModel); JTableHeader tableHeader = _medienTable.getTableHeader(); tableHeader.setFont(UIConstants.HEADER_FONT); tableHeader.setReorderingAllowed(false); tableHeader.setResizingAllowed(false); _medienTable.setFont(UIConstants.TEXT_FONT); _hauptPanel.add(medienAuflisterScrollPane, BorderLayout.CENTER); }
@Override protected Component createContentPane() { innerTableCellEditor = new TagListTableCellEditor(); outerTableCellEditor = new TagListTableCellEditor(); parameterMappingTable = new JTable(new ParameterMappingTableModel()); parameterMappingTable.getColumnModel().getColumn(0).setCellEditor(innerTableCellEditor); parameterMappingTable.getColumnModel().getColumn(1).setCellEditor(outerTableCellEditor); parameterMappingTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); final RemoveParameterAction removeParameterAction = new RemoveParameterAction(); parameterMappingTable.getSelectionModel().addListSelectionListener(removeParameterAction); final JPanel parameterMappingButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5)); parameterMappingButtonPanel.add(new BorderlessButton(new AddParameterAction())); parameterMappingButtonPanel.add(new BorderlessButton(new RemoveParameterAction())); final JPanel parameterMappingPanel = new JPanel(new BorderLayout()); parameterMappingPanel.setBorder( BorderFactory.createTitledBorder(Messages.getString("ParameterEditorDialog.ParameterBox"))); parameterMappingPanel.add(new JScrollPane(parameterMappingTable), BorderLayout.CENTER); parameterMappingPanel.add(parameterMappingButtonPanel, BorderLayout.NORTH); final JPanel contentPane = new JPanel(); contentPane.setLayout(new GridLayout(1, 2, 5, 5)); contentPane.add(parameterMappingPanel); return contentPane; }
public ViewTelaEscolhaAtividade() { setTitle("Check In/ Check Out"); setBounds(100, 100, 735, 466); JPanel panel = new JPanel(); panel.setBackground(new Color(255, 255, 255)); getContentPane().add(panel, BorderLayout.CENTER); panel.setLayout(null); textField_PesquisarAtividade = new JTextField(); textField_PesquisarAtividade.setBounds(85, 28, 487, 19); panel.add(textField_PesquisarAtividade); textField_PesquisarAtividade.setColumns(10); btnPesquisar = new JButton("Pesquisar"); btnPesquisar.setBounds(584, 25, 117, 25); panel.add(btnPesquisar); table_AtividadeParticipante = new JTable(); table_AtividadeParticipante.setBackground(new Color(50, 205, 50)); table_AtividadeParticipante.setBounds(12, 59, 564, 351); table_AtividadeParticipante.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table_AtividadeParticipante = new JTable() { @Override public boolean isCellEditable(int row, int column) { return false; } }; btnCheckIn = new JButton("Check In"); btnCheckIn.setBounds(584, 62, 117, 25); panel.add(btnCheckIn); btnCheckIn.setEnabled(false); btnCheckOut = new JButton("Check Out"); btnCheckOut.setBounds(584, 99, 117, 25); panel.add(btnCheckOut); btnCheckOut.setEnabled(false); btnVoltar = new JButton("Voltar"); btnVoltar.setBounds(596, 385, 117, 25); panel.add(btnVoltar); lblAtividade = new JLabel("Atividade:"); lblAtividade.setBounds(12, 30, 87, 15); panel.add(lblAtividade); JScrollPane scrollPane = new JScrollPane(table_AtividadeParticipante); scrollPane.setBounds(12, 60, 560, 350); panel.add(scrollPane); this.setVisible(true); }
/** Creates a new TeamTransfersPane object. */ public TeamTransfersPane(PlayerDetailPanel playerDetailPanel) { this(); this.playerDetailPanel = playerDetailPanel; transferTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); transferTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); transferTable.getSelectionModel().addListSelectionListener(this); }
/** * Konstruktør, lager en tabell som er spesiallaget for å inneholde Sheep-objekter, og fyller * tabellen med Sheep-objekter * * @param sheepList liste med Sheep-objekter som tabellen skal inneholde */ public SheepTable(List<Sheep> sheepList) { super(new SheepTableModel(sheepList)); super.setAutoCreateRowSorter(true); super.setOpaque(false); this.getTableHeader().setBackground(darkGreen); super.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); setBackground(lightGreen); }
private void actualizarModelo() { modelConexiones = new ConexionesTableModel(); modelConexiones.setModelData(listaConexiones); sorter = new TableSorted(modelConexiones); sorter.setTableHeader(jTableConexiones.getTableHeader()); jTableConexiones.setModel(sorter); jTableConexiones.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); }
protected void addWidgets(DescriptorQueryList list, ActionMap actions, boolean captionsOnly) { setLayout(new BorderLayout()); setBorder(BorderFactory.createTitledBorder(caption)); setBackground(AmbitColors.BrightClr); setForeground(AmbitColors.DarkClr); tableModel = new DescriptorQueryTableModel(list, captionsOnly); JTable table = new JTable(tableModel, createTableColumnModel(tableModel, captionsOnly)); table.setSurrendersFocusOnKeystroke(true); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setRowSelectionAllowed(false); table.getTableHeader().setReorderingAllowed(false); table.setRowHeight(24); TableColumn col; int[] pSize = {32, 240, 32, 32, 64, 32, 32, 32}; int[] mSize = {24, 120, 32, 32, 64, 32, 32, 32}; for (int i = 0; i < table.getColumnCount(); i++) { col = table.getColumnModel().getColumn(i); col.setPreferredWidth(pSize[i]); col.setMinWidth(mSize[i]); } // table.setShowGrid(false); table.setShowHorizontalLines(true); table.setShowVerticalLines(false); scrollPane = new JScrollPane(table); scrollPane.setPreferredSize(new Dimension(420, 360)); scrollPane.setMinimumSize(new Dimension(370, 120)); scrollPane.setAutoscrolls(true); // tPane.addTab("Search descriptors",scrollPane); add(scrollPane, BorderLayout.CENTER); /* JToolBar t = new JToolBar(); //t.setBackground(Color.white); t.setFloatable(false); //t.setBorder(BorderFactory.createTitledBorder("Search by descriptors and distance between atoms")); Object[] keys = actions.allKeys(); if (keys != null) { for (int i=0; i < keys.length;i++) t.add(actions.get(keys[i])); add(t,BorderLayout.SOUTH); } */ if (actions != null) { Object[] keys = actions.allKeys(); if (keys != null) { for (int i = 0; i < keys.length; i++) { add( new DescriptorSearchActionPanel(list, actions.get(keys[i]), keys[i].toString()), BorderLayout.SOUTH); break; } } } }
/** Creates and displays the main GUI This GUI has the list and the main * buttons */ public void showGUI() { final JScrollPane scrollPane = new JScrollPane(); table = new JTable( new DefaultTableModel( new Object[][] {}, new String[] {"Username", "Password", "Pin", "Reward"})); AccountManager.loadAccounts(); if (AccountManager.hasAccounts()) { for (Account account : AccountManager.getAccounts()) { ((DefaultTableModel) table.getModel()) .addRow( new Object[] { account.getUsername(), account.getReward(), account.getPin(), account.getReward() }); } } final JToolBar bar = new JToolBar(); bar.setMargin(new Insets(1, 1, 1, 1)); bar.setFloatable(false); removeButton = new JButton("Remove"); final JButton newButton = new JButton("Add"); final JButton doneButton = new JButton("Save"); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getSelectionModel().addListSelectionListener(new TableSelectionListener()); table.setShowGrid(true); final TableColumnModel cm = table.getColumnModel(); cm.getColumn(cm.getColumnIndex("Password")).setCellRenderer(new PasswordCellRenderer()); cm.getColumn(cm.getColumnIndex("Password")).setCellEditor(new PasswordCellEditor()); cm.getColumn(cm.getColumnIndex("Pin")).setCellRenderer(new PasswordCellRenderer()); cm.getColumn(cm.getColumnIndex("Pin")).setCellEditor(new PasswordCellEditor()); cm.getColumn(cm.getColumnIndex("Reward")).setCellEditor(new RandomRewardEditor()); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setViewportView(table); add(scrollPane, BorderLayout.CENTER); newButton.setFocusable(false); newButton.setToolTipText(newButton.getText()); newButton.setText("+"); bar.add(newButton); removeButton.setFocusable(false); removeButton.setToolTipText(removeButton.getText()); removeButton.setText("-"); bar.add(removeButton); bar.add(Box.createHorizontalGlue()); doneButton.setToolTipText(doneButton.getText()); bar.add(doneButton); newButton.addActionListener(this); removeButton.addActionListener(this); doneButton.addActionListener(this); add(bar, BorderLayout.SOUTH); final int row = table.getSelectedRow(); removeButton.setEnabled(row >= 0 && row < table.getRowCount()); table.clearSelection(); doneButton.requestFocus(); setPreferredSize(new Dimension(600, 300)); pack(); setLocationRelativeTo(getOwner()); setResizable(false); }
/** * Initiert die linke Tablelle * * @return wordlengthTable */ public JTable setLeftTable() { linkeTabelle = new WordAnalysisTabTableModel(); wordLengthTable = new JTable(linkeTabelle); wordLengthTable.addMouseListener(listener); wordLengthTable.setSelectionMode(0); wordLengthTable.setFocusable(false); linkeTabelle.addColumn("Wörterbücher"); linkeTabelle.addColumn("Worte im Roman"); return wordLengthTable; }
private void addMorphismTable() { morphismTable = new JTable(data, columnNames); morphismTable.setGridColor(Color.BLACK); morphismTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); morphismTable.setCellSelectionEnabled(true); morphismTable.setFillsViewportHeight(true); morphismPane = new JScrollPane(morphismTable); morphismPane.setBounds(369, 49, 306, 116); frame.getContentPane().add(morphismPane); }
/** * Add all the components for display the list of plots and which are showing the current spectra. */ protected void initUI() { setBorder(BorderFactory.createTitledBorder("Views of current spectra:")); setLayout(new BorderLayout()); setToolTipText("Select to add the current spectra to a plot, " + "deselect to remove them."); // Set up the table to use a model based on the global lists // of plots and spectra and to track the current spectrum // when selected in list. table.setModel(tableModel); // Hack the size of this so that it doesn't get too big for // the values we know it's going to display, cell width // control in JTable sucks (or I don't understand it!). table.setPreferredScrollableViewportSize(new Dimension(250, 0)); // Set the headers! TableColumnModel columns = table.getColumnModel(); TableColumn column; column = columns.getColumn(table.convertColumnIndexToView(0)); column.setHeaderValue("View"); column = columns.getColumn(table.convertColumnIndexToView(1)); column.setHeaderValue("Displayed"); // The table can have many rows selected. table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); // Double click on a row raises the associated plot. table.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2) { raiseCurrentPlot(); } } }); // Use a FuzzyBooleanCellRenderer for FuzzyBoolean objects in // this table. This is tristate for dealing with partial // spectra/plot relations. table.setDefaultRenderer(FuzzyBoolean.class, new FuzzyBooleanCellRenderer()); table.setDefaultEditor(FuzzyBoolean.class, new FuzzyBooleanCellEditor()); // Add components. scroller.getViewport().add(table, null); add(scroller, BorderLayout.CENTER); // Set up the listSelectionListener so that we can update // when the selected spectra change. list.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { update(e); } }); }
private void createClassroomsTable() { ReadOnlyTableModel<Classroom> tableModel = new ReadOnlyTableModel<>(department.getClassroomsDepartment().searchClassroomByName("")); addClassroomsColumns(tableModel); classroomsTable = new JTable(tableModel); classroomsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); classroomsTable .getSelectionModel() .addListSelectionListener(EditAssignmentWindow.this::whenClassroomsTableSelectionChanged); classroomsTableScrollPane = new JScrollPane(classroomsTable); }
public CFInternetSwingVersionListJPanel( ICFInternetSwingSchema argSchema, ICFLibAnyObj argContainer, ICFInternetVersionObj argFocus, Collection<ICFInternetVersionObj> argDataCollection, ICFJRefreshCallback refreshCallback, boolean sortByChain) { super(); final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; swingRefreshCallback = refreshCallback; swingSortByChain = sortByChain; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane( dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader( new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); // Do initial layout setSize(1024, 480); JMenuBar menuBar = getPanelMenuBar(); add(menuBar); menuBar.setBounds(0, 0, 1024, 25); add(dataScrollPane); dataScrollPane.setBounds(0, 25, 1024, 455); adjustListMenuBar(); doLayout(); swingIsInitializing = false; }
/** * This method initializes compareTable * * @return javax.swing.JTable */ private JTable getCompareTable() { if (compareTable == null) { compareTable = new JTable(); compareTable.setBackground(java.awt.Color.white); compareTable.setFont(new Font("DialogInput", Font.PLAIN, 12)); compareTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); compareTable.setModel(getDefaultTableModel(false)); setTableProps(); } return compareTable; }
protected JTable buildCurrentMemberListTable() { JTable table = new JTable( model.getRelationMemberTableModel(PointInTimeType.CURRENT_POINT_IN_TIME), new RelationMemberTableColumnModel()); table.setName("table.currentmemberlisttable"); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); selectionSynchronizer.participateInSynchronizedSelection(table.getSelectionModel()); table.getModel().addTableModelListener(new MemberModelChanged(table)); return table; }
public ClienteVista() { setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); setIconImage( Toolkit.getDefaultToolkit() .getImage(ClienteVista.class.getResource("/Iconos/pizza_1.PNG"))); setTitle(" Cliente"); setResizable(false); setBounds(100, 100, 495, 430); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); this.setLocationRelativeTo(null); JLabel lblClientes = new JLabel("Clientes:"); lblClientes.setFont(new Font("Tahoma", Font.BOLD, 11)); lblClientes.setBounds(10, 11, 96, 25); contentPane.add(lblClientes); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 38, 318, 349); contentPane.add(scrollPane); this.modelTable = new WDefaultTableModel(null, this.nombreColumna); table = new WTable(this.modelTable); scrollPane.setViewportView(table); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); btnCrear = new JButton(" Crear"); btnCrear.setIcon(new ImageIcon(ClienteVista.class.getResource("/Iconos/Agregar.png"))); btnCrear.setFont(new Font("Tahoma", Font.BOLD, 11)); btnCrear.setBounds(338, 36, 140, 40); contentPane.add(btnCrear); btnModificar = new JButton(" Modificar"); btnModificar.setIcon(new ImageIcon(ClienteVista.class.getResource("/Iconos/modificar.png"))); btnModificar.setFont(new Font("Tahoma", Font.BOLD, 11)); btnModificar.setBounds(338, 87, 140, 40); contentPane.add(btnModificar); btnVolver = new JButton(" Volver"); btnVolver.setIcon(new ImageIcon(ClienteVista.class.getResource("/Iconos/Volver.png"))); btnVolver.setFont(new Font("Tahoma", Font.BOLD, 11)); btnVolver.setBounds(338, 347, 140, 40); contentPane.add(btnVolver); lblNewLabel = new JLabel(""); lblNewLabel.setIcon( new ImageIcon(ClienteVista.class.getResource("/Iconos/Logo Pizzeria Wild 96x96.png"))); lblNewLabel.setBounds(366, 171, 96, 105); contentPane.add(lblNewLabel); }