35,618 Topics

Member Avatar for
Member Avatar for cutedollpisces

[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(); …

Member Avatar for masijade
0
286
Member Avatar for billingsj09

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 …

Member Avatar for NormR1
0
765
Member Avatar for ecyarter

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 …

Member Avatar for hfx642
0
6K
Member Avatar for cRazy604

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 …

Member Avatar for cRazy604
0
236
Member Avatar for Java4A

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 :/ …

Member Avatar for NormR1
0
92
Member Avatar for chriswinter

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 …

Member Avatar for chriswinter
0
196
Member Avatar for Labdabeta

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]

Member Avatar for thines01
0
113
Member Avatar for spades0001

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

Member Avatar for mKorbel
0
246
Member Avatar for NeoSyn

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 …

Member Avatar for NeoSyn
0
280
Member Avatar for Snipererer

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 …

Member Avatar for NormR1
0
97
Member Avatar for begueradj

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

Member Avatar for begueradj
0
2K
Member Avatar for coolsport04

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?

Member Avatar for thines01
0
279
Member Avatar for buchanan23

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 …

Member Avatar for buchanan23
0
250
Member Avatar for champion123

How do we compile on top of Java Virtual Machine.Could you guide me on how the JVM works.

Member Avatar for masijade
0
48
Member Avatar for ricedragon

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 …

Member Avatar for harinath_2007
0
234
Member Avatar for yoshio5908

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 …

Member Avatar for zeroliken
0
608
Member Avatar for shiroshiro

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 …

Member Avatar for shiroshiro
0
107
Member Avatar for bops

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 …

Member Avatar for JamesCherrill
0
2K
Member Avatar for ricedragon

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 …

Member Avatar for ricedragon
0
451
Member Avatar for Narayanan87

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

Member Avatar for Aviras
0
86
Member Avatar for dsoto

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 …

Member Avatar for dsoto
0
173
Member Avatar for krejar

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 …

Member Avatar for krejar
0
770
Member Avatar for jhamill

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 …

Member Avatar for teo236
0
122
Member Avatar for fender

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

Member Avatar for zeroliken
0
698
Member Avatar for 650U

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

0
192
Member Avatar for maverick420

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 …

Member Avatar for stultuske
0
150
Member Avatar for mydreamgirl

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

Member Avatar for NormR1
0
340
Member Avatar for dark_sider_1

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 …

Member Avatar for hfx642
0
282
Member Avatar for asif49

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

Member Avatar for asif49
0
119
Member Avatar for kyriacos1986

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 …

Member Avatar for kyriacos1986
0
441

The End.