Results 1 to 2 of 2
  1. #1
    Manny123 is offline Member
    Join Date
    Oct 2012
    Posts
    10
    Rep Power
    0

    Exclamation Bar chart Bluej problem

    Java Code:
    public class Bar {
        // the numeric value of the bar
        private Integer value;
        // the rectangle representing the bar
        private Rectangle view;
        // The text label for this bar
        private Text label;
        // The value as a text object
        private Text valueText;
        
        private Integer height;
    
     public Bar(String label, int height) {
            value = 0;
            view = new Rectangle();
            view.changeSize(0, height );
            this.label = new Text(label);
    
        }
        public void display () {
            label.makeVisible();
            view.makeVisible();
        }
        public Integer getTextHeight(){
            return height;
            
        }
        public void setValue(int newvalue) {
            value = newvalue;
            label.setPosition(value,height);
        }
    
    }
    I am trying to produce a bar on blue j and i am trying to function the setValue method so that if the user enters 100 as the parameter value, the value of the bar should change to 100 and the width of the view (rectangle) should change to 100. However i am having difficulty trying to pass the initial height from public Bar to the public void set value method so the bar maintains the height whenever a value is inputted. The public void setValue method above crashes whenever i enter a value when i execute the method.

    Any ideas please?

  2. #2
    quad64bit's Avatar
    quad64bit is online now Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Bar chart Bluej problem

    You say it crashes - what is the error? Please provide a complete stacktrace.

Similar Threads

  1. jfreechart plotting line chart on candlestick chart
    By amlwwalker in forum New To Java
    Replies: 0
    Last Post: 10-07-2012, 01:18 AM
  2. bar chart painting problem
    By mitttig in forum New To Java
    Replies: 8
    Last Post: 06-23-2011, 07:28 PM
  3. Is the problem with my code or bluej?
    By farahm in forum Advanced Java
    Replies: 2
    Last Post: 03-26-2011, 03:00 PM
  4. bluej hashset problem ;s
    By truant420 in forum Other IDEs
    Replies: 2
    Last Post: 12-07-2010, 05:56 PM
  5. Problem with creating a string bar chart
    By hubaba in forum New To Java
    Replies: 4
    Last Post: 04-04-2010, 07:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •