Java Code Examples for javax.swing.JScrollPane#setCorner()
The following examples show how to use
javax.swing.JScrollPane#setCorner() .
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: JTreeViewTable.java From pcgen with GNU Lesser General Public License v2.1 | 7 votes |
@Override protected void configureEnclosingScrollPane() { super.configureEnclosingScrollPane(); Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, wrappedCornerButton); } } }
Example 2
Source File: JDynamicTable.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void unconfigureEnclosingScrollPane() { super.unconfigureEnclosingScrollPane(); Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, null); } } }
Example 3
Source File: ClientGui.java From logging-log4j2 with Apache License 2.0 | 6 votes |
private JScrollPane scroll(final JTextArea text) { final JToggleButton toggleButton = new JToggleButton(); toggleButton.setAction(new AbstractAction() { private static final long serialVersionUID = -4214143754637722322L; @Override public void actionPerformed(final ActionEvent e) { final boolean wrap = toggleButton.isSelected(); text.setLineWrap(wrap); } }); toggleButton.setToolTipText("Toggle line wrapping"); final JScrollPane scrollStatusLog = new JScrollPane(text, // ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, // ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollStatusLog.setCorner(ScrollPaneConstants.LOWER_RIGHT_CORNER, toggleButton); return scrollStatusLog; }
Example 4
Source File: JTreeViewTable.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void unconfigureEnclosingScrollPane() { super.unconfigureEnclosingScrollPane(); Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, null); } } }
Example 5
Source File: JDynamicTable.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void unconfigureEnclosingScrollPane() { super.unconfigureEnclosingScrollPane(); Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, null); } } }
Example 6
Source File: JDynamicTable.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void configureEnclosingScrollPane() { super.configureEnclosingScrollPane(); Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setCorner( ScrollPaneConstants.UPPER_TRAILING_CORNER, wrappedCornerButton); } } }
Example 7
Source File: JTreeViewTable.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void unconfigureEnclosingScrollPane() { super.unconfigureEnclosingScrollPane(); Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, null); } } }
Example 8
Source File: JTreeViewTable.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void configureEnclosingScrollPane() { super.configureEnclosingScrollPane(); Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, wrappedCornerButton); } } }
Example 9
Source File: JDynamicTable.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void configureEnclosingScrollPane() { super.configureEnclosingScrollPane(); Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setCorner( ScrollPaneConstants.UPPER_TRAILING_CORNER, wrappedCornerButton); } } }
Example 10
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 11
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 12
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 13
Source File: DetailsPanel.java From netbeans with Apache License 2.0 | 4 votes |
private void initComponents() { table = new DetailsTable(); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JViewport viewport = new Viewport(table); final JScrollPane tableScroll = new JScrollPane( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); tableScroll.setViewport(viewport); tableScroll.setBorder(BorderFactory.createEmptyBorder()); tableScroll.setViewportBorder(BorderFactory.createEmptyBorder()); tableScroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new HeaderPanel()); scrollBar = new ScrollBar(JScrollBar.VERTICAL) { public int getUnitIncrement(int direction) { JViewport vp = tableScroll.getViewport(); Scrollable view = (Scrollable)(vp.getView()); Rectangle vr = vp.getViewRect(); return view.getScrollableUnitIncrement(vr, getOrientation(), direction); } public int getBlockIncrement(int direction) { JViewport vp = tableScroll.getViewport(); Scrollable view = (Scrollable)(vp.getView()); Rectangle vr = vp.getViewRect(); return view.getScrollableBlockIncrement(vr, getOrientation(), direction); } public void setValues(int newValue, int newExtent, int newMin, int newMax) { setEnabled(newExtent < newMax); if (isEnabled() && !isSelectionChanging() && isTrackingEnd()) newValue = newMax - newExtent; super.setValues(newValue, newExtent, newMin, newMax); } }; tableScroll.setVerticalScrollBar(scrollBar); dataContainer = tableScroll; JLabel noDataLabel = new JLabel("<No probe selected>", JLabel.CENTER); noDataLabel.setEnabled(false); noDataContainer = new JPanel(new BorderLayout()); noDataContainer.setOpaque(false); noDataContainer.add(noDataLabel, BorderLayout.CENTER); setOpaque(false); setLayout(new BorderLayout()); add(noDataContainer, BorderLayout.CENTER); }
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: DetailsPanel.java From visualvm with GNU General Public License v2.0 | 4 votes |
private void initComponents() { table = new DetailsTable(); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JViewport viewport = new Viewport(table); final JScrollPane tableScroll = new JScrollPane( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); tableScroll.setViewport(viewport); tableScroll.setBorder(BorderFactory.createEmptyBorder()); tableScroll.setViewportBorder(BorderFactory.createEmptyBorder()); tableScroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new HeaderPanel()); scrollBar = new ScrollBar(JScrollBar.VERTICAL) { public int getUnitIncrement(int direction) { JViewport vp = tableScroll.getViewport(); Scrollable view = (Scrollable)(vp.getView()); Rectangle vr = vp.getViewRect(); return view.getScrollableUnitIncrement(vr, getOrientation(), direction); } public int getBlockIncrement(int direction) { JViewport vp = tableScroll.getViewport(); Scrollable view = (Scrollable)(vp.getView()); Rectangle vr = vp.getViewRect(); return view.getScrollableBlockIncrement(vr, getOrientation(), direction); } public void setValues(int newValue, int newExtent, int newMin, int newMax) { setEnabled(newExtent < newMax); if (isEnabled() && !isSelectionChanging() && isTrackingEnd()) newValue = newMax - newExtent; super.setValues(newValue, newExtent, newMin, newMax); } }; tableScroll.setVerticalScrollBar(scrollBar); dataContainer = tableScroll; JLabel noDataLabel = new JLabel("<No probe selected>", JLabel.CENTER); noDataLabel.setEnabled(false); noDataContainer = new JPanel(new BorderLayout()); noDataContainer.setOpaque(false); noDataContainer.add(noDataLabel, BorderLayout.CENTER); setOpaque(false); setLayout(new BorderLayout()); add(noDataContainer, BorderLayout.CENTER); }
Example 17
Source File: DetailsPanel.java From visualvm with GNU General Public License v2.0 | 4 votes |
private void initComponents() { table = new DetailsTable(); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JViewport viewport = new Viewport(table); final JScrollPane tableScroll = new JScrollPane( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); tableScroll.setViewport(viewport); tableScroll.setBorder(BorderFactory.createEmptyBorder()); tableScroll.setViewportBorder(BorderFactory.createEmptyBorder()); tableScroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new HeaderPanel()); scrollBar = new ScrollBar(JScrollBar.VERTICAL) { public int getUnitIncrement(int direction) { JViewport vp = tableScroll.getViewport(); Scrollable view = (Scrollable)(vp.getView()); Rectangle vr = vp.getViewRect(); return view.getScrollableUnitIncrement(vr, getOrientation(), direction); } public int getBlockIncrement(int direction) { JViewport vp = tableScroll.getViewport(); Scrollable view = (Scrollable)(vp.getView()); Rectangle vr = vp.getViewRect(); return view.getScrollableBlockIncrement(vr, getOrientation(), direction); } public void setValues(int newValue, int newExtent, int newMin, int newMax) { setEnabled(newExtent < newMax); if (isEnabled() && !isSelectionChanging() && isTrackingEnd()) newValue = newMax - newExtent; super.setValues(newValue, newExtent, newMin, newMax); } }; tableScroll.setVerticalScrollBar(scrollBar); dataContainer = tableScroll; JLabel noDataLabel = new JLabel("<No probe selected>", JLabel.CENTER); noDataLabel.setEnabled(false); noDataContainer = new JPanel(new BorderLayout()); noDataContainer.setOpaque(false); noDataContainer.add(noDataLabel, BorderLayout.CENTER); setOpaque(false); setLayout(new BorderLayout()); add(noDataContainer, BorderLayout.CENTER); }
Example 18
Source File: EditorUI.java From netbeans with Apache License 2.0 | 4 votes |
protected void initGlyphCorner(JScrollPane scroller){ glyphCorner = new JPanel(); updateScrollPaneCornerColor(); scroller.setCorner(JScrollPane.LOWER_LEFT_CORNER, glyphCorner); }