32,199 Topics

Member Avatar for
Member Avatar for blackrobe

I have a Set that contains different random lines from a text file, now I'm new to Java so I don't know much about the methods available but I have tried using the java.util.Set.toArray() method but it returns an Object[] than can not be sorted. Is there anyway to do …

Member Avatar for quuba
0
146
Member Avatar for 3pid

hey! I`m a beginner in Java and I want to write a program that use try and catch method to send a msg if the average it calculate is not in [0-20] I have already write this code but it always print 0! what is wrong with my code?!!! [ICODE]using …

Member Avatar for 3pid
0
97
Member Avatar for Alishaikh

I made this applet for my APCOMPSCIA class, it due tomorrow but I cant get it working. I need to show the animation of a sort, but it just does sort once that it, please help. I will be very great full. [CODE]import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.util.Random; …

Member Avatar for stephen84s
0
79
Member Avatar for britto

can anyone tell me the code how to create a textpane with scrollbars inside a tabbed pane.....and i should save the text in a file on button click....

Member Avatar for britto
0
584
Member Avatar for faisaly
Member Avatar for ciarz3r

[code=java] import java.util.Scanner; import java.util.regex.*; import java.io.*; import javax.swing.*; /** * A program that parses a user-supplied URL */ public class URLParser { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); PrintWriter out = new PrintWriter(new FileWriter("D:\\cs2200\\lab8\\URLs.txt")); String input=""; // Everything works the way I …

Member Avatar for stephen84s
0
108
Member Avatar for AllenB

Hello, I am creating a client/server application that verifies math equations for addition, subtraction, and division. I think I just need someone else’s eyes to possibly see where I am going wrong with this. Everything seems to be working fine except for one variable. This is the String serverAnswer variable …

Member Avatar for AllenB
0
137
Member Avatar for nellyznell

I have all my code for this. I have the code to read a txt file, write a txt file, convert the infix to postfix and evaluate it. I am now just having trouble putting it all together. I need it to read the text from a file convert each …

Member Avatar for nellyznell
0
641
Member Avatar for lordx78

[code=java] import java.awt.EventQueue; import javax.swing.JFrame; public class tatat extends JFrame { private static final long serialVersionUID = 1L; public static void main(String args[]) { EventQueue.invokeLater(new Runnable() { public void run() { try { tatat frame = new tatat(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public …

Member Avatar for ~s.o.s~
0
78
Member Avatar for denniskhor

[code] import java.io.*; import java.util.*; import java.io.IOException; import java.util.Scanner; public class Lab { public static void main(String[]args) { System.out.println("MAIN MENU"); System.out.println("<1> Bahasa Melayu"); System.out.println("<2> English"); System.out.println("<3> Exit"); System.out.println("Your selection (1,2 or 3)?"); Scanner read = new Scanner (System.in); int selection = read.nextInt(); if(selection == 1) { System.out.println("Hello, apa khabar?"); } …

Member Avatar for ~s.o.s~
0
766
Member Avatar for mabz_jean

Implement a subject scheduler using the topological sorting algorithm. The program shall prompt for an input file containing the subjects in the set and the partial ordering of subjects. A subject in the input file shall be of the form (number, subject) where number is an integer assigned to the …

Member Avatar for javaAddict
0
97
Member Avatar for l_03

[CODE] import javax.swing.*; public class A { public static void main (String args[]){ String ask = JOptionPane.showInputDialog("Enter"); if(ask.equals("hello")){ System.out.println("ok."); main(args); }else if(isRepeat(ask)){ System.out.println("Invalid,string has been repeated."); System.exit(0); } } public static boolean isRepeat(String ask){ if(ask.equals("hello")){ return true; }else{ return false; } } } [/CODE] Hello, I am having problems with …

Member Avatar for ahihihi...
0
172
Member Avatar for starsinthesky

i cant figure out what's wrong with my code. can anyone help me pls? [code] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class MyGUI implements WindowListener, ActionListener { public void windowClosing(WindowEvent e) { System.exit(0); } public void windowClosed(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowOpened(WindowEvent …

Member Avatar for starsinthesky
0
109
Member Avatar for ezkonekgal

In a queue, where elements in integers are added, how do i do this: Inside the queue: 1 2 3 5 6 8 when I want to add a number, say 4, the output should be like: 1 2 3 [B]4[/B] 5 6 8 in which it inserts in between …

Member Avatar for ezkonekgal
0
153
Member Avatar for llemes4011

Hi, I'm trying to program Tetris. The thing is, I can't seem to get the Keylistener to work in the JApplet, and I have no idea why :( Here's my code: [CODE=java] import java.util.Random; import java.awt.event.*; import java.awt.*; import javax.swing.*; /** * Class Tetris - write a description of the …

Member Avatar for llemes4011
0
317
Member Avatar for llemes4011

Hi, I'm working on an algorithm that solves a maze from the inside, and seeks out 1 of the 4 exits on the sides, and after getting 1, it goes to the next until it has them all. The maze is always 22x22, and you only have 400 steps. I …

Member Avatar for llemes4011
0
174
Member Avatar for jrdark13

I assume the drowpdown/layer menu is javascript simply because it has to wait until the entire page is loaded so that I can see the sub-options... I really wouldn't want it to be redone but sometimes at work I have slow internet and loading the page just pisses me off …

Member Avatar for Dani
0
156
Member Avatar for starsinthesky

how can you put spacing between objects? i mean, how can you place an object,e.g. a button, to the next line inside a pane? i tried setting the size (PaneSample.setSize(8,9)) of the pane and use flowlayout, but it wont work. can i get any suggestions from anyone? thanks! :)

Member Avatar for Ezzaral
0
95
Member Avatar for Peda

Hi! I am not that good in java and as a homework we had to write to classes: a partial abstract class Koerper and it's subclass Kugel but when I try to compile them the compiler always tells me this: [quote]Kugel.java:9: Kugel is not abstract and does not override abstract …

Member Avatar for Peda
0
172
Member Avatar for jrdark13

This is my assignment, before some of you complain, I finished it. It works all I want is something that is in the back of my head bugging me. If a user was to input a letter instead of a number how do I keep the program from crashing and …

Member Avatar for Antenka
0
136
Member Avatar for darylesha

I am trying to work out this issue in a molecular caluclator that I am trying to develop. I would like to go from mass to formula. So I am given a mass, ie 120.3433. And an equation could have up to 8 C, 3 H, 11 N, 6 S …

Member Avatar for diafol
0
115
Member Avatar for deola_lanre

pls help with a java program to simulate a bursary unit with emphasis on fees payment and verification, salary payment. you guys are gonna make my day.tnx

Member Avatar for PhiberOptik
0
216
Member Avatar for Infectme

Hello all! I am having a few issues with my code and after hours of endlessly searching Java help sites and Java forums, I decided to bring my issue to the table to receive some help specific to me, I am receiving the error 'Illegal start of expression' with the …

Member Avatar for javaAddict
0
116
Member Avatar for xlx16
Member Avatar for stultuske
0
99
Member Avatar for tmoney7566

been working on this for 2 days and can't figure out what I am doing wrong. We are suppose to input a day and the days gifts are to be in the output. When I put in my day it starts with the correct day but then loops through all …

Member Avatar for tmoney7566
0
105
Member Avatar for AllenB

Hello, I am having a problem writing to a file on a client/server application. I can send the data from a JTextArea to the server, it appears to read the text, but I cannot seem to get the server to write the data to the .txt file. Can anyone help? …

Member Avatar for Antenka
0
166
Member Avatar for bhowal_1981

command[0] = "cmd"; command[1] = "/C"; command[2] = "dir"; command[3] = "C:\\SomeDir"; Runtime rt = Runtime.getRuntime(); Process p = rt.exec(command , null , workDir); It is working fine. Here the executable command is "dir". Here p.waitFor() gives value 0. [COLOR="Red"]But if I give any other command suppose "rename *.doc *.rtf" …

Member Avatar for verruckt24
0
112
Member Avatar for navinlearns

I have been working on a program that Should Scan a small Subnet i.e for eg 10.1.1.1 to 10.1.1.255 with the subnet mask 255.255.255.0 I am attaching screenshots of the main screen of my project as "Screenshot 1" source code :jMenu.java I am posting the code here: [code=java] package projectpack; …

Member Avatar for masijade
0
167
Member Avatar for Dancealot

Hi all. I am trying to do a kind of streaming app in j2me, for a w810i. The device I am streaming data packages to, have a buffer of 10kbytes for me to use. I am streaming datapackages where 24Kbytes is used in about ½ second. Does anyone know if …

0
58
Member Avatar for ezkonekgal

When you put an item on a queue, how do you show the items inside the queue? do you use peek method? the situation is a linked queue...

Member Avatar for ezkonekgal
0
134

The End.