Java Swing Border findComponentWithBorder(JComponent panel, Class aClass)

Here you can find the source of findComponentWithBorder(JComponent panel, Class aClass)

Description

find Component With Border

License

Apache License

Declaration

private static Container findComponentWithBorder(JComponent panel, Class<?> aClass) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.swing.*;

import java.awt.*;

public class Main {
    private static Container findComponentWithBorder(JComponent panel, Class<?> aClass) {
        for (int n = 0; n < panel.getComponentCount(); n++) {
            if (panel.getComponent(n) instanceof JComponent) {
                JComponent comp = (JComponent) panel.getComponent(n);
                if (comp.getBorder() != null && aClass.isAssignableFrom(comp.getBorder().getClass())) {
                    return comp;
                }/*from   w  ww . j a  v  a  2 s . c om*/

                Container con = findComponentWithBorder(comp, aClass);
                if (con != null) {
                    return con;
                }
            }
        }
        return null;
    }
}

Related

  1. drawBorderTrans(Graphics2D g, JComponent focusOwner, JComponent area)
  2. drawBorderWhite(Graphics2D g, JComponent focusOwner, JComponent area)
  3. drawDisabledBorder(Graphics g, int x, int y, int w, int h)
  4. drawDisabledBorder(Graphics g, int x, int y, int w, int h)
  5. extendByBorder(JLabel label, Dimension dm)
  6. generatePanelWithoutBorder()
  7. getDefaultBorder()
  8. getDefaultBorderColour()
  9. getTextFieldBorder()