35,618 Topics
![]() | |
[CODE]import java.io.*; import java.util.Date; import java.util.Random; class Clock { static long now() // returns the current time in miliseconds { return (new Date()).getTime(); } } class IO { static int readInt() { String input = ""; try { input=(newBufferedReader(newInputStreamReader(System.in))).readLine(); } catch (java.io.IOException e) { System.out.println("Error while reading"); } return Integer.valueOf(input).intValue(); … | |
The assignment is to complete the implementation of a group of files that create and test a binary search tree. It takes in 2 text files of integers, creates a tree with the first and uses the second to compare to the tree and tell whether of not each integer … | |
I can do it with a JLabel or a JButton, but can't figure out how in a JTextField. I thought I had found it (txtLonDay.setHorizontalAlignment(JTextField.CENTER)), but that doesn't work the way I want. I want all text entered in the field to be centered, and also all text that is … ![]() | |
Hello everyone, I am trying to create GUI for a given chat client below but I am having trouble starting it off.... I'm not quite sure if I should create a frame or to extend Applet inside so I can create the GUI if i can get any input it … | |
Hey i have a program that i need to write where a user has to enter 3 names and then my program has to spit them back in alphabetical order. i know how to display the answers i just dont know how to code it to get the answer :/ … | |
I have a orpaned case error and im not sure where i am missing anything. Probably just needs another set of eyes to find it. thank you in advance Here is the error code : C:\Users\winte497\Documents\FSMValue.java:109: orphaned case case 6: if ((ch >= '0') && (ch <= '9')) Here is … | |
I need to clear the output console buffer from within java on a windows console. I was thinking of a batch call to "cls" how can this be achieved? [CODE]public static void cls(){ //clear the screen pretty please! }[/CODE] | |
Hey guys! So, created a File Chooser that gets a picture. And I want the program to display the picture on the jFrame. How can I accomplish this? I'm using NetBeans, and I'm still kinda new to it :P Thanks guys! :D Here's my code: [code] import java.awt.image.BufferedImage; import javax.imageio.ImageIO; … | |
Hey, I've been recently coding a java program for the High Low dice game. I'm absolutely sure of my logic in that I know what i have to do, it's just executing it. Methods and how to call them are my main crux. I'm stumped at the moment, and I'm … | |
Hi, I am suppose to run a for loop into an array of 26, 6 times. The point is to gather the six largest numbers and put them in ascending order. I have been trying everything for this and cannot come up with a solution. The directions I am given … | |
![]() | Hello people I have a JFrame which container is a JPanel: can you give me a piece of code that shows how to create a grid of rectangles ? I need this information for my poject Thank you ![]() |
I am trying to learn more about using HashMaps in java. I would like to write a program that searches through a list of jumbled words from one text file and returns the unscrambled word(s) from another text file. Any suggestions how to do this? | |
![]() | The code I pasted is for a school assignment where we have to calculate the monthly payment for 3 different loans, with varying interest rates, and then display some information about each payment for each of the 3 loans. My code compiles and runs fine (not finished commenting all the … ![]() |
How do we compile on top of Java Virtual Machine.Could you guide me on how the JVM works. | |
Okey , This is suppose to be a chat and server program and I am down to the last part but I cant seem to figure this out. I Use the JtextField to get the Input from the user and it is suppose to hold it until the sent button … | |
Hello everyone! Once again I need some help on this program. I need to write a program that reads integers, finds the largest of them, and counts how many times that number occurs. The program should end when 0 is input. My teacher gave us a hint, incase this helps … | |
I've gotten the basics of insertion code but I'm stuck on how to compare it with another condition other then (list by A-Z, Z-A) for the example a list of staff ranks were given : [CODE] public static final String[] staffrank = { "Trainee", "Junior", "Senior", "Administrator", }; [/CODE] I … | |
Hello. I have a piece of code currently where I have a JFrame that I have removed the title bar and borders etc from using .setUndecorated(true). I have tried a number of ways with no success to make this window draggable by it's client area. [CODE] JFrame f = new … | |
I was given a client and server and I have to create a gui for it. I have done the entering part using the JTextField and the problem is getting the output of the class to go to JTextArea. (Its a Client server simple chat program) Here is the set … | |
Hi I have a String as "ABC("zscxfdb") OR DEF("ghg5dfg5") OR GHI("sdghrhrhr"). I should take the String present inside DEF() alone.. Can anyone help me in this.. Thanks in advance... | |
My project is to write a Temperature class. In addition to converting between Celsius and Fahrenheit also include Kelvin. The class has read(), add(Temperature), subtract(Temperature), multiply(Temperature), divide(double), equals(Temperature), toKelvin(), toFahrenheit(), toCelsius(), and toString() methods. Methods add, subtract, multiply, and divide all return a Temperature. [CODE] public class Temperature { public … | |
![]() | Ok, I have absolutely no idea what is going on for my compiler errors. I am not worried about the last part where I have to put in the letter code. I am just trying to figure out how to make this compile correctly for line 43 to work. I … ![]() |
Hey so i have a class that extends a JFrame with an image of mickey mouse and a piece of cheese. I have made it so the user can control Mickey and I want to have it so that when he touches the boundaries of the cheese a YOU WIN … | |
i need help with my code here is what I have import java.util.*; public class Payments { private double myLoan; private double myInterest; private double myPayment; public void Payments() { Scanner pay = new Scanner(System.in); System.out.print("Principal Loan = $"); myLoan = pay.nextDouble(); System.out.print("Annual Interest Rate(%) = "); myInterest = pay.nextDouble(); … | |
Hi, I am working on client authentication(in a sample JSP application) using certificates. I have written a code to extract the client information from the client certificate. Now I wanted to use certificate's serial number to identify the particular use from the database. I extract the serial number using [CODE]<%= … | |
The below program works fine, but I want to add data exception using try and catch, can anyone please help how and form where I can start it? [CODE]import java.util.Scanner; public class ElseElseIf { public static void main(String[] args) { int number1,number2,number3,number4,number5; int largest, smallest; int twoDigitNumbers = 0; int … | |
Do you have any ideas of how to bring Swing to a web site? Not use applet, but Swing only. Any sample code is appreciated. MyDreamGirl | |
Hi there, So I'm given a programming problem for a class, and here's what's given: An n x n game board is populated with integers, one nonnegative integer per square. The goal is to travel along any legitimate path from the upper left corner to the lower right corner of … ![]() | |
I instantiate a class called Company where I have a lot of the logic of my system, I'm unsure about what visibility the following objects should have.... [CODE] public class Company { private Scanner input = new Scanner(System.in); private Employee[] employee = new Employee[100]; private Job[] job = new Job[100]; … | |
I have been asked to create a method to merge two LinkedList. I am allowed to use only the following methods: From LinkedList: > addLast(E); > size(); From ListIterator: > E next(); > boolean hasNext(); > E previous(); > void remove(); The first list (list1) points to 2,6,7 The second … |
The End.