32,204 Topics

Member Avatar for
Member Avatar for P00dle

I've found this online(Can't remember where) and I thought it might be usefull to other people as well:[CODE]package org.kodejava.example.text; import java.util.List; import java.util.ArrayList; import java.util.Locale; import java.util.Collections; import java.text.Collator; public class StringShortWithCollator { public static void main(String[] args) { List<String> fruits = new ArrayList<String>(); fruits.add("Guava"); fruits.add("Banana"); fruits.add("Orange"); fruits.add("Mango"); fruits.add("Apple"); // …

0
62
Member Avatar for ngnt4

[CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TravelExpenses extends JPanel { private JTextField days; //declaring textfields and labels private JTextField lodging; private JTextField airfare; private JTextField taxiCost; private JTextField miles; private JTextField rental; private JTextField seminarFees; private JTextField parkingFees; private JLabel daysL; private JLabel lodgingL; private JLabel airfareL; private …

Member Avatar for ngnt4
0
111
Member Avatar for musthafa.aj
Member Avatar for parry_kulk
0
78
Member Avatar for ngoelnoi

Hi, I am facing a problem in JTextPane. Actually we are creating a editor like application in Java Swing. In JtextPane we type the matter and set some metter as heading1, heading2 so on as user required and some matter as simple story. My problem is that how can we …

Member Avatar for ngoelnoi
0
101
Member Avatar for sselwyn

Hello! I am supposed to write a recursive method for my assignment in my class but I'm not sure what is wrong with the code I wrote. The method should print all of the letters of the alphabet up to (including) the parameter value. Some examples of what it's supposed …

Member Avatar for sselwyn
0
81
Member Avatar for ceileyg

Hey all - yes, this is another thread asking for some homework help, but I've got a solid start, just looking for some fresh ideas. Anyways, the task is to create a java clock class and access/use it from a driver. I saw something similar on here, but not quite …

Member Avatar for masijade
0
5K
Member Avatar for P00dle

I need to write a combination of String and Images to a file. The catch is that I have to write some String, then the Image, then more String again. Does anyone have any ideas how to do this? Should I use BufferedImage?

Member Avatar for P00dle
0
77
Member Avatar for kool005

Hi, I need to create an adjacency list for a weighted graph. The input is given from a text file. I have created an array assigning each index a vertex. Now i have to link that array with a linked list. For example, vertex 'a' showing all the vertices that …

Member Avatar for kool005
0
67
Member Avatar for gherudek

I am trying to write a method that will return the month with the lowest rainfall amount. The problem is that I have to initialize my variable but then my method always returns a "0". How can I fix this problem? Here is my code: public int getLowestRainFallMonth() { double …

Member Avatar for gherudek
0
70
Member Avatar for donths

[QUOTE] Please! need help in removing (or set the element value to 0) one element of an array based on the string value that is passed to the remove method. The array contains string names read from a file. I don't know if I should post the entire code on …

Member Avatar for donths
0
103
Member Avatar for nevets04

As The title says pretty much, auto resize and auto format are making this very hard for me to make GUI, can I turn it off?

Member Avatar for Ezzaral
0
82
Member Avatar for kenji

Hi, I can't figure out why my exit button is not working as all the other buttons in my code seem to be working. I have given the code below. The constructor for the button is [code=Java] private JButton exit; .... add(exit); .... exit = new JButton("Exit"); exit.addActionListener(this); [/code] The …

Member Avatar for Ezzaral
0
85
Member Avatar for COKEDUDE

I have two different parts to my program. My FundRaising.java is my problem. I'm having problems with my print statements. Why are the correct numbers not showing up? I keep getting 0. System.out.println (booster1); System.out.println (booster2); I ask the question to get the numbers and I keep on getting 0 …

Member Avatar for Ezzaral
0
351
Member Avatar for Phaelax

I'm using [I]javax.xml.parsers.DocumentBuilderFactory[/I] to load an XML file. The file contains paired elements like so: <A></A> <B></B> <A></A> <B></B> <A></A> <B></B> So if I did the following: [code] Element element = <root node element> NodeList nodeListA = element.getElementsByTagName("A"); NodeList nodeListB = element.getElementsByTagName("B"); [/code] Can I assume the elements are in …

Member Avatar for Phaelax
0
134
Member Avatar for ZoomZoom

hey guys, im having problem converting this to a while loop. int lineB; int starB; for(lineB=1; lineB<=10;lineB++) { for(starB=10; starB>=lineB; starB--) System.out.print("*"); System.out.println(); } System.out.println(); Can it be written like this? int lineB=1; int starB=1; while(lineB<=10) { while(starB>=lineB) { StarB--; System.out.print("*"); System.out.println(); } lineB++; }

Member Avatar for Ezzaral
0
1K
Member Avatar for samarudge

Hi, I downloaded the open source project Guitar Tuner ([url]http://sourceforge.net/projects/guitartuner/[/url]) Inside it there is an index.html file, a TunerApplet.jar file and a TunerApplet.java file (As well as some images and GPL etc.) When i open index.html the applet displays as it should however if I try to recompile (Even without …

Member Avatar for samarudge
0
125
Member Avatar for smachee

I am doing a homework problem and am having a hard time understanding exactly how I should be doing this. Any nudge in the right direction would be helpful. :) The problem is as follows: Ship, CruiseShip, and CargoShip Classes Design a Ship class that the following members: • A …

Member Avatar for smachee
0
3K
Member Avatar for RichardCrickets

Hello daniweb, I am new to java and am trying to wrap my head around parsing XML with Java. I've decided to try DOM with Xerces to start because it seems pretty simple, however I am getting NoClassDefFound errors. I'm sure it's something really simple that I have overlooked due …

Member Avatar for Ezzaral
0
1K
Member Avatar for tangieb01

The questions are at the bottom of the code. Need Java Help! I don't know what I'm doing or where to start!? Here is the first program: public class IntClass { private int x; public IntClass() { x = 0; } public IntClass(int num) { x = num; } public …

Member Avatar for BestJewSinceJC
0
104
Member Avatar for nola_Coder

I'm working on a Floyd's Algorithm type Java program. What I have done so far is represent a directed graph in a 2d array, and I am trying to transform that into a 2d array representing the graph's paths of length 2. I planned for it to fill the adj2[][] …

Member Avatar for nola_Coder
0
168
Member Avatar for kpcorp

OK i have been stuck with this particular problem and driving me crazy any insight would be helpful. I am trying to create a program that asks user for a string and using the scanner method count the instances it appears in a txt file below is the code oh …

Member Avatar for Ezzaral
0
100
Member Avatar for Clawsy

Hello, In my project I have to capture screen activity (including audio) to a video file. I try using JMF for this. I don't know how to use those two classes: DataSource.java and LiveStream.java. I read them line by line. I probably have to create a Processor and feed it …

Member Avatar for Clawsy
0
723
Member Avatar for hailpam

Hi all, I've a problem: my application must convert ms word documents (imported from another system) into rtf documents, in order to be manipulated with OOo APIs and [U]to be immune from mistakes[/U] (for coding incompatibility reasons). I ask you: how can I manipulate ms word documents directly from my …

Member Avatar for hailpam
0
191
Member Avatar for emmas4impact

hello can someone help me out with these? am writing a project on a video rental store. and i have to use access i dont know if i should use one-many connection or many - many. if many-many then what will the code in the java database look like? remember …

Member Avatar for debasisdas
0
90
Member Avatar for stayfierce

I am trying to run a source code that I downloaded. However, there are several error message in reference to the classes TablePanel, BufferedPanel, Stringable, and Booleanview. I am not sure why I am getting these errors because it is a complete source code. Do I need to import additional …

0
55
Member Avatar for silveram

Can you convert the object returned by jTable.getValueAt(Row,Col) to an integer?

Member Avatar for javaAddict
0
89
Member Avatar for P00dle

Hi, In my program, a text file is read in, and certain parts of it are written to a XML file. There are special characters(e.g. &) that need to be escaped, so I need to escape all of them. How can I manage to do this?

Member Avatar for P00dle
0
84
Member Avatar for nikolzn

[CODE]import java.util.Scanner; import java.util.Random; import java.io.IOException; import java.io.PrintWriter; import java.io.File; public class Password { public static void main(String [] args) { Scanner in; in = new Scanner(System.in); Random rand = new Random(); System.out.println(" Password Generation Menu "); System.out.println("********************************************************"); System.out.println("* [1] Lowercase Letters *"); System.out.println("* [2] Lowercase & Uppercase Letters *"); …

Member Avatar for parry_kulk
0
94
Member Avatar for deadllama19

There were two other variation which I completed but I am confused with this one: Write a method for each triangle variation. Use nested for loops to draw the triangles. Variation 3: /** Precondition: width is an odd number >1*/ public void diamond (int width) { } if width = …

Member Avatar for GTJava
0
100
Member Avatar for gunjannigam

I have drawn a cirlce and 2 line which intersects the circle using 2D Graphics. Now I want to draw an arc between the intersection point. The attached pic can show very clearly wht i want. The black portion is drawn. The red part is to be drawn. The radius …

Member Avatar for gunjannigam
0
86

The End.