微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.swing.CellRendererPane的实例源码

项目:incubator-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;
    }

}
项目:TrabalhoFinalEDA2    文件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)
    {
        // ignore
    }
}
项目:OWLAx    文件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)
    {
        // ignore
    }
}
项目:javify    文件MetalComboBoxButton.java   
/**
 * 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());
}
项目:Twitter-Stalker-V.2    文件Share.java   
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;
}
项目:confluence.keygen    文件PlasticComboBoxButton.java   
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,2));
/*  55: 96 */     this.borderPaintsFocus = UIManager.getBoolean("ComboBox.borderPaintsFocus");
/*  56:    */   }
项目:PasswordSafe    文件AgTreeUI.java   
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);
        }
    };
}
项目:jvm-stm    文件MetalComboBoxButton.java   
/**
 * 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,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());
}
项目:swingx    文件BasicXListUI.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 = (JXList)c;

    layoutOrientation = list.getLayoutOrientation();

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

    columnCount = 1;

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

    installDefaults();
    installListeners();
    installKeyboardActions();
    installSortUI();
}
项目:swingx    文件BasicMonthViewUITest.java   
/**
 * 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);
    }

}
项目:JbroTable    文件JbroTableHeaderUI.java   
@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 );
}
项目:SmartTokens    文件ITunesTableuI.java   
/**
 * 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,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,shouldValidate);
        }
    };
}
项目:vassal    文件InstructionsPanel.java   
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();
}
项目:cn1    文件BasicComboBoxUITest.java   
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);
}
项目:JamVM-PH    文件MetalComboBoxButton.java   
/**
 * 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,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());
}
项目:GKA1    文件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)
    {
        // ignore
    }
}
项目:classpath    文件MetalComboBoxButton.java   
/**
 * 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,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());
}
项目:freeVM    文件BasicComboBoxUITest.java   
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);
    comboBox.setEditable(true);
    ui.installComponents();
    assertNotNull(ui.arrowButton);
    assertNotNull(ui.editor);
}
项目:TreeTable    文件BasicTreeTableuI.java   
protected void paintTable(Graphics g) {
    treeTableCellRenderer.prepareForTable(g);
    Graphics cg = g.create(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,table,cell.x,cell.y,cell.width,cell.height,true);
        rp.removeAll();
    }
}
项目: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();
    }
项目:WMA    文件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)
    {
        // ignore
    }
}
项目:OnionUmlVisualization    文件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)
    {
        // ignore
    }
}
项目:incubator-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);
}
项目:TrabalhoFinalEDA2    文件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)
    {
        // ignore
    }
}
项目:Tarski    文件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) {
    // ignore
  }
}
项目:Tarski    文件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) {
    // ignore
  }
}
项目:fontchooser    文件ScreenshotMaker.java   
@Override
public void run() {

    Dimension size = new Dimension(575,275);
    for (String lookAndFeelClassName : LOOK_AND_FEELS) {
        ExampleRunner.useLookAndFeel(lookAndFeelClassName);
        FontChooser fontChooser = new FontChooser(new Font("Helvetica",Font.PLAIN,24));
        fontChooser.setBorder(new EmptyBorder(10,10,10));
        fontChooser.setSize(size);
        layoutComponent(fontChooser);

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

        BufferedImage image = new BufferedImage(size.width,size.height,BufferedImage.TYPE_INT_ARGB);
        Graphics graphics = image.createGraphics();

        rendererPane.paintComponent(graphics,fontChooser,rendererPane,fontChooser.getBounds());

        String pathname = createFileName(lookAndFeelClassName);
        try {
            ImageIO.write(image,"png",new File(pathname));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
项目:OWLAx    文件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)
    {
        // ignore
    }
}
项目:javify    文件BasicTableuI.java   
public void installUI(JComponent comp)
{
  table = (JTable) comp;
  rendererPane = new CellRendererPane();
  table.add(rendererPane);

  installDefaults();
  installKeyboardActions();
  installListeners();
}
项目:javify    文件BasicTableHeaderUI.java   
public void installUI(JComponent c)
{
  header = (jtableheader) c;
  rendererPane = new CellRendererPane();
  installDefaults();
  installKeyboardActions();
  installListeners();
}
项目:intellij-ce-playground    文件MnemonicContainerListener.java   
void addTo(Component component) {
  if (component == null || component instanceof CellRendererPane) {
    return;
  }
  if (component instanceof Container) {
    addTo((Container)component);
  }
  MnemonicWrapper.getWrapper(component);
}
项目:PasswordSafe    文件AbstractAnimatedIcon.java   
private Component findActualComponent(Component c)
{
    Component actual = SwingUtilities.getAncestorOfClass(CellRendererPane.class,c);
    if((actual != null) && (actual.getParent() != null))
    {
        c = findActualComponent(actual.getParent());
    }
    return c;
}
项目:jvm-stm    文件BasicTableuI.java   
public void installUI(JComponent comp) 
{
  table = (JTable) comp;
  rendererPane = new CellRendererPane();
  table.add(rendererPane);

  installDefaults();
  installKeyboardActions();
  installListeners();
}
项目:jvm-stm    文件BasicTableHeaderUI.java   
public void installUI(JComponent c)
{
  header = (jtableheader) c;
  rendererPane = new CellRendererPane();
  installDefaults();
  installKeyboardActions();
  installListeners();
}
项目:swingx    文件JXButton.java   
/**
 * {@inheritDoc}
 */
@Override
public Dimension getPreferredSize() {
    if (getComponentCount() == 1 && getComponent(0) instanceof CellRendererPane) {
        return BasicGraphicsUtils.getPreferredButtonSize(fgStamp,getIconTextGap());
    }

    return super.getPreferredSize();
}
项目:swingx    文件BasicMonthViewUI.java   
/**
 * Creates and installs the renderingHandler and infrastructure to use it.
 */
protected void installrenderingHandler() {
    setRenderingHandler(createRenderingHandler());
    if (getRenderingHandler() != null) {
        rendererPane = new CellRendererPane();
        monthView.add(rendererPane);
    }
}
项目:swingx    文件BasicMonthViewUITest.java   
/**
 * Issue #1046-swingx: month title not updated when traversing months
 * (programatically or by navigating in monthView)
 */
@Test
public void testZoomableAddsCalendarHeader() {
    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);
    }
    assertTrue("expected BasicCalendarHeader but was " + header.getClass(),header instanceof BasicCalendarHeaderHandler.BasicCalendarHeader);
}
项目:swingx    文件BasicMonthViewUITest.java   
/**
 * Issue #1046-swingx: month title not updated when traversing months
 * (programatically or by navigating in monthView)
 */
@Test
public void testZoomableupdateUIKeepsCalendarHeader() {
    JXMonthView monthView = new JXMonthView();
    monthView.setZoomable(true);
    monthView.updateUI();
    // digging into internals
    Component header = monthView.getComponent(0);
    if (header instanceof CellRendererPane) {
        header = (Container) monthView.getComponent(1);
    }
    assertTrue("expected BasicCalendarHeader but was " + header.getClass(),header instanceof BasicCalendarHeaderHandler.BasicCalendarHeader);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。