Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java to run colored lines

@Override
    public void paintComponent(Graphics g) {    
        super.paintComponent(g);

        Graphics2D g2d = (Graphics2D) g.create();
        g2d.setColor(Color.RED); //Lines' Color is set here
        g2d.setStroke(new BasicStroke(3));

        for(List<JLabel> line : lines) {

            for(int i=0; i <(line.size()) ; i++) {
                JLabel label1 = line.get(i);
                int n = (i == (line.size()-1)) ? 0: i+1;
                JLabel label2 = line.get(n);
                g2d.draw(new Line2D.Float(getCenter(label1), getCenter(label2)));
            }
        }

        g2d.dispose();
    }
Comment

PREVIOUS NEXT
Code Example
Java :: scanner in = new scanner(system.in) meaning in java 
Java :: java how to sort custom objects in descending orde 
Java :: Android kotlin send debug log as slack message 
Java :: with uses in python 
Java :: how to print message to console java 
Java :: path.resolve java 
Java :: how to add 0 in left padding using regular expression java 
Java :: create and populate list one line java 
Java :: java png obj animate image size 
Java :: lauch app from brodcast reciever 
Java :: how to iterate list in java selenium 
Java :: what singleton java spring 
Java :: sending file over socket stream 
Java :: do you have to implement all methods of an interface java 
Java :: consumer 
Java :: get number value of an output to another script java 
Java :: get cursor position in textarea java 
Java :: java interview question answer 
Java :: Fomating .json 
Java :: replacing string with dynamic avalues java 
Java :: io fole scanner object syntax 
Java :: sealed class in kotlin example 
Java :: click selectable in androiod 
Java :: How can I store user inputs in an array of integers? 
Java :: java assert keyword 
Java :: java coding standards for interfaces 
Java :: java producer consumer queue 
Java :: make for on all variable in class in java 
Java :: node constructor 
Java :: Read array of characters from space separated values in java 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =