32,204 Topics
| |
I have two classes in here..One extends from a Jpanel , it is where I do all the paints and staffs on my screen. The other one is just a class. But in that class I want to define a draw function..say public void draw(Graphics g){ g.drawImage(image,100,100,30,30,?????); } Now, I … | |
In the course of writing some throw-away code, I ran into a weird problem with static methods. I've defined a static method that's supposed to return a [icode]Double[/icode], but Java insists that it's returning some new type named after the function. Static method: [code=java] public class Temperature { // ... … | |
problem i'm having is getSelectedRows() and getSelectedColumns().... they dont return anything when i select the rows. am i doing it wrong? i need it so when the button is pressed to output the selected strings[] [CODE]import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.*; import javax.swing.table.AbstractTableModel; import java.io.*; import … | |
Hello! I've been given the task to write a program in java that is going to capture audio from a flash-application on the web. The flash-application is a music application where you can make your own song and then click a button to make it into a sound-file. The flash-application … | |
Hello all! I have some troubles in saving a file by byte chunks, (will use in saving large file size.). My goal is to chunk the file bytes first into a certain size before writing. I have this code: [code=java] FileConnection fc = (FileConnection) Connector.open("file.ext", Connector.READ); InputStream fis = (InputStream) … | |
Hello, I am currently doing an assignment which requires the use of hashmaps. The game is called "zuul" which is a text based game. A player class can pick up and drop items and if an item is picked up, the item is taken away from the rooms hashmap and … | |
I need to know how to access two tables which has some reference values within the table.I need the Java Code to Fetch Both the tables values which are same and have to display it | |
Timeout doesn't work properly.. is there any problem? with my source.. These are relevant source for the TimeOut Thread.. [code] /////////////////////////////////////////////////////////////// public ChatJin() { //Find Local IP Address & Name try { InetAddress myInet=InetAddress.getLocalHost(); System.out.println("My InetAddress "+myInet.getHostAddress()+" name "+myInet.getHostName()); } catch(UnknownHostException e) { System.out.println("InetAddress Error on Port "+8000+" Error code … | |
[code=java] import java.util.*; public class Coin { private Random randomNumbers = new Random(); // flips a coin many times public void flipCoins() { Scanner input = new Scanner( System.in ); int heads = 0; int tails = 0; int choice; do { // display a menu System.out.println( "1. Toss Coin" … | |
24.21 (Modifications to the Multithreaded Tic-Tac-Toe Program) The programs in Fig. 24.13 and Fig. 24.15 implemented a multithreaded, client/server version of the game of Tic-Tac-Toe. Our goal in developing this game was to demonstrate a multithreaded server that could process multiple connections from clients at the same time. The server … | |
assistance with the following code: 1. package triangleMod; 2. import java.awt.Dimension; 3. import java.awt.Frame; 4. import java.awt.Point; 5. 6. import javax.swing.JFrame; 7. 8. 9. public class Main extends Frame{ 10. 11. static Point a; 12. static Point b; 13. static Point c; 14. static Triangle tryAngle; 15. static JFrame frame; … | |
[CODE=Java] package ce.ass2; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.logging.Level; import java.util.logging.Logger; import ce.board.Board; import ce.board.MoveData; import java.awt.Color; import javax.swing.JButton; public class TickerBean extends JButton implements java.io.Serializable{ int timeDelay=500; private LifeBean lb=new LifeBean(); private Board tickerBoard; private javax.swing.Timer t = new javax.swing.Timer(timeDelay, new ActionListener() { public void actionPerformed(ActionEvent e) { try … | |
Hi all I'm having trouble using panels in a GUI. I created panels for steps through a programme. Like when you're installing something, you click "Next" and the GUI switches to the following step. So for each of these steps, I've created a JPanel. But I was wondering, how can … | |
Hello, I am working on the problem. Here is the wording: 6) Specify, design and implement a class that can store an array of integer. The number of Maximum element can be 100. Write methods to : a. Add an integer at the beginning of the array b. Add an … | |
I'm working on a program to upload some files to an ftp. I created a thread the starts the upload when the upload button is pushed. When the upload button is pushed the GUI freezes because it is uploading. What change would I have to make to get the GUI … | |
Hello, I was reading a book and it says that when we want to add new Node that is not in the Head we have make a selection i.e. selection.addNodAfter(element), before we initiate our method. The question is where do i have to do this "selection"? in my main or … | |
What are beans? I've seen references to them, but when looking up an explanation, I always get lost and confused..... | |
hi i have a problem with my java program.i can compile and run the java program if i keep them in jdk\bin folder, but i can only compile and can not run if i kept the java program in any other location. can anyone tell me where i'm doing wrong. … | |
This is chatting program using etherframe packet. I finished crc, gui , making packet and sending packet. but I can't implement stop and wait timeout resend... I can't implement it.. can anybody help me? import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import java.io.*; import java.net.*; public class ChatJin implements … | |
Write a Java application that creates an array of int initialised with the following numbers: 1 4 9 16 17 21 25 33 37 40 and reverses the contents of the array such that the value in the first element is the value that was at the last element and … | |
Hello, I seem to have encountered a problem with this code. [code=java] try { String changeC1 = JOptionPane.showInputDialog (null, "Change the dimensions of silo 1? (y/n)"); } catch (NullPointerException e) { String changeC1 = "n"; // probably also be a good idea to log the fact an exception occured. } … | |
Hi, i made a calendar program but now i need to import- export my events with iCal/vCal, any ideas on how to go about. I cant find any tutorial or documentation on it | |
I am doing a game and I need to reset the graphics back to its original picture once a new game begins, however when I click the new game button, everything else resets but the graphics do not even though I called repaint. I have included the code for my … | |
Hey need lots of help on arrays! this is the exercise... 1. Write a Java application that creates an array of int initialised with the following numbers: 1 4 9 16 17 21 25 33 37 40 and reverses the contents of the array such that the value in the … | |
hi! i have written a program that takes a random number from 0-999, 10000 times. I have the program calculating how many times each number comes up randomly, and finds the mode. But my program doesn't include how to find multiple largest numbers, ex. 2 and 4 each come up … | |
Hi, I have a line chart that iv created using jfreechart. The graph has six lines.when the graph comes up, there are no lines on it.This is delibrate. Iv also made six check boxes. The problem i have is that when the check boxes are checked, the lines are supposed … | |
hi! i have to write a gui window, which draws sierpinskys triangle recursively, i have one main class: [CODE]package triangleMod; import java.awt.Dimension; import java.awt.Frame; import java.awt.Point; import javax.swing.JFrame; public class Main extends Frame{ static Point a; static Point b; static Point c; static Triangle tryAngle; static JFrame frame; private static … | |
Hey guys! i need help on reversing numbers in descending order. public class ArrayExercise1 { public static void main(String[] args) { int[] values = new int[10]; values[ 0 ] = 1; values[ 1 ] = 4; values[ 2 ] = 9; values[ 3 ] = 16; values[ 4 ] = … | |
Have written an unscrambler in java. This takes in a scrambled word for input and returns the unscrambled word. The way it works is that it creates all permutations of the provided word (I have borrowed the permutation generating code from daniweb i guess) and compares each word to an … | |
I had been creating 5 files and I kept hitting the wall. Hope that you will be able to help me pinpoint the problems. (I am not an programmer by the way.) I had been researching for more details on those problems, no luck. Enclosed are 5 files that I … |
The End.