debug JComponent Border - Java Swing

Java examples for Swing:JComponent

Description

debug JComponent Border

Demo Code


//package com.java2s;
import java.awt.Color;

import java.util.Random;
import javax.swing.BorderFactory;

import javax.swing.JComponent;

public class Main {
    public static final boolean gDebug = false;
    private static final Random mRandomGenerator = new Random();
    private static final Color[] gRandomColors = { Color.black, Color.blue,
            Color.cyan, Color.darkGray, Color.gray, Color.green,
            Color.lightGray, Color.magenta, Color.orange, Color.pink,
            Color.red, Color.white, Color.yellow };

    public static void debugBorder(JComponent comp) {
        if (!gDebug)
            return;
        comp.setBorder(BorderFactory
                .createLineBorder(gRandomColors[mRandomGenerator
                        .nextInt(gRandomColors.length - 1)]));
    }//www  . ja v a 2  s .c om
}

Related Tutorials