32,199 Topics
| |
Hi everybody, I'm just wondering what is the more eficient and compact way to write statements like this if(site.next(1) == null) { return false; } if(site.next(2) == null) { return false; } if(site.next(3) == null) { return false; } | |
Hi, a question about stand-alone Java applications that do not have a background DB. In our Uni class we were asked to build a very small application using JOptionPane methods such as "showInputDialog". The application asks for users name and birthdate and at the end displays a summary of these … | |
i really hate php and javascrip but i really want to make a social network website just for fun. so i wanted to use java, sql, and html to make. i already know these 3 languages and i know how to set a database but i dont know how to … | |
Im having a difficult time finding info on how to set up a combobox listener for my project. My book has 1 example and it uses audio files.(no help) My project consists of a GUI panel with a splitpane that that has a list of info on the left for … | |
Hi all, I'm working on a simple Java project on student database. One of the methods I need to implement obviously involves searching for a student in the student registration using the student id input. Here is what I've been asked to do: *-searchStudentRegistration(String studentId): Using the studentId you will … | |
I got quick question regarding Java less say i got provided with this code: public void printNext(int x){ System.out.println((x+1) % 3); } public void printSequence(){ for (int i=0; i<5; i++) printNext(i); } The question is : 'What sequence of number is printed by printSequence()?' Ok first its going do 0+1=1 … | |
Hi, I am trying to create document using iText. I am using Eclipse IDE. I've imported the jar files (itextpdf-5.2.1.jar and itext-xtra-5.2.1.jar). However RtfWriter2 is not being recognised as a class. Document doc = new Document(); RtfWriter2 writer = new RtfWriter2(); RtfWriter2.getInstance(doc,new FileOutputStream("testRTFdocument.rtf")); Can someone help me in figuring out … | |
Hi :) Is it better to have a one file program (ex. MyProgram.class) or a multiple file one (ex. Main.class and Gui.class and Draw.class)? thx | |
who can help me?? Create a solution for the following scenario: A local community mobile college unit holds 2 different classes in literacy and numeracy for mature students. A student can join the mobile unit and sign up to one or both classes. The students ID number, forename, surname, age … | |
Filterable `AbstractListModel` uses `originalModel` of `JList` as source and excludes those items from `originalModel` that matches exclude criteria specified by given regex. It also allows reusing same model (with filtering capability of course) for multiple JList components. It also registers as `ListDataListener` to `originalModel` model to be able to relay … | |
Hi, I've created a small application that allows the user to capture the screenshot and save the image at a user defined location. It also allows the user to capture the screenshot of the active window as well. The issue is with the active window. I have learnt that Java … | |
Hello, I am having some trouble writing this java GUI. First in the win1, i cannot get the start and exit button to the bottom of the page along with the jlabel into the center. Next for win2 i cannot resize the "go here" button at the bottom of the … | |
I have been trying to teach this myself, but I judt don't get it. I have 10 books with ISBN number, title, name of author. The linked list should display the books sorted by ISBN. I hope this collections.sort is correct: import java.util*; public class Sort { public class Sort … | |
I am designing a very basic form in which I am using GridBagLayout to position and size the GUI components. All the components get sized and positioned exactly as I expect from my code except the two radio buttons named "noRadio" and "yesRadio" respectively. I want them to appear next … | |
Hi. I cannot explain my question very well. I have an array of objects. Can i perform a search in this? Check the following code as example: public class test1 { public static void main (String[] args){ test2[] array = new test2[2]; for(int i=0;i<2;i++){ array[i]=new test2(); } int a=1, b=2; … | |
//This is the package file package radz1990; import java.io.*; import java.util.*; import java.lang.*; public class radz1991a1 { BufferedReader ob=new BufferedReader(new InputStreamReader(System.in)); Scanner obj=new Scanner(System.in); public String name=new String("0"); public String patientid=new String("0"); public String prescription=new String("0"); public String Illness=new String("0"); public String Address=new String("0"); public String ladate=new String("0"); public int … | |
| I made a creature composed of shapes in a Java Applet. I want to basically copy and paste the creature I made so I have say 7-8 copies on the same applet. but in different locations. Is there an easy way besides copying the entire code, and moving each coordinate … |
Hello, The following program computes the value of Pi using the Hit/Miss method. Since I am doing all the drawing in the JPanel, I am not calling super.paintComponent(g). The program works well, but since I am not using the super.paintComponent, it does not draw the background. Is there any way … | |
*This program is supposed to printout all the first letters of the Strings enterned in an Array. Which works. but when I added some code to convert the first letters to uppercase, there's an error.* I put a comment in the code where the error is. what's wrong with that … | |
hi, I'm currently building a game and stuck at the paintComponent method. I'm trying to add 3 graphic buttons to the JPanel but the paintComponent does not execute (all I get is gray window) here's my code : public class TwinMoonTowers extends JPanel implements ActionListener{ private class TMTMenu extends MouseAdapter{ … | |
Hello guys, There is a thing I need help with. When I run my program, and the window shows, I want focus on the textField. Like Google, when you enter Google, you get focus on the search panel so you can search. My program got a simple search engine with … | |
<?xml version="1.0" encoding="ISO-8859-1"?> <project name="ant_template_core_java" basedir="." default="info"> <!-- Properties files --> <import file="../masterbuild/masterbuildproperties.xml"/> <import file="../lib/libproperties.xml"/> <import file="../implementation/implementationproperties.xml"/> <import file="../api/apiproperties.xml"/> <import file="../junittest/junittestproperties.xml"/> <import file="../javadocs/javadocproperties.xml"/> <!-- Ant task files --> <import file="../implementation/implementation.xml"/> <import file="../api/api.xml"/> <import file="../junittest/junittest.xml"/> <import file="../javadocs/javadoc.xml"/> <import file="../masterbuild/masterbuild.xml"/> <import file="../log4j/log4j.xml"/> <!-- Make directory files --> <import file="../masterbuild/masterbuildmakedir.xml"/> <import file="../implementation/implementationmakedir.xml"/> <import … | |
I don't understand why it just prints numbers. /* This program converts the first letters of the entered strings for an array to uppercase*/ import java.util.*; import java.lang.String.*; public class myfirstarray{ static Scanner scan = new Scanner(System.in); static String str1, str2,str3, str4,str5; public static void main (String[]args){ String[] items = … | |
An example of a multi-tier application where each tier of the application throws its own exceptions that are caught by other tiers of the application. | |
i have to decrypt a frame on my server. encrypted frame is coming from client device through GPRS on socket.encryption is done with "TripleDes" and with a given key.same algorithm and key i am using n server side. frame is a combination of Hex and Ascii String. problem is when … | |
How to import Logging class..Because when i import log4j.xml the program is outputing an Error "unknown configuration log4j" | |
I have this program I'm writing. I need help with the bet part of the program. I'll give you an idea of what I'm doing: The player starts with $500. He can bet between 0 and his current amount left on next turn. If he bets 0 the game is … | |
For the assignment we're suppose to add a findFirst, findNext, and addElement method to the given class and test them. I manage to get the findNext and addElement working but not the findFirst. Here's what the findFirst suppose to do "Method findFirst(T item) searches for and returns the index of … | |
Can some one help me with my programming project, it is supposed to loop. If the number is even output comes out even and vise-versa. Can someone please tell me what is wrong with my code. Errors "3 errors found: File: C:\Users\Kaamil\evenodd test.java [line: 1] Error: The public type NumberEvaluator … | |
/** * @(#)SavingsAccountTest.java * * SavingsAccountTest application * * @author Kelvin Njuguna * @version 1.00 2012/4/24 */ public class SavingsAccountTest { public static void main(String[] args) { double interest1,interest2; double newBalance1,newBalance2; SavingsAccount.modifyInterestRate(0.04); SavingsAccount saver1 = new savingsAccount(2000.00); SavingsAccount saver2 = new savingsAccount(3000.00); for(int=0;i < 12;i++); { system.out.printf("Month %d:\n",i+1); interest1 = … |
The End.