I cant seem to get it to draw the slider on my JFrame. Here is the code for the GUIApp
import javax.swing.*;
import java.awt.*;
public class GUIApp
{
DrawingPanel dp;
LabelPanel lp;
XMovePanel xmp;
YMovePanel ymp;
public GUIApp()
{
JFrame win = new JFrame("Drawing App");
win.setSize(500, 450);
win.setLocation(50,50);
win.setLayout(new BorderLayout());
win.add(new DrawingPanel(),BorderLayout.CENTER);
win.add(new XMovePanel(),BorderLayout.NORTH);
win.add(new YMovePanel(),BorderLayout.EAST);
win.add(new Widgets(),BorderLayout.SOUTH);
win.setVisible(true);
win.repaint();
}
}
I also have the XMovePanel which has the slider in it.
import java.awt.*;
import javax.swing.*;
public class XMovePanel extends JPanel
{
static final int MIN = 0;
static final int MAX = 450;
static final int INIT = 100;
public XMovePanel()
{
JSlider XCoord = new JSlider(JSlider.HORIZONTAL,MIN, MAX, INIT);
//XCoord.addChangeListener(this);
setBackground (Color.lightGray);
setPreferredSize (new Dimension (10, 30));
setLayout(null);
}
}
Any help would be fantastic thanks.


Sign In
Create Account


Back to top









