32,199 Topics

Member Avatar for
Member Avatar for Phinocio

My code [code]public class BattleSystem { public static void main (String[] args) { String choice; System.out.print("What would you like to do? "); Scanner input = new Scanner(System.in); choice = input.nextLine(); System.out.println(choice); if(choice == "1"){ createChar g = new createChar(); g.charCreateHandler(); g.charStatsHandler(); g.closeFile(); } else{ System.out.println("More choices coming soon!"); } } …

Member Avatar for Mattox
0
105
Member Avatar for brynFlew

Hello, does anybody know a simple way to strip the leading zeros out of a string? I have tried [CODE]userName.replaceFirst("^0+(?!$)", "");[/CODE] but cant seem to make it work, any ideas? Thanks. correction, this work.. [CODE]userName = userName.replace("0", "");[/CODE]

Member Avatar for Ezzaral
1
138
Member Avatar for Progr4mmer

In my program when i close the save file chooser it opens another one ??? heres the code [CODE] import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.*; import java.awt.event.*; import java.io.*; public class JB extends JPanel implements ActionListener{ protected JTextArea textArea; public JB() { setLayout(new BorderLayout()); JTextArea textArea = new JTextArea(); textArea.setFont(new …

Member Avatar for Progr4mmer
0
136
Member Avatar for Progr4mmer

I am currently using eclipse but thinking of NetBeans because of gui. I don't want to download it yet because i dont want to have unused programs on my computer. so should i download it for gui?

Member Avatar for Progr4mmer
0
133
Member Avatar for tfgd18

Can you help me on my OS project is the fixed partition project that can enter a job sizes and and its memory size. it is a gui type of project... that when I start now to run a message will come up that requested to have how many jobs …

Member Avatar for Phaelax
0
83
Member Avatar for CMAUK

Hi, im fairly new to Java, learning as I go on. I have gotten to the stage that I need to read specific lines from a text file that has already been created. Lets say my text document has 30 lines, and I only want to read what is in …

Member Avatar for Ezzaral
0
459
Member Avatar for Progr4mmer

i need to access the current text of a JTextField from another method but i get an error here is the code [CODE]public Calc(){ JTextField textBox1, textBox2; setLayout(new FlowLayout()); textBox1 = new JTextField(" Time "); textBox2 = new JTextField(" Exp "); JLabel lRate = new JLabel("Rate"); JButton calc = new …

Member Avatar for Progr4mmer
0
222
Member Avatar for TheWhite

Right now, with the manifest file, I am able to create my runnable jar to work with: folder structure: [CODE]libs/thirdpartylib1.jar libs/thirdpartylib2.jar myJar.jar[/CODE] using this manifest: [CODE]Class-Path: libs/thirdpartylib1.jar libs/thirdpartylib2.jar Main-Class: myPackage.myClass[/CODE] Is there any way I can package these jar files into my runnable jar so that I do not need …

Member Avatar for Ezzaral
0
117
Member Avatar for J-Viv

Hi all, i have been given an assignment asking me to: "The CashRegister class has an unfortunate limitation: It is closely tied to the coin system in the United States and Canada. Research the system used in most of Europe. Your goal is to produce a cash register that works …

Member Avatar for DragonMa
0
394
Member Avatar for andrasitc

I tried to make a simple program, draw a 4 sided polygon with 4 mouse clicks. This is the code: [CODE]import acm.graphics.*; import acm.program.*; import java.awt.event.*; public class Pravougaonik extends GraphicsProgram { public void run() { addMouseListeners(); } public void mouseClicked(MouseEvent e) { GPolygon cetvorougao = new GPolygon(); cetvorougao.addVertex(e.getX(),e.getY()); cetvorougao.addVertex(e.getX(),e.getY()); …

Member Avatar for andrasitc
0
173
Member Avatar for Progr4mmer

I wanted to know if its possible to change the text of a JTextArea or JTextPanel from another method and if so how?

Member Avatar for Progr4mmer
0
199
Member Avatar for kvass

Hey guys! So I recently started exploring the InetAddress object, and came across 2 methods which confused me: [ICODE]getHostName()[/ICODE] and [ICODE]getCanonicalHostName()[/ICODE]. I don't fully understand the difference between a canonical host name (fqdn) and a general host name, so if someone could explain the distinction to me in detail that …

Member Avatar for kvass
0
1K
Member Avatar for whateverme

Hello there, I'm trying on Gui exercises. One of them requires a simple GUI class for Vehicle. The GUI should have buttons for creating new SportsCar and new Van objects. and then should display the values of the instance variables of these variables. The GUI should also calculate and display …

Member Avatar for mKorbel
0
409
Member Avatar for AppB

Hi Everybody, I want to send Free sms in java without using any modem please help me out,i have been doing this since one week. Any help will be deeply appreciated. Thanks in advance Arpita :)

Member Avatar for masijade
0
113
Member Avatar for Clandestinexxx

i have to make a screen output final with variable which will set the height of atree.a the while loop has to be used.im kinda stuck to figuring this all out. the tree has to look like this * *** ***** ******* ********* *** so far all i have is …

Member Avatar for ztini
0
191
Member Avatar for mjavaid

I ran across this site while trying to Google search for help. I noticed this site showed up a lot of times and answered the questions I had, so I decided to join. I'm writing a program from class but I'm having some trouble. I would like to loop this …

Member Avatar for mjavaid
0
119
Member Avatar for dannii

I'm very new to Java 4 1/2 weeks into my intro to java, I have to write a program that asks user for an integer, the program will then add up all integers from 1 to N and display output message the sum of integers from 1 through (integer input …

Member Avatar for dannii
0
182
Member Avatar for js180

I have been searching online for a program that will: -reads in number of times a user wants a coin flipped -flip the coin that many times, printing out result of each coin flip -print out the total number of heads flipped and total number of tails flipped the application …

Member Avatar for kvass
-1
243
Member Avatar for insanely_sane

Here's an easy one for you experts :P What is casting and parsing? How exactly are they different? After explaining, could anyone possibly tell me how to cast/parse the various types from and to each other? (the types being: int, double, char and String) Also, in which situations would I …

Member Avatar for Mattox
0
248
Member Avatar for Fritz_Katz

I'd like to load an audio clip and play it multiple times in response to a button press events. Application is a piano simulator, with 88 sampled .wav files bundled in a resource. Using JMF, I can easily load the audio file and play it once, it doesn't play the …

Member Avatar for Fritz_Katz
0
2K
Member Avatar for Si_Long

I'm a newbie to Java, so I'm sorry if this is a silly question. I'll post the code first, then explain my problem. [CODE]import java.util.Scanner; class CharacterOperations{ public void run(){ System.out.println("1. toUpper"); System.out.println("2. toLower"); System.out.println("3. Alphabet"); System.out.println("4. Quit"); int input; Scanner sc = new Scanner(System.in); input = sc.nextInt(); while (input …

Member Avatar for Mattox
0
163
Member Avatar for Transcendent

I'm suppose to use Command-Line Arguments to take user input and than use an enhanced for loop to sum. [COLOR="Red"]This is the error: Exception in thread "main" java.lang.Error: Unresolved compilation problem: Type mismatch: cannot convert from double to int[/COLOR] [CODE] public class EnhanceForLoop { public static void main(String[] args) { …

Member Avatar for Transcendent
0
812
Member Avatar for gekkoswave

Hi I was looking help with a null pointer error I get everytime I use my newgame button or start the newgame method. What the game should do is guess 1-1000 then change the screen when the user's guess is too low , too high, and correct. Once the user …

Member Avatar for Mattox
0
143
Member Avatar for Bladtman242

I am following a series of programming challenges for beginners, this challenge requires interactive commandline input which is a pain in java. Therefore I've made a small class in another file to handle the user input. When I try to compile the main class ('external' class compiles without problems) I …

Member Avatar for Bladtman242
0
218
Member Avatar for kennyrgz

Hello DaniWeb, i`m a new member here, so greeting to you. As the topic title says i`m in bit of a problem, so a little help would be appreciated, I am as newbie as it get`s when talking about JAVA, so here it is. I`m trying to figuere out a …

Member Avatar for kennyrgz
0
117
Member Avatar for Akill10

Can't believe it has gotten to this. I cannot for the life of me figure out what is messing up my desired outcome. Here is the story: I have a small GUI program for a sports club. I have 3 list boxes, 1 for each U10's,U12's and U14 children. I …

Member Avatar for mKorbel
0
269
Member Avatar for Webbanditten

Hi im having this problem, i have this danish tv website [URL="http://www.dr.dk/NU/popup/live#/DR1"]http://www.dr.dk/NU/popup/live#/DR1[/URL] thing i dont know if your guys can see it but anyways its page content is: [ICODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>DR NU</title> <style> *{ margin:0px;padding:0px; } html,body { height:100%; background-color:#000; …

0
66
Member Avatar for shushi

Can you help me with this? Our instructor told us that we are going to StringTokenizer and he didn't told what is a StringTokenizer or has not been discussed. Can you add also the comments why that code is all about? Many thanks, Jerick PROG 131 – Computer Programming SPECIAL …

Member Avatar for JamesCherrill
0
182
Member Avatar for java beans

Im trying to to create a simple 4 function calculator using a jump table without switch case or if/else statements. I understand I can create the jump table via function pointers but I am kindda blanking out. I've started with the addition and subtraction part of the program but am …

Member Avatar for JamesCherrill
0
415
Member Avatar for Pratique
Member Avatar for masijade
0
71

The End.