| Author |
Help with colorslide
|
Allan Newman
Greenhorn
Joined: Mar 06, 2006
Posts: 10
|
|
Could someone tell me what i am doing wrong with this boolean: import javax.swing.*; import javax.swing.event.*; import java.awt.*; public class ColorSlide extends JFrame implements ChangeListener { ColorPanel canvas = new ColorPanel(); JSlider red = new JSlider(0,255,0); JSlider green = new JSlider(0,255,0); JSlider blue = new JSlider(0,255,255); public ColorSlide() { super("Color Slide"); setSize(270,300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); red.setMajorTickSpacing(50); red.setMinorTickSpacing(10); red.setPaintTicks(true); red.SetPaintLabels(true); red.addChangeListener(this); green.setMajorTickSpacing(50); green.setMinorTickSpacing(10); green.setPaintTicks(true); green.SetPaintLabels(true); green.addChangeListener(this); blue.setMajorTickSpacing(50); blue.setMinorTickSpacing(10); blue.setPaintTicks(true); blue.SetPaintLabels(true); blue.addChangeListener(this); JLabel redLabel = new JLabel("Red: "); JLabel greenLabel = new JLabel("Green: "); JLabel blueLabel = new JLabel("Blue: "); GridLayout grid = new GridLayout(4, 1); FlowLayout right = new FlowLayout(FlowLayout.RIGHT); JPanel redPanel = new JPanel(); redPanel.setLayout(right); redPanel.add(redLabel); redPanel.add(red); add(redPanel); i get this message when i try to compile it: ColorSlide.java://lines 20 26 and 32; cannot find symbol symbol : method SetPaintLabels(boolean) location: class javaxlswing.JSlider //red, green, or blue.SetPaintLabels(true); ^
|
 |
Allan Newman
Greenhorn
Joined: Mar 06, 2006
Posts: 10
|
|
|
Sorry about this double post but there was some things wrong in the other one. The ^ on the last line is supposed to be right under the first period.
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14669
|
|
|
SetPaintLabels should be setPaintLabels.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Allan Newman
Greenhorn
Joined: Mar 06, 2006
Posts: 10
|
|
ah thank you, but it now has 2 errors, and does compile. the errors: ColorSlide.java:87: background is not public in java.awt.Component; cannot be accessed from outside package comp2D.setColor(background); ^ under b on background and ColorSlide.java:92:background is not public in java.awt.Component;cannot be accessed from out side package background = newBackground; ^ under b on first background when i compile it i get this error message: Exception in thread "main" java.lang.NoSuchMethodError: main
|
 |
Allan Newman
Greenhorn
Joined: Mar 06, 2006
Posts: 10
|
|
|
Sorry again for the double post, but at the end i meant once i try to run the class file
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14669
|
|
|
You have to use getBackground and setBackground.
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14669
|
|
About the runtime error, make sure that the class containing the "main" method is in your CLASSPATH. About the classpath: http://faq.javaranch.com/view?HowToSetTheClasspath
|
 |
 |
|
|
subject: Help with colorslide
|
|
|