I found what the problem is, it is because i am calling add(drawShape); within my jSlider stateChanged.
But it needs to be called within the stateChanged or else it will not work, is there a way...
Type: Posts; User: jason3460
I found what the problem is, it is because i am calling add(drawShape); within my jSlider stateChanged.
But it needs to be called within the stateChanged or else it will not work, is there a way...
right, so in the DrawShape class if I run:
public DrawShape(int newX, int newY, int newLength, MyShape shape)
{
x = newX;
y = newY;
length = newLength;
...
how can i call setShape() function on drawShape? seeing as i cant create an instance of DrawShape because it requires 3 int values ??
DrawShape drawShape = new DrawShape(int,int,int);
2520
do you mean the setShape() method which i used?
I don't understand how i would do it with the DrawShape class, because it requires three int values when creating an instance of it:
...
I understand what you mean, but how do I fix my problem ? I cant figure it out
this is what happens when i force the shape to be a square, then select square and move the slider:
2519
how do i get them to be the same variable ?
EDIT: yeah, when i use a...
I have this method within the MyControlPanel class:
public void setShape(MyShape suppliedShape)
{
theShape = suppliedShape;
}
The actionListeners look like this,...
I add the DrawShape within MyControlPanel constructor, is it called a constructor?
public MyControlPanel()
{
initComponents();
//JSlider setup
...
no nothing changed, still no shape being drawn
The code does not draw any shapes, just produces a white box in my program(where the shape is meant to be drawn):
2518
That code is meant to, when i select a shape from the menu, say i picked...
Well I'm kind of desperate to get this finished today!
Sorry, I'm just giving up all hope, I should be able to figure this out, but I can't.
well i tried this:
package calculations;
could you please write an example later for me, I'm completely lost! I'm making this program messier and messier! I've got bits of everything everywhere. Are you able to download my program? If so...
So in inside each of my shape classes(circle, square and triangle), i should add a paint component ?
for example,
public void paintComponent(Graphics g)
{
...
Hey, I've uploaded my program, so that you can test it, seeing as pasting large chunks of code wont let you see what my problem is.
Link: http://www.filedropper.com/calculations_1
In...