Drawing Lines between two labels
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shaiket_Das
Posted On:   Sunday, November 4, 2001 10:53 PM

Hi all, I need to draw lines between two JLabels. how can I do it? Basically I have a JScrollPane and I have many labels randomly put in them. But I need to show links between them - in the form of lines. Here is the code. import javax.swing.*; import java.awt.*; public class try3 extends JFrame{ JLabel jlabel1,jlabel2,jlabel3,jlabel4; JScrollPane scpane; try3() { super("Join X and Y"); setSize(300,200); JPanel jpane = new JPanel(); jpane.setLayout(new GridLayout(0,2)); JLabel jlabel1 = new JLabel("W"); jpane.add(jlabel1); JLabel jlabel2 = new JLabel("X"); jpane.add(jlab   More>>

Hi all,

I need to draw lines between two JLabels. how can I do it? Basically I have a JScrollPane and I have many labels randomly put in them. But I need to show links between them - in the form of lines.

Here is the code.

import javax.swing.*;
import java.awt.*;


public class try3 extends JFrame{
JLabel jlabel1,jlabel2,jlabel3,jlabel4;
JScrollPane scpane;

try3() {
super("Join X and Y");
setSize(300,200);

JPanel jpane = new JPanel();
jpane.setLayout(new GridLayout(0,2));

JLabel jlabel1 = new JLabel("W");
jpane.add(jlabel1);
JLabel jlabel2 = new JLabel("X");
jpane.add(jlabel2);
JLabel jlabel3 = new JLabel("Y");
jpane.add(jlabel3);
JLabel jlabel4 = new JLabel("Z");
jpane.add(jlabel4);

scpane = new JScrollPane(jpane);


getContentPane().add(scpane, BorderLayout.CENTER);
}

public static void main(String args[]) {
try3 one = new try3();
one.setVisible(true);
}
}



Can somebody help me.

Thanks,

Shucky

   <<Less
About | Sitemap | Contact