Search:

Type: Posts; User: jason3460

Page 1 of 2 1 2

Search: Search took 0.21 seconds.

  1. Replies
    1
    Views
    1,557

    BorderLayout makes everything disappear

    Hey, so when i attempt to use the BorderLayout, then run the program nothing is shown in the window, my slider/textboxes and labels are gone. Then when i revert back to using a FlowLayout, they come...
  2. 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...
  3. 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;
    ...
  4. 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
  5. 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:

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

    no nothing changed, still no shape being drawn
  11. 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...
  12. Replies
    20
    Views
    2,605

    [SOLVED] Re: NullPointerException with JSlider

    I tried making a new class, though I've been having a lot of trouble,

    I made a new thread here, your help would be much appreciated, If you want i will post all my code, or any code you would...
  13. 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;
  14. 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...
  15. 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)
    {
    ...
  16. 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...
  17. Replies
    1
    Views
    1,141

    Drawing a shape

    Hey, so my problem is that when my program draws a shape it is inside a small square, as you can see here(the arrow shows the small square):

    2517

    does anyone know how i can stop this from...
  18. Replies
    2
    Views
    1,045

    Re: Layout Managers

    okay thanks a lot, ill have a try at it!
  19. Replies
    2
    Views
    1,045

    Layout Managers

    Hey, so I'm making this program, and I want it to be laid out a certain way, but I'm not sure how to do this, seeing as this is the first time I've made a GUI with java.

    Here is what I have at the...
  20. Replies
    20
    Views
    2,605

    [SOLVED] Re: NullPointerException with JSlider

    Alright thanks a lot, I'll most likely be back for help -__-

    --- Update ---

    One question, would I make a new class for the painting, or would i implement it within the MyFrame or MyControlPanel...
  21. Replies
    20
    Views
    2,605

    [SOLVED] Re: NullPointerException with JSlider

    Well thank you so much! Can't believe I didn't realize I had called it twice.

    Now I have to get it so that the shape is drawn on the screen, and changes size depending on the value selected by the...
  22. Replies
    20
    Views
    2,605

    [SOLVED] Re: NullPointerException with JSlider

    Thanks!! I was calling MyControlPanel twice.. -__-
  23. Replies
    20
    Views
    2,605

    [SOLVED] Re: NullPointerException with JSlider

    MyShape.java


    package calculations;

    public class MyShape
    {
    public double getArea(double length)
    {
    return 0;
  24. Replies
    20
    Views
    2,605

    [SOLVED] Re: NullPointerException with JSlider

    but my actionlistener has these lines of code :



    myShape = new Circle();
    theControlPanel.setShape(myShape);
    System.out.println("The shape is: "+myShape);
    ...
  25. Replies
    20
    Views
    2,605

    [SOLVED] Re: NullPointerException with JSlider

    I tried clicking each of the shapes, and then moving the slider, i get the null error.

    I tried not clicking the menu and moving the slider, and the same thing happens.


    I tried using:
    ...
Results 1 to 25 of 42
Page 1 of 2 1 2