-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5eeec43
commit 0433905
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import org.w3c.dom.Node; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.awt.image.PixelInterleavedSampleModel; | ||
|
||
public class BSTVisulization extends JFrame { | ||
private Node root; | ||
private JPanel topPanel,treePanel,infoPanel; | ||
private JPanel topLeftPanel,topRightPanel; | ||
private JButton btnAdd, btnDelete; | ||
private JTextField tf; | ||
private int x=300, Y=75; | ||
private Graphics2D g2; | ||
private Rectangle size; | ||
private JLabel labelPreoder,labelInoder,labelPostOder,labelHeight; | ||
private JLabel ansInoder,ansPreoder,ansPostoder,ansHeight; | ||
private FontMetrics fontMetrics; | ||
|
||
// Node Structure | ||
private static Class Node{ | ||
static int TEXT_WIDTH =40; | ||
static int TEXT_HEIGHT=40; | ||
|
||
JLabel data; | ||
Node Left; | ||
Node right; | ||
Points p; | ||
|
||
Node(int info) { | ||
data = new JLabel(info + "" , SwingConstants.CENTER); | ||
data.setFont(new Font("Arial",Font.BOLD,20)); | ||
data.setBorder(BorderFactory.createLineBorder(Color.black)); | ||
data.setOpaque(true); | ||
data.setBackground(Color.GREEN); | ||
p = null; | ||
} | ||
|
||
} | ||
|
||
} |