类javax.swing.CellRendererPane源码实例Demo

下面列出了怎么用javax.swing.CellRendererPane的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: blog-codes   文件: mxGraphicsCanvas2D.java
/**
 * 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);
	}
}
 
源代码2 项目: ghidra   文件: FileOpenDropHandler.java
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);
	}
}
 
源代码3 项目: ghidra   文件: FileOpenDropHandler.java
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);
	}
}
 
源代码4 项目: netbeans   文件: DelegateViewport.java
@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;
    }
    
}
 
源代码5 项目: nextreports-designer   文件: BasicGridHeaderUI.java
@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();
	}
 
源代码6 项目: blog-codes   文件: mxGraphics2DCanvas.java
/**
 * 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);
	}
}
 
源代码7 项目: ghidra   文件: ProjectDataTableDnDHandler.java
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;
		}
	}
}
 
源代码8 项目: ghidra   文件: ProjectDataTableDnDHandler.java
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);
}
 
源代码9 项目: netbeans   文件: DefaultOutlineCellRenderer.java
/** 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);
}
 
源代码10 项目: pcgen   文件: JTreeTable.java
/**
 * 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;
	}
}
 
源代码11 项目: pcgen   文件: JTreeTable.java
/**
 * 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;
	}
}
 
源代码12 项目: consulo   文件: MnemonicContainerListener.java
void addTo(Component component) {
  if (component == null || component instanceof CellRendererPane) {
    return;
  }
  if (component instanceof Container) {
    addTo((Container)component);
  }
  MnemonicWrapper.getWrapper(component);
}
 
源代码13 项目: pdfxtk   文件: MultiColumnListUI.java
/**
 * 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();
}
 
源代码14 项目: blog-codes   文件: mxGraphics2DCanvas.java
/**
 * 
 */
public CellRendererPane getRendererPane()
{
	return rendererPane;
}
 
源代码15 项目: blog-codes   文件: mxHtmlTextShape.java
/**
 * 
 */
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);
	}
}
 
源代码16 项目: ghidra   文件: ProjectDataTableDnDHandler.java
/** 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);
}
 
源代码17 项目: pumpernickel   文件: DescendantListener.java
@Override
public void componentAdded(ContainerEvent e) {
	if (!(e.getContainer() instanceof CellRendererPane))
		processAddition(e.getChild());
}
 
源代码18 项目: jpexs-decompiler   文件: MyProgressBarUI.java
@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();
    //}
}
 
源代码19 项目: osp   文件: MultiLineToolTipUI.java
@Override
public void installUI(JComponent c) {
   super.installUI(c);
   rendererPane = new CellRendererPane();
   c.add(rendererPane);
}
 
 类所在包
 类方法
 同包方法