32,204 Topics
| |
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"); // … | |
[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 … | |
how do edit windows registry using java... any windows java api is avail.. | |
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 … | |
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 … | |
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 … | |
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? | |
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 … | |
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 … | |
[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 … | |
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? | |
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 … | |
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 … | |
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 … | |
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++; } | |
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 … | |
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 … | |
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 … | |
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 … | |
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[][] … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
Can you convert the object returned by jTable.getValueAt(Row,Col) to an integer? | |
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? | |
[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 *"); … | |
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 = … | |
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 … |
The End.