32,204 Topics

Member Avatar for
Member Avatar for zyaday

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 …

Member Avatar for JamesCherrill
0
117
Member Avatar for Darkmeerkat

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 { // ... …

Member Avatar for JamesCherrill
0
140
Member Avatar for bokz06

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 …

Member Avatar for JamesCherrill
0
2K
Member Avatar for c3lolle

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 …

Member Avatar for c3lolle
0
137
Member Avatar for squinx22

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) …

Member Avatar for JamesCherrill
0
86
Member Avatar for ice_cool

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 …

Member Avatar for kvprajapati
0
1K
Member Avatar for anandarju

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

Member Avatar for kvprajapati
0
91
Member Avatar for lkw8888

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 …

Member Avatar for JamesCherrill
0
92
Member Avatar for cool_aj

[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" …

Member Avatar for verruckt24
0
91
Member Avatar for matrix2

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 …

Member Avatar for ithelp
0
350
Member Avatar for codeman01

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; …

Member Avatar for llemes4011
0
132
Member Avatar for C41R0

[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 …

Member Avatar for quuba
0
124
Member Avatar for K?!

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 …

Member Avatar for BestJewSinceJC
0
127
Member Avatar for grisha83

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 …

Member Avatar for hardik.rajani
0
332
Member Avatar for functionalCode

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 …

Member Avatar for BestJewSinceJC
0
110
Member Avatar for grisha83

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 …

Member Avatar for BestJewSinceJC
0
120
Member Avatar for llemes4011

What are beans? I've seen references to them, but when looking up an explanation, I always get lost and confused.....

Member Avatar for JamesCherrill
0
39
Member Avatar for kadamati

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. …

Member Avatar for abbie
0
102
Member Avatar for lkw8888

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 …

Member Avatar for lkw8888
0
248
Member Avatar for rudypooh786

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 …

Member Avatar for verruckt24
0
141
Member Avatar for AirmanTheGreat

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. } …

Member Avatar for AirmanTheGreat
0
172
Member Avatar for freddiecool

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

Member Avatar for Ezzaral
0
212
Member Avatar for number87

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 …

Member Avatar for BestJewSinceJC
0
2K
Member Avatar for ramborambo

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 …

Member Avatar for BestJewSinceJC
0
126
Member Avatar for gabec94

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 …

Member Avatar for gabec94
0
244
Member Avatar for puk

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 …

Member Avatar for BestJewSinceJC
0
86
Member Avatar for jrobw

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 …

Member Avatar for quuba
0
388
Member Avatar for ramborambo

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 ] = …

Member Avatar for ramborambo
0
261
Member Avatar for giri.pankaj

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 …

Member Avatar for iamthwee
0
1K
Member Avatar for TaubBaer

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 …

Member Avatar for TaubBaer
0
544

The End.