Refine search
public RowHeaderRenderer(ArrayList<String> headerList, JTable refTable, JTable tableShow, int rowSpan){ this.headerList = headerList; this.refTable = refTable; this.tableShow = tableShow; // 增加监听器,实现当在refTable中选择行时,RowHeader会发生颜色变化 ListSelectionModel listModel = refTable.getSelectionModel(); listModel.addListSelectionListener(this); rowHeightNow = refTable.getRowCount() * refTable.getRowHeight(); this.rowSpan = rowSpan; if (rowSpan > 1) { rowHeightNow = rowSpan * refTable.getRowHeight(); } }
/** * Creates a new <code>DetailPanel</code> instance. * * @param aTable the table to listen for selections on * @param aModel the model backing the table */ DetailPanel(JTable aTable, final MyTableModel aModel) { mModel = aModel; setLayout(new BorderLayout()); setBorder(BorderFactory.createTitledBorder("Details: ")); mDetails = new JEditorPane(); mDetails.setEditable(false); mDetails.setContentType("text/html"); add(new JScrollPane(mDetails), BorderLayout.CENTER); final ListSelectionModel rowSM = aTable.getSelectionModel(); rowSM.addListSelectionListener(this); }
private JComponent createXPathResultPanel() { xpathResults.addElement("No XPath results yet, run an XPath Query first."); xpathResultList.setBorder(BorderFactory.createLineBorder(Color.black)); xpathResultList.setFixedCellWidth(300); xpathResultList.setCellRenderer(new ASTListCellRenderer()); xpathResultList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); xpathResultList.getSelectionModel().addListSelectionListener(new ASTSelectionListener()); JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().setView(xpathResultList); return scrollPane; }
JScrollPane scroll = new JScrollPane(); add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 6), 0, 0)); emitterTableModel = new DefaultTableModel(new String[0][0], new String[] {"Emitter", ""}); emitterTable.setModel(emitterTableModel); emitterTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged (ListSelectionEvent event) { if (event.getValueIsAdjusting()) return;
public synchronized void syntheticBind() { boundTable = (JTable) ((PropertyBinding)sourceBinding).getBean(); boundTable.addPropertyChangeListener("selectionModel", this); boundTable.getSelectionModel().addListSelectionListener(this); }
stateVariablesTable.getSelectionModel().addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { stateVariablesScrollPane = new JScrollPane(stateVariablesTable);
JScrollPane scroll = new JScrollPane(); add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 6), 0, 0)); emitterTableModel = new DefaultTableModel(new String[0][0], new String[] {"Emitter", ""}); emitterTable.setModel(emitterTableModel); emitterTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged (ListSelectionEvent event) { if (event.getValueIsAdjusting()) return;
public InstallUninstallAction(Type type, JTable t) { super(type.getLabel()); this.type = type; setEnabled(false); table = t; t.getSelectionModel().addListSelectionListener(this); }
mainPanel.add(new JScrollPane(list), BorderLayout.CENTER); list.getSelectionModel().addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) {
private void initializeComponents () { setLayout(new GridBagLayout()); JScrollPane scroll = new JScrollPane(); add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 6), 0, 0)); emitterTableModel = new DefaultTableModel(new String[0][0], new String[] {"Emitter", ""}); emitterTable.setModel(emitterTableModel); emitterTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged (ListSelectionEvent event) { if (event.getValueIsAdjusting()) return;
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { displayPromptText();
public JListTutorial() { list.setModel(model); model.addElement(new Product("Oranges", new BigDecimal("2.00"), "These are fresh oranges")); model.addElement(new Product("Apples", new BigDecimal("1.50"), "These are fresh apples")); list.getSelectionModel().addListSelectionListener(e -> { Product p = list.getSelectedValue(); label.setText("Name: " + p.getName() + " ::: " + p.getPrice().toPlainString() + " ::: " + p.getDesc()); }); splitPane.setLeftComponent(new JScrollPane(list)); panel.add(label); splitPane.setRightComponent(panel); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.add(splitPane); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
private void initializeComponents () { setLayout(new GridBagLayout()); JScrollPane scroll = new JScrollPane(); add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 6), 0, 0)); emitterTableModel = new DefaultTableModel(new String[0][0], new String[] {"Emitter", ""}); emitterTable.setModel(emitterTableModel); emitterTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged (ListSelectionEvent event) { if (event.getValueIsAdjusting()) return;
public RowHeaderRenderer(ArrayList<String> headerList, JTable refTable, JTable tableShow, int rowSpan){ this.headerList = headerList; this.refTable = refTable; this.tableShow = tableShow; // 增加监听器,实现当在refTable中选择行时,RowHeader会发生颜色变化 ListSelectionModel listModel = refTable.getSelectionModel(); listModel.addListSelectionListener(this); rowHeightNow = refTable.getRowCount() * refTable.getRowHeight(); this.rowSpan = rowSpan; if (rowSpan > 1) { rowHeightNow = rowSpan * refTable.getRowHeight(); } }
private JComponent createXPathResultPanel() { xpathResults.addElement("No XPath results yet, run an XPath Query first."); xpathResultList.setBorder(BorderFactory.createLineBorder(Color.black)); xpathResultList.setFixedCellWidth(300); xpathResultList.setCellRenderer(new ASTListCellRenderer()); xpathResultList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); xpathResultList.getSelectionModel().addListSelectionListener(new ASTSelectionListener()); JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().setView(xpathResultList); return scrollPane; }
JScrollPane scroll = new JScrollPane(); velocitiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0)); velocityTableModel = new DefaultTableModel(new String[0][0], new String[] {"Velocity", "Active"}); velocityTable.setModel(velocityTableModel); velocityTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged (ListSelectionEvent event) { if (event.getValueIsAdjusting()) return;
private void initRowSelection() { table.getColumnModel().setColumnSelectionAllowed(false); table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } int selectedRow = table.getSelectedRow(); if (table.getSelectedRowCount() == 1) { updateImage(controller.getImage(selectedRow)); } else { updateImage(null); } } }); }
JScrollPane scroll = new JScrollPane(); velocitiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0)); velocityTableModel = new DefaultTableModel(new String[0][0], new String[] {"Velocity", "Active"}); velocityTable.setModel(velocityTableModel); velocityTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged (ListSelectionEvent event) { if (event.getValueIsAdjusting()) return;
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) {
columnModel.getColumn(1).setCellRenderer(rightCellRenderer); columnModel.getColumn(3).setCellRenderer(rightCellRenderer); JScrollPane tableScrollPane = new JScrollPane(table); tableScrollPane.setPreferredSize(new Dimension(700, 300)); splitPane.setTopComponent(tableScrollPane); bottomPanel.add(detailLabel, BorderLayout.NORTH); final JTextArea detailTextArea = new JTextArea(10, 80); JScrollPane detailScrollPane = new JScrollPane(detailTextArea); bottomPanel.add(detailScrollPane, BorderLayout.CENTER); table.getSelectionModel().addListSelectionListener( event -> { int selectedRow = table.getSelectedRow();