Search:

Type: Posts; User: jason3460

Search: Search took 0.11 seconds.

  1. Re: Help with checking to see which menuItem has been selected

    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...
  2. Re: Help with checking to see which menuItem has been selected

    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;
    ...
  3. Re: Help with checking to see which menuItem has been selected

    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
  4. Re: Help with checking to see which menuItem has been selected

    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:

    ...
  5. Re: Help with checking to see which menuItem has been selected

    I understand what you mean, but how do I fix my problem ? I cant figure it out
  6. Re: Help with checking to see which menuItem has been selected

    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...
  7. Re: Help with checking to see which menuItem has been selected

    I have this method within the MyControlPanel class:


    public void setShape(MyShape suppliedShape)
    {
    theShape = suppliedShape;
    }


    The actionListeners look like this,...
  8. Re: Help with checking to see which menuItem has been selected

    I add the DrawShape within MyControlPanel constructor, is it called a constructor?



    public MyControlPanel()
    {
    initComponents();

    //JSlider setup
    ...
  9. Re: Help with checking to see which menuItem has been selected

    no nothing changed, still no shape being drawn
  10. Re: Help with checking to see which menuItem has been selected

    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...
  11. Re: Help with checking to see which menuItem has been selected

    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;
  12. Re: Help with checking to see which menuItem has been selected

    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...
  13. Re: Help with checking to see which menuItem has been selected

    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)
    {
    ...
  14. Help with checking to see which menuItem has been selected

    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...
Results 1 to 14 of 14