Hi all, I'm trying to write code so that when a button is clicked, a JColorChooser pops up. For some reason, the code I wrote i snot working and I can't figure out the reason. Any help would be greatly appreciated thanks.
[CODE]
private static JButton changeColorButt on = new JButton("Change Color");
private static JButton loadButton = new JButton("Open") ;
public void actionPerformed (ActionEvent...
User Profile
Collapse
-
Setting JColorChoose to a button
-
Drawing Images
I have a picture(a map) drawn to a panel using a BufferedImage and I want to draw circle on different parts of the map. I'm using a Graphics object to draw the circles onto the map but everytime I call the repaint function, everything I've drawn on the map disappears. Really need help with this. The following functions are the functions that draws the map unto the panel and the function that draws the images unto the map. Am I doing something wrong... -
nevermind, figured it out -
Updating a JLabel to a JPanel
I have a method addPlayer that's supposed to add a JLabel to a JPanel and update the JPanel. The JLabel is just a label with a player's name in it. The code I've wrote doesn't work and I'm not sure why. Any help would be greatly appreciated
...Code:int playerCount = 0; private void addPlayerButtonActionPerformed(java.awt.event.ActionEvent evt) { String name -
waiting for a mouse click
Really need help with this one. I'm writing a program to simulate a Risk game and I need to write a method to make two countries neighbors, which would be done by adding each the neighbor country to each country's neighbor's array. To do this, I will need to click on the country, click on the map and then click on the other country. My method gets the country's name but how do I tell it to wait for a mouse click before trying to get the second country's... -
Displaying images in Java
I'm kinda new to programming but I usually figure things out by myself but I need help with this. I'm trying to display an image in the Center region of a JFrame and other icons/button in the other regions. So far, I have this:
[code=java]
public class RiskFrame extends JFrame implements ActionListener, MouseListener{
private BufferedImage bImage;
private Image image;
private JPanel...
No activity results to display
Show More
Leave a comment: