Java Code Examples for javax.swing.JScrollPane#setRowHeaderView()
The following examples show how to use
javax.swing.JScrollPane#setRowHeaderView() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LineNumbersRuler.java From jpexs-decompiler with GNU General Public License v3.0 | 6 votes |
@Override public void install(final JEditorPane editor) { this.editor = editor; setFont(editor.getFont()); // setMinimumDisplayDigits(3); editor.getDocument().addDocumentListener(this); editor.addCaretListener(this); editor.addPropertyChangeListener(this); JScrollPane sp = getScrollPane(editor); sp.setRowHeaderView(this); mouseListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { GotoLineDialog.showForEditor(editor); } }; addMouseListener(mouseListener); status = Status.INSTALLING; }
Example 2
Source File: TableUtils.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
private static JScrollPane createToggleButtonSelectionPane(JTable table, JTable rowheaderTable, JToggleButton button) { rowheaderTable.setAutoCreateColumnsFromModel(false); // force the tables to share models rowheaderTable.setModel(table.getModel()); rowheaderTable.setSelectionModel(table.getSelectionModel()); rowheaderTable.setRowHeight(table.getRowHeight()); rowheaderTable.setIntercellSpacing(table.getIntercellSpacing()); rowheaderTable.setShowGrid(false); rowheaderTable.setFocusable(false); TableColumn column = new TableColumn(-1); column.setHeaderValue(new Object()); column.setCellRenderer(new TableCellUtilities.ToggleButtonRenderer(button)); rowheaderTable.addColumn(column); rowheaderTable.setPreferredScrollableViewportSize(new Dimension(20, 0)); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(table); scrollPane.setRowHeaderView(rowheaderTable); return scrollPane; }
Example 3
Source File: LineNumber.java From bigtable-sql with Apache License 2.0 | 6 votes |
public static void main(String[] args) { JFrame frame = new JFrame("LineNumberDemo"); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); JPanel panel = new JPanel(); frame.setContentPane( panel ); panel.setBorder(BorderFactory.createEmptyBorder(20,20,20,20)); panel.setLayout(new BorderLayout()); JTextPane textPane = new JTextPane(); textPane.setFont( new Font("monospaced", Font.PLAIN, 12) ); textPane.setText("abc"); JScrollPane scrollPane = new JScrollPane(textPane); panel.add(scrollPane); scrollPane.setPreferredSize(new Dimension(300, 250)); LineNumber lineNumber = new LineNumber( textPane ); scrollPane.setRowHeaderView( lineNumber ); frame.pack(); frame.setVisible(true); }
Example 4
Source File: TableUtils.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
private static JScrollPane createToggleButtonSelectionPane(JTable table, JTable rowheaderTable, JToggleButton button) { rowheaderTable.setAutoCreateColumnsFromModel(false); // force the tables to share models rowheaderTable.setModel(table.getModel()); rowheaderTable.setSelectionModel(table.getSelectionModel()); rowheaderTable.setRowHeight(table.getRowHeight()); rowheaderTable.setIntercellSpacing(table.getIntercellSpacing()); rowheaderTable.setShowGrid(false); rowheaderTable.setFocusable(false); TableColumn column = new TableColumn(-1); column.setHeaderValue(new Object()); column.setCellRenderer(new TableCellUtilities.ToggleButtonRenderer(button)); rowheaderTable.addColumn(column); rowheaderTable.setPreferredScrollableViewportSize(new Dimension(20, 0)); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(table); scrollPane.setRowHeaderView(rowheaderTable); return scrollPane; }
Example 5
Source File: EditorUI.java From netbeans with Apache License 2.0 | 6 votes |
protected JComponent createExtComponent() { setLineNumberEnabled(true); // enable line numbering // extComponent will be a panel JComponent ec = new JPanel(new BorderLayout()); ec.putClientProperty(JTextComponent.class, component); // Add the scroll-pane with the component to the center JScrollPane scroller = new JScrollPane(component); scroller.getViewport().setMinimumSize(new Dimension(4,4)); // remove default scroll-pane border, winsys will handle borders itself scroller.setBorder(null); setGlyphGutter(new GlyphGutter(this)); scroller.setRowHeaderView(glyphGutter); initGlyphCorner(scroller); ec.add(scroller); // Install the status-bar panel to the bottom ec.add(getStatusBar().getPanel(), BorderLayout.SOUTH); return ec; }
Example 6
Source File: TreesPanel.java From beast-mcmc with GNU Lesser General Public License v2.1 | 5 votes |
public TreesPanel(MainFrame frame, PartitionDataList dataList) { this.frame = frame; this.dataList = dataList; treesTable = new JTable(); treesTable.getTableHeader().setReorderingAllowed(false); treesTable.addMouseListener(new JTableButtonMouseListener(treesTable)); treesTableModel = new TreesTableModel(this.dataList, this.frame); treesTable.setModel(treesTableModel); setLayout(new BorderLayout()); scrollPane = new JScrollPane(treesTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); RowNumberTable rowNumberTable = new RowNumberTable(treesTable); scrollPane.setRowHeaderView(rowNumberTable); scrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, rowNumberTable.getTableHeader()); scrollPane.getViewport().setOpaque(false); add(scrollPane, BorderLayout.CENTER); setTreesColumn(this.dataList); setTaxaSetColumn(this.dataList); column = treesTable.getColumnModel().getColumn( TreesTableModel.TAXA_COUNT_INDEX); column.setCellRenderer(new TableRenderer(SwingConstants.LEFT, new Insets(0, 2, 0, 2))); ActionPanel actionPanel = new ActionPanel(false); actionPanel.setAddAction(addTreeAction); actionPanel.setRemoveAction(removeTreeAction); add(actionPanel, BorderLayout.SOUTH); setTrees(); }
Example 7
Source File: TableUtil.java From nextreports-designer with Apache License 2.0 | 5 votes |
/** * Creats a row header for the given table. The row number is displayed to * the left of the table ( starting with row 1). * * @param table the table to create the row header for * @param headerWidth the number of characters to size the header */ public static TableRowHeader setRowHeader(JTable table, int headerWidth) { TableRowHeader result = null; Container p = table.getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; result = new TableRowHeader(table); scrollPane.setRowHeaderView(result); } } return result; }
Example 8
Source File: LineNumbersRuler.java From jpexs-decompiler with GNU General Public License v3.0 | 5 votes |
@Override public void deinstall(JEditorPane editor) { removeMouseListener(mouseListener); status = Status.DEINSTALLING; editor.getDocument().removeDocumentListener(this); editor.removeCaretListener(this); editor.removePropertyChangeListener(this); JScrollPane sp = getScrollPane(editor); if (sp != null) { sp.setRowHeaderView(null); } }
Example 9
Source File: DependenciesEditorTopComponent.java From BART with MIT License | 5 votes |
private void init() { scrPane = new JScrollPane(); editorButton = new EditorButtonPanel(); editorButton.getSaveRButton() .setAction( Actions.forID("DependenciesNode", "it.unibas.bartgui.controlegt.actions.node.DependenciesNode.ReloadDependencies")); /*editorButton.getResetButton() .setAction( Actions.forID("DependenciesNode", "it.unibas.bartgui.controlegt.actions.node.DependenciesNode.Reset"));*/ textPane = new JTextPane(new DependenciesStyleContext()); //textPane.getDocument().addUndoableEditListener(UndoRedomanager); textPane.getDocument().addDocumentListener(new DocListener()); JScrollPane scrPaneText = new JScrollPane(); scrPaneText.setViewportView(textPane); textLineNumber = new TextLineNumber(textPane); scrPaneText.setRowHeaderView(textLineNumber); //JPanel panel = new JPanel(new BorderLayout()); //panel.add(editorButton,BorderLayout.NORTH); //panel.add(scrPaneText,BorderLayout.CENTER); //scrPane.setViewportView(panel); add(editorButton,BorderLayout.NORTH); add(scrPaneText,BorderLayout.CENTER); }
Example 10
Source File: DiskLayoutPanel.java From DiskBrowser with GNU General Public License v3.0 | 5 votes |
public DiskLayoutPanel () // ---------------------------------------------------------------------------------// { super (new BorderLayout ()); diskLayoutImage = new DiskLayoutImage (); verticalRuler = new ScrollRuler (diskLayoutImage, ScrollRuler.VERTICAL); horizontalRuler = new ScrollRuler (diskLayoutImage, ScrollRuler.HORIZONTAL); legendPanel = new DiskLegendPanel (); setBackground (Color.WHITE); sp = new JScrollPane (diskLayoutImage, VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_ALWAYS); sp.getViewport ().setBackground (Color.WHITE); sp.setColumnHeaderView (horizontalRuler); sp.setRowHeaderView (verticalRuler); sp.setBorder (null); sp.setCorner (JScrollPane.UPPER_LEFT_CORNER, new Corner (true)); sp.setCorner (JScrollPane.LOWER_LEFT_CORNER, new Corner (false)); sp.setCorner (JScrollPane.UPPER_RIGHT_CORNER, new Corner (false)); sp.setCorner (JScrollPane.LOWER_RIGHT_CORNER, new Corner (false)); // this is just so the pack is correct add (sp, BorderLayout.CENTER); add (legendPanel, BorderLayout.SOUTH); }
Example 11
Source File: StepByStepAnalyzeResultPanelProvider.java From lucene-solr with Apache License 2.0 | 5 votes |
private JScrollPane initResultScroll(JTable table, JTable header) { JScrollPane scroll = new JScrollPane(table); scroll.setRowHeaderView(header); scroll.setCorner(JScrollPane.UPPER_LEFT_CORNER, header.getTableHeader()); Dimension tsz = new Dimension(200, header.getPreferredSize().height); scroll.getRowHeader().setPreferredSize(tsz); return scroll; }
Example 12
Source File: CodeEditPane.java From ApkToolPlus with Apache License 2.0 | 5 votes |
private void addEditPane(String methodIndex, byte[] code, ClassFile classFile) { CodeEditArea editArea = new CodeEditArea(methodIndex, code, classFile, internalFrame); JScrollPane scroll = new JScrollPane(editArea); scroll.setRowHeaderView(new LineNumberView(editArea)); scroll.getVerticalScrollBar().setValue(10); // p.add(scroll); this.add(scroll, methodIndex); editPanes.put(methodIndex, editArea); }
Example 13
Source File: ScoreTable.java From rcrs-server with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public JComponent getGUIComponent() { JTable table = new JTable(model.table); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); JScrollPane scroll = new JScrollPane(table); JList rowHeader = new JList(model.list); rowHeader.setFixedCellHeight(table.getRowHeight()); rowHeader.setCellRenderer(new RowHeaderRenderer(table)); rowHeader.setBackground(table.getBackground()); rowHeader.setOpaque(true); scroll.setRowHeaderView(rowHeader); return scroll; }
Example 14
Source File: TaxaEditor.java From beast-mcmc with GNU Lesser General Public License v2.1 | 4 votes |
public TaxaEditor(MainFrame frame, PartitionDataList dataList, int row) { this.frame = frame; this.dataList = dataList; this.row = row; // taxonList = new Taxa(); taxaEditorTableModel = new TaxaEditorTableModel(); // Setup Main Menu buttons load = new JButton("Load", Utils.createImageIcon(Utils.TEXT_FILE_ICON)); save = new JButton("Save", Utils.createImageIcon(Utils.SAVE_ICON)); done = new JButton("Done", Utils.createImageIcon(Utils.CHECK_ICON)); cancel = new JButton("Cancel", Utils.createImageIcon(Utils.CLOSE_ICON)); // Add Main Menu buttons listeners load.addActionListener(new ListenLoadTaxaFile()); save.addActionListener(new ListenSaveTaxaFile()); done.addActionListener(new ListenOk()); cancel.addActionListener(new ListenCancel()); // Setup menu menu = new JMenuBar(); menu.setLayout(new BorderLayout()); JPanel buttonsHolder = new JPanel(); buttonsHolder.setOpaque(false); buttonsHolder.add(load); buttonsHolder.add(save); buttonsHolder.add(done); buttonsHolder.add(cancel); menu.add(buttonsHolder, BorderLayout.WEST); // Setup table table = new JTable(); table.setModel(taxaEditorTableModel); table.setSurrendersFocusOnKeystroke(true); JScrollPane scrollPane = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); RowNumberTable rowNumberTable = new RowNumberTable(table); scrollPane.setRowHeaderView(rowNumberTable); scrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, rowNumberTable.getTableHeader()); ActionPanel actionPanel = new ActionPanel(false); actionPanel.setAddAction(addTaxonAction); actionPanel.setRemoveAction(removeTaxonAction); // Setup window owner = Utils.getActiveFrame(); window = new JDialog(owner, "Edit taxa set..."); window.getContentPane().add(menu, BorderLayout.NORTH); window.getContentPane().add(scrollPane); window.getContentPane().add(actionPanel, BorderLayout.SOUTH); window.pack(); window.setLocationRelativeTo(owner); setTaxa(); }
Example 15
Source File: TaxaPanel.java From beast-mcmc with GNU Lesser General Public License v2.1 | 4 votes |
public TaxaPanel(PartitionDataList dataList) { this.dataList = dataList; taxaTable = new JTable(); taxaTableModel = new TaxaTableModel(this.dataList); taxaTable.setModel(taxaTableModel); setLayout(new BorderLayout()); taxaTable.getTableHeader().setReorderingAllowed(false); taxaTable.getTableHeader() .setDefaultRenderer( new HeaderRenderer(SwingConstants.LEFT, new Insets(0, 2, 0, 2))); column = taxaTable.getColumnModel() .getColumn(TaxaTableModel.NAME_INDEX); column.setCellRenderer(new TableRenderer(SwingConstants.LEFT, new Insets(0, 2, 0, 2))); column.setPreferredWidth(80); column = taxaTable.getColumnModel().getColumn( TaxaTableModel.HEIGHT_INDEX); column.setCellRenderer(new TableRenderer(SwingConstants.LEFT, new Insets(0, 2, 0, 2))); column.setPreferredWidth(80); column = taxaTable.getColumnModel().getColumn( TaxaTableModel.TAXA_SET_INDEX); column.setCellRenderer(new TableRenderer(SwingConstants.LEFT, new Insets(0, 2, 0, 2))); column.setPreferredWidth(80); TableEditorStopper.ensureEditingStopWhenTableLosesFocus(taxaTable); scrollPane = new JScrollPane(taxaTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); RowNumberTable rowNumberTable = new RowNumberTable(taxaTable); scrollPane.setRowHeaderView(rowNumberTable); scrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, rowNumberTable.getTableHeader()); scrollPane.getViewport().setOpaque(false); setOpaque(false); setBorder(new BorderUIResource.EmptyBorderUIResource( new java.awt.Insets(12, 12, 12, 12))); setLayout(new BorderLayout(0, 0)); add(scrollPane, BorderLayout.CENTER); }
Example 16
Source File: GanttChart.java From swift-k with Apache License 2.0 | 4 votes |
public GanttChart(SystemState state) { this.state = state; scale = INITIAL_SCALE; jobs = new ArrayList<Job>(); jobmap = new HashMap<String, Job>(); header = new JTable() { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); return new Dimension(50, d.height); } }; header.setModel(hmodel = new HeaderModel()); header.setShowHorizontalLines(true); header.setPreferredScrollableViewportSize(new Dimension(100, 10)); header.setDefaultRenderer(Job.class, new JobNameRenderer()); table = new JTable(); table.setDoubleBuffered(true); table.setModel(cmodel = new ChartModel()); table.setShowHorizontalLines(true); table.setDefaultRenderer(Job.class, new JobRenderer()); JPanel jp = new JPanel(); jp.setLayout(new BorderLayout()); jp.add(table, BorderLayout.CENTER); csp = new JScrollPane(jp); csp.setColumnHeaderView(new Tickmarks()); csp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); csp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); csp.setRowHeaderView(header); csp.getVerticalScrollBar().getModel().addChangeListener(this); hsb = new JScrollBar(JScrollBar.HORIZONTAL); hsb.setVisible(true); hsb.getModel().addChangeListener(this); setLayout(new BorderLayout()); add(csp, BorderLayout.CENTER); add(createTools(), BorderLayout.NORTH); add(hsb, BorderLayout.SOUTH); state.schedule(new TimerTask() { @Override public void run() { GanttChart.this.actionPerformed(null); } }, 1000, 1000); }
Example 17
Source File: QualifierSelectComponent.java From ramus with GNU General Public License v3.0 | 4 votes |
public QualifierSelectComponent(Engine engine, boolean uniqueSelected, boolean all) { super(new BorderLayout()); this.engine = engine; RowSet rs = new RowSet(engine, StandardAttributesPlugin .getQualifiersQualifier(engine), new Attribute[]{StandardAttributesPlugin .getAttributeNameAttribute(engine)}); List<Qualifier> qualifiers; if (all) qualifiers = engine.getQualifiers(); else { qualifiers = new ArrayList<Qualifier>(); List<Row> rows = rs.getAllRows(); for (Row row : rows) { if (row.getChildCount() == 0) { qualifiers.add(StandardAttributesPlugin.getQualifier( engine, row.getElement())); } } } this.qualifiers = qualifiers.toArray(new Qualifier[qualifiers.size()]); Arrays.sort(this.qualifiers, new Comparator<Qualifier>() { private Collator collator = Collator.getInstance(); @Override public int compare(Qualifier o1, Qualifier o2) { return collator.compare(o1.getName(), o2.getName()); } }); JScrollPane pane = new JScrollPane(); QualifierTable table = new QualifierTable(); model = new QualifierModel(rs.getRoot()); table.setTreeTableModel(model); TableRowHeader view = new TableRowHeader(table, model); view.setGroupSelect(all); SelectType selectType = (uniqueSelected) ? SelectType.RADIO : SelectType.CHECK; view.setSelectType(selectType); model.setSelectType(selectType); pane.setRowHeaderView(view); Row root = rs.getRoot(); ArrayList<Row> children = new ArrayList<Row>(root.getChildren()); rs.close(); root.setChildren(children); table.expandAll(); pane.setViewportView(table); this.setPreferredSize(new Dimension(500, 300)); this.add(pane, BorderLayout.CENTER); }
Example 18
Source File: TableEditor.java From ramus with GNU General Public License v3.0 | 4 votes |
@Override public JComponent getComponent() { pane = new JScrollPane(); pane.setViewportView(editorTable); header = new TableHeader(editorTable, model); header.setDragEnabled(true); header.setTransferHandler(new RowTransferHandle()); header.setDropMode(DropMode.INSERT); pane.setRowHeaderView(header); editorTable.setDropMode(DropMode.INSERT_ROWS); editorTable.setTransferHandler(new RowTransferHandle()); return pane; }
Example 19
Source File: NbEditorUI.java From netbeans with Apache License 2.0 | 4 votes |
private static void processSideBars(Map sideBars, JComponent ec, JScrollPane scroller) { // Remove all existing sidebars ec.removeAll(); // Add the scroller and the new sidebars ec.add(scroller); scroller.setRowHeader(null); scroller.setColumnHeaderView(null); // final MouseDispatcher mouse = new MouseDispatcher((JTextComponent) ec.getClientProperty(JTextComponent.class)); for (Iterator entries = sideBars.entrySet().iterator(); entries.hasNext(); ) { Map.Entry entry = (Map.Entry) entries.next(); SideBarPosition position = (SideBarPosition) entry.getKey(); JComponent sideBar = (JComponent) entry.getValue(); // if (position.getPosition() == SideBarPosition.WEST) { // JPanel p = new JPanel(new BorderLayout()) { // // @Override // public void addNotify() { // super.addNotify(); // infiltrateContainer(this, mouse, true); // } // // @Override // public void removeNotify() { // infiltrateContainer(this, mouse, false); // super.removeNotify(); // } // // }; // p.add(sideBar, BorderLayout.CENTER); // sideBar = p; // } if (position.isScrollable()) { if (position.getPosition() == SideBarPosition.WEST) { scroller.setRowHeaderView(sideBar); } else { if (position.getPosition() == SideBarPosition.NORTH) { scroller.setColumnHeaderView(sideBar); } else { throw new IllegalArgumentException("Unsupported side bar position, scrollable = true, position=" + position.getBorderLayoutPosition()); // NOI18N } } } else { ec.add(sideBar, position.getBorderLayoutPosition()); } } }