32,204 Topics
| |
what is the best way to display an arraylist? i am currently trying to display it in a textarea but not sure what method to use... [CODE] class Action2 implements ActionListener { public void actionPerformed (ActionEvent e) { String name = field2.getText(); String homeworks = field3.getText(); String exams = field4.getText(); … | |
how can i create a application that will compute fot the net income of a particular employee here is a sample output: Name:Vernie G. Lopez Position:Manager Rate:500 No. of Hours Worked:40 Gross=20000.00 Deductions: Bonus=1000.00 SSS=2000.00 Medicare=100.00 Tax=3000.00 Net Income==15900.00 Total Deduction=5100.00 .you have to accept name,position,and number of hours worked … | |
Hello DaniWeb, Basically like the title suggests I am having trouble generating a random element from my array, and storing it in another array. I am quite new to Java, and the api is a little confusing but from what I can see there is no method for this. Searching … | |
Takes an XML, XHTML, HTML, Javascript or CSS file and creates a pretty printing version. | |
I have a big problem using the default SQLite database via JDBC driver.I would like to use ORMLite with this.Let me expose my code: [CODE=java]String databaseUrl = "jdbc:sqlite:/data/data/my.package.name/db.sqlite"; Class.forName("SQLite.JDBCDriver"); DriverManager.getConnection(databaseUrl); dataSource = DatabaseTypeUtils.createSimpleDataSource(databaseUrl); databaseType = DatabaseTypeUtils.createDatabaseType(dataSource); databaseType.loadDriver(); UpDao = new UserProfileJdbcDao(databaseType); UpDao.setDataSource(dataSource); UpDao.initialize();[/CODE] I downloaded the ormlite2.8.jar (src) and modified … | |
I am working on this program and can't get my InvalidTestScore exception to work. Please help! [CODE] public class Grades extends Exception { // Begin public class Grades private double[] testScores; /** Constructor @param scoreArray An array of test scores */ public Grades(double[] scoreArray) // Assign the array argument to … | |
Hey guys. Before I describe my problem, I'd just like to say that I'm completely new to programming, and I'm currently in the first year of my program. I have an assignment to create a "Lottery winning program". The program generates a random seven digit number, and matches it to … | |
What I am trying to do is test the values of two variables, and if one is lower than the other then it will display an error message. When the user clicks okay it should return from the error pop-up back to the previous form... When I enter System.exit(0); or … | |
Actually I'm new in java, only 2 year, but force to develop advance application for my final year degree project. I'm going to developt image sketching and sketched recognition for police force. My question are: 1. What technique that i could use to to developt to combine several image in … | |
as I read in javadoc resultset represents a table which contain database therefore I want to know if there are a general way to iterate this result set and return data of it. on other side the interface result set contain method getString(int coloumindex), how can I implement this method? | |
Hey, What I need to do is read a file- it will have a name and several numbers after, with -1 as a sentinel number to signal the end of line, ex: Rogers 15 22 6 12 -1 Myers 23 10 4 22 34 -1 ... .... ..... What I … | |
I'm making a text editor just because I feel like it, I know there are already good text editors out there and this one isn't going to be better but I still want to make one because, again, I feel like it. I'm using JFrame to make my GUI and … | |
Hello Members, The following Client.java and Server.java works fine: Client.java [CODE]import java.net.*; import java.io.*; public class client { public static void main (String args[]) throws IOException { Socket sock = new Socket(InetAddress.getLocalHost (), 2000); BufferedWriter dataout; String Message = "How are you?"; BufferedReader datain; System.out.println ("Sending "+ Message + " … | |
Hello Members, I have a JTextArea object containing a paragraph. Is it possible to bold certain words in it? A pesudocode or example code would be of great help. Thank you!! sciprog1 | |
Hello dear frendz!! My name is Mrunal Bhatt and I have worked upon a gesture recognition software in Java. It just needs a webcam and a nano projector. The projector and webcam are small and handy, so a user can wear them on their body and just use the projected … | |
[CODE]import java.awt.Color; import java.awt.DisplayMode; import java.awt.Font; import javax.swing.JFrame; class GameStation extends JFrame{ public static void main(String [] args){ DisplayMode dm=new DisplayMode(800, 600, 16, DisplayMode.REFRESH_RATE_UNKNOWN); GameStation game=new GameStation(); game.run(dm); } public void run(DisplayMode dm) { setBackground(Color.PINK); setForeground(Color.WHITE); setFont(new Font("Arial", Font.PLAIN, 24)); Ex7 s=new Ex7(); try{ s.setFullScreen(dm, this); try{ Thread.sleep(5000); }catch(Exception ez){} … | |
Hey! I need to add a child node (its name is stored in Object child1) to the specific parent node (Object hierarchy). To do that, I try to find the parent node and then add the child node to it. However, e.printStackTrace() provides the error message (see below). What am … | |
So the problem is to get two words from the user and then see if they cross and if they do type them out like the example: word1= lottery word2= boat Crosses would be: b lottery a t b o a lottery b o a lottery I am pretty lost, … | |
Hi! So, my question is how could I compare two objects. The code is shown below. The problem is that the first "if" statement is always true, even if it should be false. For instance, let's say childHierarchy[i] and hierarchy[0] are equal to 'Contract'. In this case "if (childHierarchy[i].toString() != … | |
I have no idea how to start the interpreter for this java project. I need some hint on the LET statement in order to write other code such as ADD, MINUS, GOTO...etc Thanks [CODE]public abstract class Statement { // execute() takes a ProgramState and executes this statement, by making // … | |
[COLOR=#555555]Hello everyone! [/COLOR] [COLOR=#555555][COLOR=#555555]Any help would be much appreciated![/COLOR][/COLOR] [COLOR=#555555]My problem: [/COLOR] [COLOR=#555555]I want to break up a string into separate objects.[/COLOR] [COLOR=#555555]Scenario: [/COLOR] [COLOR=#555555]I am reading a txt file into my program and I want to[/COLOR] [COLOR=#555555]separate the String in to separate categories. [/COLOR] [COLOR=#555555]String line = "BATHROOM TOI … | |
hey guys, im a bit new to this. pls assist me to correct this code :(. [code] public class studentSystem { public static void main(String args[]) { //Student sw = new Module(""); Student sw = new Student("Sefakor","1112348"); System.out.println(sw); System.out.println(sw.getName()); //prints Sefakor Selormey System.out.println(sw.getId()); //prints 1112348 sw.setName("May Stow"); System.out.println(sw.getName()); } } … | |
Write a program that will ask for a password. If the password is entered correctly, a message should be displayed like “You may enter”; otherwise after 10 tries display a count down from 10 to 0 then a message that the hard drive is being wiped out should be displayed. … | |
I am supposed to: 1. create two constructors. a. query for student's names and three scores. b. take four arguments 2. write a method calculateAvg that calculates and sets average 3. write a method calculateGrade that calculates based on 90+=A, 80+=B, 70+=C, 60+=D, <60=F 4. Write a method toString that … | |
In java code, when to expect to throw an exception with a throw statement and when to catch an exception with a try/catch block? Moreover, how to distinguish between a situation in which an exception should be caught by a method or throw to its caller. | |
Hello Members, Is there a way to remove the border lines of a JTextArea but retaining the JScroller? I tried the setBorder(null) method for the JTextArea without any success. Thanks a lot!! sciprog1 | |
I have this bit of code: [CODE]case 1: case 3: case 5: case 7: case 8: case 10: case 12: day = 31;[/CODE] Does this mean the values 3,5,7,8,10,12 can only be day=31? How can I make it so only the Max value is 31? So it can equal 31 … | |
The Vehicle.java is the file that I am modifying. The second code is the testdriver. [CODE]public class Vehicle { String make; String model; int year; public Vehicle(String s1, String s2, int y) { if (y >= 1980 && y<= 2012) { year = y; } else { y = 2010; … | |
I need help with a project. The project utilizes the random number generator. What I have to do is get the player to set the min and max numbers of the game, and then a random number must be generated and the user has to guess what the number is. … | |
I need to verify that the number the user inputed is between 1908 and 2012. here are the actual instructions "The constructor must also verify that the value provided for "year" is at least 1908 and at most 2012 – if not, set the year to 2010 by default" I … |
The End.