當前位置: 首頁>>代碼示例>>Java>>正文


Java CellRendererPane類代碼示例

本文整理匯總了Java中javax.swing.CellRendererPane的典型用法代碼示例。如果您正苦於以下問題:Java CellRendererPane類的具體用法?Java CellRendererPane怎麽用?Java CellRendererPane使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CellRendererPane類屬於javax.swing包,在下文中一共展示了CellRendererPane類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: scrollRectToVisible

import javax.swing.CellRendererPane; //導入依賴的package包/類
@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;
    }
    
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:DelegateViewport.java

示例2: mxGraphicsCanvas2D

import javax.swing.CellRendererPane; //導入依賴的package包/類
/**
 * 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)
	{
		// ignore
	}
}
 
開發者ID:GDSRS,項目名稱:TrabalhoFinalEDA2,代碼行數:19,代碼來源:mxGraphicsCanvas2D.java

示例3: MetalComboBoxButton

import javax.swing.CellRendererPane; //導入依賴的package包/類
/**
 * Creates a new button.
 *
 * @param cb  the combo that the button is used for (<code>null</code> not
 *            permitted).
 * @param i  the icon displayed on the button.
 * @param onlyIcon  a flag that specifies whether the button displays only an
 *                  icon, or text as well.
 * @param pane  the rendering pane.
 * @param list  the list.
 */
public MetalComboBoxButton(JComboBox cb, Icon i, boolean onlyIcon,
    CellRendererPane pane, JList list)
{
  super();
  if (cb == null)
    throw new NullPointerException("Null 'cb' argument");
  comboBox = cb;
  comboIcon = i;
  iconOnly = onlyIcon;
  listBox = list;
  rendererPane = pane;
  setRolloverEnabled(false);
  setEnabled(comboBox.isEnabled());
  setFocusable(comboBox.isEnabled());
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:27,代碼來源:MetalComboBoxButton.java

示例4: getScreenshot

import javax.swing.CellRendererPane; //導入依賴的package包/類
private BufferedImage getScreenshot(Container panel) {
	Dimension size = new Dimension((int) panel.getPreferredSize().getWidth()+50, (int) panel.getPreferredSize().getHeight()+10);
	panel.setSize(size);

	this.layoutComponent(panel);

	BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);

	//Remove buttons panel
	panel.getComponent(2).setVisible(false);

	CellRendererPane crp = new CellRendererPane();
	crp.add(panel);
	crp.paintComponent(img.createGraphics(), panel, crp, panel.getBounds());

	//Re-add buttons panel
	panel.getComponent(2).setVisible(true);

	return img;
}
 
開發者ID:Shadorc,項目名稱:Twitter-Stalker-V.2,代碼行數:21,代碼來源:Share.java

示例5: PlasticComboBoxButton

import javax.swing.CellRendererPane; //導入依賴的package包/類
PlasticComboBoxButton(JComboBox comboBox, Icon comboIcon, boolean iconOnly, CellRendererPane rendererPane, JList listBox)
/*  36:    */   {
/*  37: 80 */     super("");
/*  38: 81 */     setModel(new DefaultButtonModel()
/*  39:    */     {
/*  40:    */       public void setArmed(boolean armed)
/*  41:    */       {
/*  42: 83 */         super.setArmed((isPressed()) || (armed));
/*  43:    */       }
/*  44: 85 */     });
/*  45: 86 */     this.comboBox = comboBox;
/*  46: 87 */     this.comboIcon = comboIcon;
/*  47: 88 */     this.iconOnly = iconOnly;
/*  48: 89 */     this.rendererPane = rendererPane;
/*  49: 90 */     this.listBox = listBox;
/*  50: 91 */     setEnabled(comboBox.isEnabled());
/*  51: 92 */     setFocusable(false);
/*  52: 93 */     setRequestFocusEnabled(comboBox.isEnabled());
/*  53: 94 */     setBorder(UIManager.getBorder("ComboBox.arrowButtonBorder"));
/*  54: 95 */     setMargin(new Insets(0, 2, 0, 2));
/*  55: 96 */     this.borderPaintsFocus = UIManager.getBoolean("ComboBox.borderPaintsFocus");
/*  56:    */   }
 
開發者ID:xiwc,項目名稱:confluence.keygen,代碼行數:23,代碼來源:PlasticComboBoxButton.java

示例6: createCellRendererPane

import javax.swing.CellRendererPane; //導入依賴的package包/類
protected CellRendererPane createCellRendererPane()
{
	return new CellRendererPane()
	{
		public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h, boolean shouldValidate) 
		{
			w = p.getWidth() - x;

			Insets m = p.getInsets();
			if(m != null)
			{
				w -= m.right;
			}
			super.paintComponent(g, c, p, x, y, w, h, shouldValidate);
		}
	};
}
 
開發者ID:andy-goryachev,項目名稱:PasswordSafe,代碼行數:18,代碼來源:AgTreeUI.java

示例7: MetalComboBoxButton

import javax.swing.CellRendererPane; //導入依賴的package包/類
/**
 * Creates a new button.
 * 
 * @param cb  the combo that the button is used for (<code>null</code> not 
 *            permitted).
 * @param i  the icon displayed on the button.
 * @param onlyIcon  a flag that specifies whether the button displays only an
 *                  icon, or text as well.
 * @param pane  the rendering pane.
 * @param list  the list.
 */
public MetalComboBoxButton(JComboBox cb, Icon i, boolean onlyIcon,
    CellRendererPane pane, JList list)
{
  super();
  if (cb == null)
    throw new NullPointerException("Null 'cb' argument");
  comboBox = cb;
  comboIcon = i;
  iconOnly = onlyIcon;
  listBox = list;
  rendererPane = pane;
  setRolloverEnabled(false);
  setEnabled(comboBox.isEnabled());
  setFocusable(comboBox.isEnabled());
}
 
開發者ID:nmldiegues,項目名稱:jvm-stm,代碼行數:27,代碼來源:MetalComboBoxButton.java

示例8: installUI

import javax.swing.CellRendererPane; //導入依賴的package包/類
/**
 * 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 = (JXList)c;

    layoutOrientation = list.getLayoutOrientation();

    rendererPane = new CellRendererPane();
    list.add(rendererPane);

    columnCount = 1;

    updateLayoutStateNeeded = modelChanged;
    isLeftToRight = list.getComponentOrientation().isLeftToRight();

    installDefaults();
    installListeners();
    installKeyboardActions();
    installSortUI();
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:29,代碼來源:BasicXListUI.java

示例9: testZoomableCustomHeader

import javax.swing.CellRendererPane; //導入依賴的package包/類
/**
 * Issue #77-swingx: support year-wise navigation.
 * Alleviate the problem by allowing custom calendar headers.
 * 
 * Here: test that the monthViewUI uses the custom header if available.
 */
@Test
public void testZoomableCustomHeader() {
    UIManager.put(CalendarHeaderHandler.uiControllerID, "org.jdesktop.swingx.plaf.basic.SpinningCalendarHeaderHandler");
    JXMonthView monthView = new JXMonthView();
    monthView.setZoomable(true);
    // digging into internals
    Container header = (Container) monthView.getComponent(0);
    if (header instanceof CellRendererPane) {
        header = (Container) monthView.getComponent(1);
    }
    try {
        assertTrue("expected SpinningCalendarHeader but was " + header.getClass(), header instanceof SpinningCalendarHeaderHandler.SpinningCalendarHeader);
    } finally {
        UIManager.put(CalendarHeaderHandler.uiControllerID, null);
    }
    
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:24,代碼來源:BasicMonthViewUITest.java

示例10: installUI

import javax.swing.CellRendererPane; //導入依賴的package包/類
@Override
public void installUI( JComponent c ) {
  if ( !( c instanceof JBroTableHeader ) )
    throw new IllegalArgumentException( "Not a groupable header: " + c );
  JBroTableHeader header = ( JBroTableHeader )c;
  this.header = header;
  int levelsCnt = table.getData() == null ? 0 : table.getData().getFieldGroups().size();
  delegates = new ArrayList< ComponentUI >( levelsCnt );
  headers = new ArrayList< JTableHeader >( levelsCnt );
  rendererPanes = new ArrayList< CellRendererPane >( levelsCnt );
  if ( heightsCache == null || heightsCache.length < levelsCnt )
    heightsCache = new int[ levelsCnt ];
  updateModel();
  super.installUI( c );
  SwingUtilities.updateComponentTreeUI( header );
  for ( JTableHeader delegateHeader : headers )
    SwingUtilities.updateComponentTreeUI( delegateHeader );
}
 
開發者ID:Qualtagh,項目名稱:JBroTable,代碼行數:19,代碼來源:JBroTableHeaderUI.java

示例11: createCustomCellRendererPane

import javax.swing.CellRendererPane; //導入依賴的package包/類
/**
 * Creates a custom {@link CellRendererPane} that sets the renderer
 * component to be non-opqaque if the associated row isn't selected. This
 * custom {@code CellRendererPane} is needed because a table UI delegate has
 * no prepare renderer like {@link JTable} has.
 */
protected CellRendererPane createCustomCellRendererPane() {
	return new CellRendererPane() {
		@Override
		public void paintComponent(Graphics graphics, Component component,
				Container container, int x, int y, int w, int h,
				boolean shouldValidate) {

			int rowAtPoint = table.rowAtPoint(new Point(x, y));
			boolean isSelected = table.isRowSelected(rowAtPoint);
			if (component instanceof JComponent) {
				JComponent jComponent = (JComponent) component;
				jComponent.setOpaque(isSelected);
				jComponent.setBorder(isSelected ? getSelectedRowBorder()
						: getRowBorder());
				jComponent.setBackground(isSelected ? table
						.getSelectionBackground() : TRANSPARENT_COLOR);
			}
			super.paintComponent(graphics, component, container, x, y, w,
					h, shouldValidate);
		}
	};
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:29,代碼來源:ITunesTableUI.java

示例12: getAccessibleText

import javax.swing.CellRendererPane; //導入依賴的package包/類
public AccessibleText getAccessibleText() {
    if (pane == null) {
        //Cheat just a bit here - will do for now - the text is
        //there, more or less where it should be, and a screen
        //reader should be able to find it;  exact bounds don't
        //make much difference
        pane = new JEditorPane();
        pane.setBounds (panel.getBounds());
        pane.getAccessibleContext().getAccessibleText();
        pane.setFont (panel.getFont());
        CellRendererPane cell = new CellRendererPane();
        cell.add (pane);
    }
    pane.setText(getText());
    pane.selectAll();
    pane.validate();
    return pane.getAccessibleContext().getAccessibleText();
}
 
開發者ID:fifa0329,項目名稱:vassal,代碼行數:19,代碼來源:InstructionsPanel.java

示例13: testInstallUninstallComponents

import javax.swing.CellRendererPane; //導入依賴的package包/類
public void testInstallUninstallComponents() throws Exception {
    ui.comboBox = comboBox;
    ui.popup = new BasicComboPopup(comboBox);
    ui.uninstallComponents();
    assertEquals(0, ui.comboBox.getComponentCount());
    assertNull(ui.arrowButton);
    assertNull(ui.editor);
    ui.installComponents();
    assertEquals(2, ui.comboBox.getComponentCount());
    assertTrue(ui.comboBox.getComponent(0) instanceof BasicArrowButton);
    assertTrue(ui.comboBox.getComponent(1) instanceof CellRendererPane);
    assertNotNull(ui.arrowButton);
    assertNull(ui.editor);
    ui.comboBox.add(new JLabel());
    ui.uninstallComponents();
    assertEquals(0, ui.comboBox.getComponentCount());
    assertNull(ui.arrowButton);
    assertNull(ui.editor);
    comboBox.setEditable(true);
    ui.installComponents();
    assertNotNull(ui.arrowButton);
    assertNotNull(ui.editor);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:24,代碼來源:BasicComboBoxUITest.java

示例14: paintTable

import javax.swing.CellRendererPane; //導入依賴的package包/類
protected void paintTable(Graphics g) {
	treeTableCellRenderer.prepareForTable(g);
	Graphics cg = g.create(0, 0, treeTable.getWidth(), treeTable.getHeight());
	try {
		table.paint(cg);
	} finally {
		cg.dispose();
	}
	
	// JTable doesn't paint anything for the editing cell,
	// so painting the background color is placed here
	if (table.isEditing()) {
		int col = table.getEditingColumn();
		int row = table.getEditingRow();
		boolean sel = treeTableCellRenderer.isSelected(
				tree.isRowSelected(row) && table.isColumnSelected(col));
		TreeTableCellRenderer r = treeTable.getCellRenderer(row, col);
		Component c = r.getTreeTableCellRendererComponent(
					treeTable, null, sel, false, row, col);
		// TODO, create CellRendererPane for TreeTable, for use by the focus renderer too.
		CellRendererPane rp = (CellRendererPane)table.getComponent(0);
		Rectangle cell = table.getCellRect(row, col, true);
		rp.paintComponent(g, c, table, cell.x, cell.y, cell.width, cell.height, true);
		rp.removeAll();
	}
}
 
開發者ID:Sciss,項目名稱:TreeTable,代碼行數:27,代碼來源:BasicTreeTableUI.java

示例15: installUI

import javax.swing.CellRendererPane; //導入依賴的package包/類
@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();
	}
 
開發者ID:nextreports,項目名稱:nextreports-designer,代碼行數:17,代碼來源:BasicGridHeaderUI.java


注:本文中的javax.swing.CellRendererPane類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。