I know it's not good practice but I am trying this code out:
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;...
Type: Posts; User: Vic45
I know it's not good practice but I am trying this code out:
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;...
Could I do a setColors getter/setter and set them all that way? Or is it better individually like setRed??
I am trying to change them individually (not all three values at once) because I actually need them to get values from a JTextField. The radio buttons were just training wheels and I have failed. :( ...
I'm having trouble with that then.
public int getRed() {
return COLOR_RED;
}
public void setRed(int red) {
this.COLOR_RED = red;
Ok, I see what you are saying. Within the "user interface" (The code with the radio buttons) I can put this for the red radio button:
paintPanel.myColor = new Color(200, 0, 0); So I am really...
OK, sure. I am trying to use setRed, setGreen and setBlue to set the corresponding values of COLOR_RED, COLOR_BLUE, COLOR_GREEN which controls the statement that sets the color for the rectangle,...
Are you confused with what the program is trying to do?
So I am trying to set COLOR_RED, COLOR_GREEN or COLOR_BLUE to any user-set value between 0 and 255. No they are not getting changed. Basically...
Ok, here is the rest of it:
(I will change the variable name c in my code, thanks)
import java.awt.Color;
import java.awt.Graphics;
Ok:
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.util.ArrayList;
My idea is that whatever value (between 0 and 255) is input with either of the 3 categories of R,G, or B. So I need to set the RED to user defined, green and blue as well.
When I try to use my...
Ok, that makes more sense, thank you. What about changing the color? Am I calling the getters/setters or something incorrectly?
I'm not getting errors now. I am trying to set the color from a different class than where this code is: (This situation confuses me often)
I can set them manually, like below with green = 100 to...
Ok, so your code verbatim worked. I was trying to use stuff like Color.c and getColor(c) It works fine with just c as the final argument. Thank you for that.
One more problem - setting the...
It was actually commented out. So I know I need something like this: Color c = new Color(255, 0, 0); for red, correct? But putting that into my code:
drawingShape = new Rectangle(e.getX(),...
Hello. So I am making a small "paint" program in java as a GUI. I have most of it done but one thing is giving trouble. I need to be able to set an RGB value from one class to another. I have tried...