@Override public void dragEnter(java.awt.dnd.DropTargetDragEvent evt) { log(out, "FileDrop: dragEnter event."); // Is this an acceptable drag event? if (FileDrop.this.isDragOk(out, evt)) { // If it's a Swing component, set its border if (c instanceof javax.swing.JComponent) { javax.swing.JComponent jc = (javax.swing.JComponent) c; FileDrop.this.normalBorder = jc.getBorder(); log(out, "FileDrop: normal border saved."); jc.setBorder(dragBorder); log(out, "FileDrop: drag border set."); } // end if: JComponent if (listener != null) { listener.dragEnter(c); } // Acknowledge that it's okay to enter // evt.acceptDrag( // java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE ); evt.acceptDrag(java.awt.dnd.DnDConstants.ACTION_COPY); log(out, "FileDrop: event accepted."); } // end if: drag ok else { // Reject the drag event evt.rejectDrag(); log(out, "FileDrop: event rejected."); } // end else: drag not ok } // end dragEnter
/** * Install this Border on the specified component by replacing the * existing Border with a CompoundBorder containing the original Border * and our ComponentBorder * * This method should only be invoked once all the properties of this * class have been set. Installing the Border more than once will cause * unpredictable results. */ public void install(JComponent parent) { this.parent = parent; this.determineInsetsAndAlignment(); // Add this Border to the parent Border current = parent.getBorder(); if (current == null) { parent.setBorder(this); } else { CompoundBorder compound = new CompoundBorder(current, this); parent.setBorder(compound); } // Add component to the parent parent.add(this.component); }
if ((parent != null) && parent.getBorder() == SHADOW_BORDER) { parent.setBorder(this.oldBorder); parent.setOpaque(this.oldOpaque);
this.oldBorder = parent.getBorder(); parent.setOpaque(false); parent.setBorder(SHADOW_BORDER);
JLabel label2; public void initialDemoPanel(){ setBorder(BorderFactory.createTitledBorder(getBorder(), "DemoPanel", TitledBorder.LEADING, TitledBorder.TOP, new Font("Default",Font.PLAIN,10), Color.gray)); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createTitledBorder(getBorder(), "ActionPanel", TitledBorder.LEADING, TitledBorder.TOP, new Font("Default",Font.PLAIN,10), Color.gray));
setBorder(defaultListCellRenderer.getBorder()); setBackground(defaultListCellRenderer.getBackground()); imageLabel.setIcon((Icon)value);
public static void addBorder(JComponent c, Border b) { Border cb = c.getBorder(); Border nb = cb == null ? b : new CompoundBorder(cb, b); c.setBorder(nb); }
public static String getBorderTitle(Component c) { String title = null; if (c instanceof JComponent) { title = getBorderTitle(((JComponent)c).getBorder()); } return title; } /** See javax.swing.JComponent.getBorderTitle. */
private Insets getInsets(Component parent) { Border border = ((JComponent)parent).getBorder(); if(border == null) return new Insets(0,0,0,0); else return border.getBorderInsets(parent); } //}}}
/** * {@inheritDoc} */ @Override protected Component doHighlight(Component renderer, ComponentAdapter adapter) { ((JComponent) renderer).setBorder(compoundBorder( ((JComponent) renderer).getBorder())); return renderer; }
@Override public void propertyChange(PropertyChangeEvent evt) { JComponent src = (JComponent) evt.getSource(); Border border = src.getBorder(); if (border instanceof LineBorder) { LineBorder lb = (LineBorder) border; if (lb.getThickness() == 1 && Color.LIGHT_GRAY.equals(lb.getLineColor())) { src.setBorder(BorderFactory.createLineBorder(UIManager.getColor(LFCustoms.SCROLLPANE_BORDER_COLOR))); } } } };
private static void updateBorder(Component view) { if (view instanceof JTable) return; // tables are not supported yet if (view instanceof JComponent) { JComponent component = (JComponent) view; Border border = component.getBorder(); if (border instanceof ViewBorder) return; // already set component.setBorder(border == null || border instanceof UIResource ? new ResourceViewBorder(border) : new ViewBorder(border)); } }
public void uninstallUI(JComponent c) { Container cp = frame.getContentPane(); if (cp instanceof JComponent) { JComponent contentPane = (JComponent) cp; if (contentPane.getBorder() == HANDY_EMPTY_BORDER) { contentPane.setBorder(null); } } super.uninstallUI(c); }
public static void repaintBorder(JComponent component) { final int borderWidth = ((ViewerBorder)component.getBorder()).borderWidth; component.paintImmediately(0, 0, component.getWidth(), borderWidth); component.paintImmediately(0, component.getHeight() - borderWidth, component.getWidth(), borderWidth); component.paintImmediately(0, 0, borderWidth, component.getHeight()); component.paintImmediately(component.getWidth() - borderWidth, 0, borderWidth, component.getHeight()); }
public void setLeftComponent(JComponent _left) { JComponent left=_left; if(left_!=null) remove(left_); if(left==null) { left=new JPanel(); left.setVisible(false); } left_=left; if( (contentBorder_!=null) &&(left_.getBorder() instanceof BorderUIResource)) left_.setBorder(contentBorder_); add(left_); }
/** * {@inheritDoc} */ @Override public Border getBorder() { if (getContentPane() instanceof JComponent) { return ((JComponent) getContentPane()).getBorder(); } return null; }
JComponent getRenderer(PropertyDisplayer_Inline inline) { inGetRenderer = true; JComponent result = rfactory(inline).getRenderer(inline.getProperty()); if (inline.isTableUI() && null == result.getBorder() ) { //Actually want an empty border, not null - some components treat //a null border as an invitation to improvise result.setBorder(BorderFactory.createEmptyBorder()); } inGetRenderer = false; return result; }