I've got my clear button to work on most of the stuff I want, however I cant figure out how to fix the price to stop adding up. e.g. hit a button image with a price of 599.99, hit the clear button to empty, select price of 599.99 again then it display 1199.98.
I'm back with a question about the Black Jack assignment. I've created a working game that works for one round, as well as a reset button that's able to clear the board of the old hand. However the runGame() loop, which checks whether a player has played his hand seems to freeze the program the second time around
private void initNewGame(){ dealer.addCard(); for(int i = 0; i < numberofplayers; i++){ players[i].addCard(); //draws card, adds score and paints card to the board players[i].setStatus(false); //makes the buttons usable in the players[] class
[Code] .....
I know it's probably not optimal having an while loop constantly running to check the status, but I can't seem to figure out why it freezes.
My issues is at the bottom, I can't get the clear button to clear, well it clears but it also show the JOptionPane. I couldn't find the edit button on the page
I want to add a picture to my buttons. The end statement will be a path finding algorithm that will with show the picture on all the buttons on the shortest path. I am using a constructor at the moment passing a picture object to it. It is suppose to work but its not on line 30...
Java Code:
import java.awt.Color; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.*; public class Screen implements ActionListener { public JButton[][] b=new JButton[20][20];
Can I add actionListener to a button component without creating a reference to it? Look at my code below:
public void init() { setBackground(Color.red); //Create the layout setLayout(new BorderLayout(20, 5)); //Add buttons add("North", new Button("Red")); add("South", new Button("Yellow")); add("East", new Button("Cyan")); add("West", new Button("Magenta")); add("Center", new Button("White")); }
Or should I just do the usual instance.addActionListener(this) like myButton.addActionListener(this)?
import javax.swing.*; import java.awt.event.*; public class menu { public static void main (String[] args){ JFrame frame = new JFrame("Menu"); frame.setVisible (true);
I want to add a button who refresh the tree the problem that i have not "DefaultTreeModel" in my class to do this ((DefaultTreeModel) jTree1.getModel()).reload(); and i try this jtree.updateUI(); but not work ....
I have a code that clear old text then add new text to text file afterthat download the file but the problem my code dose not add new text
FileInputStream fileToDownload ; private static final int BYTES_DOWNLOAD = 1024; response.setContentType("text/plain"); String name = request.getParameter("n"); String text = new String(request.getParameter("text").getBytes("iso-8859-1"), "UTF-8");
[Code] ....
How to clear old text then add new text to text file
import javax.swing.*; import java.awt.MenuBar; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class NewCalculator implements ActionListener { //assign button clicked number and answer onto variables.
[Code] .....
Also what is the code I need to use to do the percentage and square root calculation in the calculation. Cos I am not sure about the sign I am required to use to do the calculation.
The if statement is where the code to make the clear button (C and CE) work.
Follow the //? FIRST and SECOND notes, then I understood that Java has GOTO as Keyword for future versions and that usually one can avoid GOTO using break inside the cycles, but I need a jump( salto) in the code.
import java.util.Scanner; public class ArrayOrdinati { public static void main (String[] args){ int[] Array = {5,3,1}; int e=Array.length; int b;
I have 5 radio buttons in my gui, I have a reset button which I have resetting everything else but now I am looking to remove the dot from the selected RB when you press the reset.
why CLEAR button not sweeping text(I tried t1.setText(null);, but it not working. And second, in SAVE button is same problem, it is not working. I want it to saved text go to SAVED frame. What i need to write.
public class panabut { public static void main(String[] args) { JFrame f = new JFrame("Buttons"); f.setSize(400, 400); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(f.EXIT_ON_CLOSE); f.setVisible(true); JPanel p = new JPanel(); f.add(p); JButton b = new JButton("Register");
I am making a shopping cart web, but some problems I meet about how to calculate the total price
I use ajax in product list web and if I choose one product , it will send the Id that I read from MySql to servlet and use session to save it . and I click the button jump to the cart, the page cart.jsp will read information from session ,and find product information from mysql by id , now my question is where I calculate the total price, servlet or jsp?
I am trying to clear all graphical objects of a certain type(all trees in particular). I have never had any issues doing so, and this method normally works well along with these variables:
Java Code:
public static ArrayList<GRect> historyT; public static ArrayList<GOval> historyL; public static GRect trunk; public static GOval leave; public void deleteTrees() { //clears all tree trunks and leaves
[Code]...
That is this normally worked until I started added more trees to the screen after they had all been erased. What happens is that it won't clear all of them unless the max has been reached, that is 6. It will remove all trees up till the last one if the max has not been reached. In other words here is my screen before the clear all if the max has not been reached(* is a tree, _ is erased): ****
Here is it after: _ _ _ _ *
So my question is, is why aren't all the trees deleted? Why does it leave one left behind?