35,619 Topics
![]() | |
I m trying to create hello world example using rmi but till not succeeded.I got error in server file "Server Error java.rmi.ConnectException: Connection refused to host: 192.168.1.5; nested exception is: So please help me out. public class Server implements Hello { public String sayHello() { return "Hello World!"; } public … | |
I have created an application which puts all the images at a user defined location in a rtf document. The code is working fine and the images are getting inserted. However, if I open the document and add some text manually and save the file, the file size increases dramatically. … | |
Hi All, I need to display a image on page load , but it is not displaying In my jsp page i am calling a method which do some processing (it is taking long to do the process) and after calling the method i am sending the request to another … | |
I have this annoying problem: I am filling a HashSet out with Road objects, only doing so to avoid duplicate elements. However, the output from lines 81 though 95 shows that the set contains duplicate elements. Sorry for the messy code, this is a pretty ad-hoc sollution, in addition to … | |
I'm doing an actually simple practice problem from the book, but I am still not sure how to correctly do it.. It's just converting pseudo code. 1st part > num SIZE = 5 > > num VALID_ITEM_PRICE [SIZE] = 0.59, 0.99, 4.50, 15.99, 17.50, 39.00 > > stack int validItems … | |
How can I keep the lines that have been drawn previously after calling repaint() this is my paintComponent public void paintComponent( Graphics g ) { graphics2D = (Graphics2D)g; graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics2D.setPaint(Color.white); graphics2D.fillRect(0, 0, getSize().width, getSize().height); graphics2D.setColor(Color.black); } I've another method public void show_line(line a) { graphics2D=(Graphics2D)this.getGraphics(); for(int i=1;i<a.getLine_segs().size();i++) { Point … | |
import javax.swing.JFrame; public class MainApp { public static void main(String[] args) { new MainApp().start(); } public void start() { CalculatorUI obj = new CalculatorUI(); obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); obj.setSize(275,275); obj.setVisible(true); } } import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextField; public class CalculatorUI extends JFrame { //Variables. … | |
I am basically trying to make a TicTacToe game in Netbeans GUI builder. I have nine(3x3) buttons to show a grid for the game and that's where you mark X and O's. I want to make it one player game. I wanted to know how to make an array of … | |
I have a jsp page which has post comment box. I have written a servlet which takes a comment from the text area for the comment box and writes the comment to the database and redirects all the comments stored in the database to the page for display(using request dispatcher). … | |
Hi, I created an application which allows a user to capture screenshots and save them as images at a pre-defined location. Now, I want to insert the saved images to a word document. I am aware of Apache POI, but that is still under development and it seems that you … | |
am trying to add images to a rtf document. I am able to add images to the document but I can't append any images. This means that when the 2nd Image is added, the first image is removed. I think that whenever the code is executed a new rtf document … | |
Hey everybody, New to the java scene and having major issues, it would be appreciated if someone could have a look at my coding and see where i'm going wrong. I have a few 1. When i press the 'start new game' button the random number resets but not the … | |
I am new to programming, I am trying to learn how to program in Java through some old programs I found online, and yet I seem to be struggling. This is the program I wrote to fill a linked list with 10 numbers using a loop and then just printing … | |
Hey all, I want to write an application that I can run from the console where it loads settings from a config file. I also want to be able to double click on the executable and obtain a GUI where I can specify settings that will be stored in the … | |
Hello, I go to Georgia State University with a Computer Science major. I was wondering what what be a good gpa to graduate with in order to put me ahead of the competition. Mind you Georgia State is my of the top 5 school in Georgia. Thank you | |
How do I search a linked list for a string ? findXX(string) , for instance. | |
i want to display some code snippets for my forum. i want to display and html and jsp codes or other codes but i don't know how to fix it because if i display it in a page. it is like that it is included in the page code. i … | |
I'm sure that there is an article on here already about this, but I didn't see it. I'm trying to make my java application executable so I can share it with friends but whenever I use eclipse to make it a jar or executable jar file and send it to … | |
mport java.awt.Color; import java.awt.Graphics; import javax.swing.JOptionPane; why this is not working need help public class NewClass { static String myBinary; public static void main(String[] args) { String code = JOptionPane.showInputDialog("Please enter zipCode: "); BarCode myBar = new BarCode(code); myBinary = myBar.getCode(); int length= code.length(); if (length != 5 && length!=9) … | |
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 = … | |
Hi! I have one small question. Is that possible? public class test1 { public static void main (String[] args){ test2 client = new test2(); test2[] call = new test2[1000]; int x =2; call[1].add1(x); } } public class test2 { void add1(int x) { x = x+1; } } Sorry for … |
The End.