draw to a Tab
In Java, is there a way to take a Rectrangle or Line
such as the following and place it in a JTabbedPane?
g.drawRect(0, 0,width, height);
g.drawLine(x, y, width, height);
Would I have to create a JPanel?
How would I do this?
Your help in understanding this is appreciated.
Have a class that subclasses JPanel.
Add you class to the JTabbedPane as a new tab.
Overide paint, and paint you two rects.
Is this what you mean?
Is the following what you mean? If so, how would I add this class to a TabbedPane?
public class DrawLine extends JPanel
public void paintComponent(Graphics g)
Graphics2D g2D = (Graphics2D)g;
int i = 3;
g.drawLine(x, (int)f(x), (test), (int)f((test)));
while(i != test.length)
i = i+2;
Assuming you hold a member of JTabbedPane, after you create it, and add it to the main contect pain, just use addTab, and pass your DrawLine object.