32,204 Topics
| |
So I'm trying to make a lottery program which outputs up to 6 sets of 6 random numbers using only 2d arrays and arrays for my project. No arraylists are allowed. Here is what i have so far, but it's not running because I don't have a main file?. Someone … | |
Hi all, I'm new to java and here is my code. It runs, but the output is not what I wanted. This project allows the user to enter up to 6 lottery tickets and I have to generate random numbers 0-49. The number generate fine, but the number of tickets … | |
| I just started learning java a week ago, and I'm trying to make my first program - a simple grade calculator for a class I'm in - and I can't get it to compile for the life of me. I've finally gotten it down to one error ("Comp202Grader.java:60: variable letterGrade … |
Hi guys, I was supposed to create a program that simulates a haunted house. the output was supposed to be like: Welcome to the Haunted House! You are in: Front Foyer Possible directions are: North(N), East(E), West(W), Abandon(A) Where would you like to go? s Invalid Command You are in: … | |
Hi, I was asked to create a program that converts a .csv (I converted it to a .txt format first) and I've put together a pretty basic one that reads the data in the text file and formats it into XML, then saves it as a .xml. By basic I … | |
Good day! I would like to ask on how to transfer the contents of JTable to mySQL database. I have seen a lot of codes of putting contents to JTable from database but I need to know the other way around. ^^" I do not have any idea on how … | |
| |
This is an attempt to stop the timer in this code: [Click Here](http://www.daniweb.com/software-development/java/threads/422817/how-do-i-stop-this-timer#post1805134) I just learned threads but I'm not sure if I'm using it right.. It doesn't have any erros when I compile it.. but it still doesn't stop the time. the clock starts when you enter "y" though.. … | |
OK, hello guys. I'm trying to make an image fit a JPanel. What I mean is to set a maximum size on a image, depending on how big the JPanel is. I'm using a JSplitPane to show some images. On the lef side I'm using a JList, and on the … | |
WHEN I put void in this method.. it says *"void type not allowed here"* in my if statement. but when I erase the void in my method.. it says *error: invalid method declaration; return type required* in the method... what should I do? public void setStop(int day , int hour … | |
import javax.swing.JPanel; import javax.swing.ImageIcon; import java.awt.Image; import java.awt.Graphics; import java.awt.Graphics2D; class View extends JPanel { Image icon1,icon2; public View(){ ImageIcon i1=new ImageIcon(this.getClass().getResource("tile1.png"));//image I drew ImageIcon i2=new ImageIcon(this.getClass().getResource("tile2.png"));//image I downloaded icon1=i1.getImage(); icon2=i2.getImage(); } public void paint(Graphics g){ super.paint(g); Graphics2D g2=(Graphics2D)g; g2.drawImage(icon1,10,10,null);//this image is not displayed g2.drawImage(icon2,200,200,null);//this image is displayed } } … | |
Plzz can someone help me where can i found good tutorials on xmpp using java | |
Hi, I'm a new java user, working on a brute-force knights tour algorithm in linkedlist. The move function worked perfectly (for a while), I mean, the pointer could move forward, or backward if a wrong path was chosen. But all of a sudden, it returned me a stackoverflow error. i'm … | |
I am trying to sort an ArrayList of Strings using the Merge Sort algorithm. However, I am having an error where it occurs on line 67 **`result.set(i,right.get(r));`** Where I get the IndexOutOfBoundsException. I have tried printing out the index of the result, and it seems to be that I am … | |
Please i've got problems reading from a recordstore(does not return any results when it reads any index beyond d deleted index) after calling the delete method with a specified index. Can anyone help? | |
Hello guys, i have a question regarding how to change the origin of a window, particularly a JFrame. I'm essentially running a program called "Fraps" to see the frames per second of my JFrame, with this program, you can display the fps on any 4 corners of the window currently … | |
Can someone please help me "write a drawTree method for the Turtle class" I am given the following information: World w = new World(); Turtle t = newTurtle (320, 480, w); The turtle will begin at the middle of the bottom of the World, facing North. Use the drawRectangle method … | |
When I am trying to design an algorithm , I had a programming problem in Java .. I want to write M nested "for" like that: for (I[0]=1; I[0]<=N; I[0]++) for (I[1]=1; I[1]<=N; I[1]++) ... for (I[M]=1; I[M]<=N; I[M]++) { Statements; } Where M is entered by the user during … | |
I m trying to create hello world example using rmi but till not succeeded.I got error in server file "Server Error java.rmi.ConnectException: Connection refused to host: 192.168.1.5; nested exception is: So please help me out. public class Server implements Hello { public String sayHello() { return "Hello World!"; } public … | |
I have created an application which puts all the images at a user defined location in a rtf document. The code is working fine and the images are getting inserted. However, if I open the document and add some text manually and save the file, the file size increases dramatically. … | |
I have this annoying problem: I am filling a HashSet out with Road objects, only doing so to avoid duplicate elements. However, the output from lines 81 though 95 shows that the set contains duplicate elements. Sorry for the messy code, this is a pretty ad-hoc sollution, in addition to … | |
I'm doing an actually simple practice problem from the book, but I am still not sure how to correctly do it.. It's just converting pseudo code. 1st part > num SIZE = 5 > > num VALID_ITEM_PRICE [SIZE] = 0.59, 0.99, 4.50, 15.99, 17.50, 39.00 > > stack int validItems … | |
How can I keep the lines that have been drawn previously after calling repaint() this is my paintComponent public void paintComponent( Graphics g ) { graphics2D = (Graphics2D)g; graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics2D.setPaint(Color.white); graphics2D.fillRect(0, 0, getSize().width, getSize().height); graphics2D.setColor(Color.black); } I've another method public void show_line(line a) { graphics2D=(Graphics2D)this.getGraphics(); for(int i=1;i<a.getLine_segs().size();i++) { Point … | |
import javax.swing.JFrame; public class MainApp { public static void main(String[] args) { new MainApp().start(); } public void start() { CalculatorUI obj = new CalculatorUI(); obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); obj.setSize(275,275); obj.setVisible(true); } } import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextField; public class CalculatorUI extends JFrame { //Variables. … | |
I am basically trying to make a TicTacToe game in Netbeans GUI builder. I have nine(3x3) buttons to show a grid for the game and that's where you mark X and O's. I want to make it one player game. I wanted to know how to make an array of … | |
I have a jsp page which has post comment box. I have written a servlet which takes a comment from the text area for the comment box and writes the comment to the database and redirects all the comments stored in the database to the page for display(using request dispatcher). … | |
Hi, I created an application which allows a user to capture screenshots and save them as images at a pre-defined location. Now, I want to insert the saved images to a word document. I am aware of Apache POI, but that is still under development and it seems that you … | |
am trying to add images to a rtf document. I am able to add images to the document but I can't append any images. This means that when the 2nd Image is added, the first image is removed. I think that whenever the code is executed a new rtf document … | |
Hey everybody, New to the java scene and having major issues, it would be appreciated if someone could have a look at my coding and see where i'm going wrong. I have a few 1. When i press the 'start new game' button the random number resets but not the … | |
I am new to programming, I am trying to learn how to program in Java through some old programs I found online, and yet I seem to be struggling. This is the program I wrote to fill a linked list with 10 numbers using a loop and then just printing … |
The End.