javax.swing.CellRendererPane Java Examples
The following examples show how to use
javax.swing.CellRendererPane.
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: mxGraphicsCanvas2D.java From blog-codes with Apache License 2.0 | 6 votes |
/** * Constructs a new graphics export canvas. */ public mxGraphicsCanvas2D(Graphics2D g) { setGraphics(g); state.g = g; // Initializes the cell renderer pane for drawing HTML markup try { rendererPane = new CellRendererPane(); } catch (Exception e) { log.log(Level.WARNING, "Failed to initialize renderer pane", e); } }
Example #2
Source File: FileOpenDropHandler.java From ghidra with Apache License 2.0 | 6 votes |
private void initializeComponents(Component comp) { if (comp instanceof CellRendererPane) { return; } if (comp instanceof Container) { Container c = (Container) comp; c.addContainerListener(this); Component comps[] = c.getComponents(); for (Component element : comps) { initializeComponents(element); } } DropTarget primaryDropTarget = comp.getDropTarget(); if (primaryDropTarget != null) { new CascadedDropTarget(comp, primaryDropTarget, globalDropTarget); } }
Example #3
Source File: FileOpenDropHandler.java From ghidra with Apache License 2.0 | 6 votes |
private void deinitializeComponents(Component comp) { if (comp instanceof CellRendererPane) { return; } if (comp instanceof Container) { Container c = (Container) comp; c.removeContainerListener(this); Component comps[] = c.getComponents(); for (Component element : comps) { deinitializeComponents(element); } } DropTarget dt = comp.getDropTarget(); if (dt instanceof CascadedDropTarget) { CascadedDropTarget target = (CascadedDropTarget) dt; DropTarget newTarget = target.removeDropTarget(globalDropTarget); comp.setDropTarget(newTarget); } }
Example #4
Source File: BasicGridHeaderUI.java From nextreports-designer with Apache License 2.0 | 6 votes |
@Override public void installUI(JComponent component) { grid = (JGrid) component; rendererPane = new CellRendererPane(); grid.add(rendererPane); // gridHeader = (JGrid) component; component.setOpaque(false); LookAndFeel.installColorsAndFont( component, "TableHeader.background", "TableHeader.foreground", "TableHeader.font"); installDefaults(); installListeners(); installKeyboardActions(); }
Example #5
Source File: DelegateViewport.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void scrollRectToVisible(Rectangle contentRect) { Container parent; int dx = getX(), dy = getY(); for (parent = getParent(); !(parent == null) && !(parent instanceof JComponent) && !(parent instanceof CellRendererPane); parent = parent.getParent()) { Rectangle bounds = parent.getBounds(); dx += bounds.x; dy += bounds.y; } if (!(parent == null) && !(parent instanceof CellRendererPane)) { contentRect.x += dx; contentRect.y += dy; ((JComponent) parent).scrollRectToVisible(contentRect); contentRect.x -= dx; contentRect.y -= dy; } }
Example #6
Source File: mxGraphics2DCanvas.java From blog-codes with Apache License 2.0 | 5 votes |
/** * Constructs a new graphics canvas for the given graphics object. */ public mxGraphics2DCanvas(Graphics2D g) { this.g = g; // Initializes the cell renderer pane for drawing HTML markup try { rendererPane = new CellRendererPane(); } catch (Exception e) { log.log(Level.WARNING, "Failed to initialize renderer pane", e); } }
Example #7
Source File: MultiColumnListUI.java From pdfxtk with Apache License 2.0 | 5 votes |
/** * Initializes <code>this.list</code> by calling <code>installDefaults()</code>, * <code>installListeners()</code>, and <code>installKeyboardActions()</code> * in order. * * @see #installDefaults * @see #installListeners * @see #installKeyboardActions */ public void installUI(JComponent c) { list = (JList)c; rendererPane = new CellRendererPane(); list.add(rendererPane); installDefaults(); installListeners(); installKeyboardActions(); }
Example #8
Source File: MnemonicContainerListener.java From consulo with Apache License 2.0 | 5 votes |
void addTo(Component component) { if (component == null || component instanceof CellRendererPane) { return; } if (component instanceof Container) { addTo((Container)component); } MnemonicWrapper.getWrapper(component); }
Example #9
Source File: JTreeTable.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
/** * Forwards the {@code scrollRectToVisible()} message to the * {@code JComponent}'s parent. Components that can service * the request, such as {@code JViewport}, * override this method and perform the scrolling. * * @param aRect the visible {@code Rectangle} * @see javax.swing.JViewport */ @Override public void scrollRectToVisible(Rectangle aRect) { Container parent; int dx = getX(); int dy = getY(); for (parent = getParent(); (parent != null) && !(parent instanceof JComponent) && !(parent instanceof CellRendererPane); parent = parent.getParent()) { final Rectangle bounds = parent.getBounds(); dx += bounds.x; dy += bounds.y; } if ((parent != null) && !(parent instanceof CellRendererPane)) { aRect.x += dx; aRect.y += dy; ((JComponent) parent).scrollRectToVisible(aRect); aRect.x -= dx; aRect.y -= dy; } }
Example #10
Source File: JTreeTable.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
/** * Forwards the {@code scrollRectToVisible()} message to the * {@code JComponent}'s parent. Components that can service * the request, such as {@code JViewport}, * override this method and perform the scrolling. * * @param aRect the visible {@code Rectangle} * @see javax.swing.JViewport */ @Override public void scrollRectToVisible(Rectangle aRect) { Container parent; int dx = getX(); int dy = getY(); for (parent = getParent(); (parent != null) && !(parent instanceof JComponent) && !(parent instanceof CellRendererPane); parent = parent.getParent()) { final Rectangle bounds = parent.getBounds(); dx += bounds.x; dy += bounds.y; } if ((parent != null) && !(parent instanceof CellRendererPane)) { aRect.x += dx; aRect.y += dy; ((JComponent) parent).scrollRectToVisible(aRect); aRect.x -= dx; aRect.y -= dy; } }
Example #11
Source File: DefaultOutlineCellRenderer.java From netbeans with Apache License 2.0 | 5 votes |
/** Creates a new instance of DefaultOutlineTreeCellRenderer */ public DefaultOutlineCellRenderer() { theCheckBox = createCheckBox(); // In order to paint the check-box correctly, following condition must be true: // SwingUtilities.getAncestorOfClass(CellRendererPane.class, theCheckBox) != null // (See e.g.: paintSkin() method in com/sun/java/swing/plaf/windows/XPStyle.java) fakeCellRendererPane = new CellRendererPane(); fakeCellRendererPane.add(theCheckBox); }
Example #12
Source File: ProjectDataTableDnDHandler.java From ghidra with Apache License 2.0 | 5 votes |
private void paintCell(CellRendererPane rendererPane, Graphics g, Rectangle cellRect, int row, int column) { TableCellRenderer tableRenderer = table.getCellRenderer(row, column); Component component = table.prepareRenderer(tableRenderer, row, column); rendererPane.paintComponent(g, component, table, cellRect.x, cellRect.y, cellRect.width, cellRect.height, true); }
Example #13
Source File: ProjectDataTableDnDHandler.java From ghidra with Apache License 2.0 | 5 votes |
private void paintCells(List<DomainFileInfo> domainFileInfos, CellRendererPane rendererPane, Graphics g) { TableColumnModel cm = table.getColumnModel(); int columnMargin = cm.getColumnMargin(); Rectangle clip = g.getClipBounds(); int yOffset = clip.y; int rowCount = domainFileInfos.size(); int columnCount = table.getColumnCount(); int modelRow = model.getRowIndex(domainFileInfos.get(0)); Rectangle cellRect = table.getCellRect(modelRow, 0, false); int startYOffset = cellRect.y; TableColumn aColumn; int columnWidth; for (int row = 0; row < rowCount; row++) { if (clip.y + clip.height < yOffset - startYOffset) { return; // no need to paint past the end of our visible area } modelRow = model.getRowIndex(domainFileInfos.get(row)); cellRect = table.getCellRect(modelRow, 0, false); cellRect.y -= startYOffset; // paint the row at the top of the graphics, not where it really lives yOffset += cellRect.height; for (int column = 0; column < columnCount; column++) { aColumn = cm.getColumn(column); columnWidth = aColumn.getWidth(); cellRect.width = columnWidth - columnMargin; paintCell(rendererPane, g, cellRect, modelRow, column); cellRect.x += columnWidth; } } }
Example #14
Source File: DescendantListener.java From pumpernickel with MIT License | 4 votes |
@Override public void componentAdded(ContainerEvent e) { if (!(e.getContainer() instanceof CellRendererPane)) processAddition(e.getChild()); }
Example #15
Source File: MyProgressBarUI.java From jpexs-decompiler with GNU General Public License v3.0 | 4 votes |
@Override public void stateChanged(ChangeEvent e) { SubstanceCoreUtilities.testComponentStateChangeThreadingViolation(progressBar); //if (displayTimeline != null) { //Main Change - this should be first // displayTimeline.abort(); //} int currValue = progressBar.getValue(); int span = progressBar.getMaximum() - progressBar.getMinimum(); int barRectWidth = progressBar.getWidth() - 2 * margin; int barRectHeight = progressBar.getHeight() - 2 * margin; int totalPixels = (progressBar.getOrientation() == JProgressBar.HORIZONTAL) ? barRectWidth : barRectHeight; int pixelDelta = (span <= 0) ? 0 : (currValue - displayedValue) * totalPixels / span; /*displayTimeline = new Timeline(progressBar); displayTimeline.addPropertyToInterpolate(Timeline .<Integer>property("displayedValue").from(displayedValue) .to(currValue).setWith(new TimelinePropertyBuilder.PropertySetter<Integer>() { @Override public void set(Object obj, String fieldName, Integer value) { displayedValue = value; progressBar.repaint(); } })); displayTimeline.setEase(new Spline(0.4f)); AnimationConfigurationManager.getInstance().configureTimeline( displayTimeline);*/ boolean isInCellRenderer = (SwingUtilities.getAncestorOfClass( CellRendererPane.class, progressBar) != null); //if (false) {//currValue > 0 && !isInCellRenderer && Math.abs(pixelDelta) > 5) { // displayTimeline.play(); //} else { displayedValue = currValue; progressBar.repaint(); //} }
Example #16
Source File: ProjectDataTableDnDHandler.java From ghidra with Apache License 2.0 | 4 votes |
/** Paint each of the given records that is inside of the clips */ private void paintRecords(List<DomainFileInfo> records, Graphics g) { CellRendererPane rendererPane = new CellRendererPane(); paintCells(records, rendererPane, g); }
Example #17
Source File: mxHtmlTextShape.java From blog-codes with Apache License 2.0 | 4 votes |
/** * */ public void paintShape(mxGraphics2DCanvas canvas, String text, mxCellState state, Map<String, Object> style) { mxLightweightLabel textRenderer = mxLightweightLabel .getSharedInstance(); CellRendererPane rendererPane = canvas.getRendererPane(); Rectangle rect = state.getLabelBounds().getRectangle(); Graphics2D g = canvas.getGraphics(); if (textRenderer != null && rendererPane != null && (g.getClipBounds() == null || g.getClipBounds().intersects( rect))) { double scale = canvas.getScale(); int x = rect.x; int y = rect.y; int w = rect.width; int h = rect.height; if (!mxUtils.isTrue(style, mxConstants.STYLE_HORIZONTAL, true)) { g.rotate(-Math.PI / 2, x + w / 2, y + h / 2); g.translate(w / 2 - h / 2, h / 2 - w / 2); int tmp = w; w = h; h = tmp; } // Replaces the linefeeds with BR tags if (isReplaceHtmlLinefeeds()) { text = text.replaceAll("\n", "<br>"); } // Renders the scaled text textRenderer.setText(createHtmlDocument(style, text, (int) Math.round(w / state.getView().getScale()), (int) Math.round(h / state.getView().getScale()))); textRenderer.setFont(mxUtils.getFont(style, canvas.getScale())); g.scale(scale, scale); rendererPane.paintComponent(g, textRenderer, rendererPane, (int) (x / scale) + mxConstants.LABEL_INSET, (int) (y / scale) + mxConstants.LABEL_INSET, (int) (w / scale), (int) (h / scale), true); } }
Example #18
Source File: mxGraphics2DCanvas.java From blog-codes with Apache License 2.0 | 4 votes |
/** * */ public CellRendererPane getRendererPane() { return rendererPane; }
Example #19
Source File: MultiLineToolTipUI.java From osp with GNU General Public License v3.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); rendererPane = new CellRendererPane(); c.add(rendererPane); }