32,199 Topics
| |
Trying to learn Java on my own with the book "Starting out with java" The question is this Write a class that has three overloaded static methods for calculating the areas of the following geometric shapes: circles rectangles cylinders (it gives the formulas for the are of them) Because the … | |
I am trying to understand how draw graphics to the JPanel class but i have only been able to display one object at a time(unless i draw muiltiple shapes in my extended JPanel class but i dont want that!) [CODE]import java.awt.*; import javax.swing.*; /* Create a new graphics component that … | |
I need to use Scanner and StringTokenizer to find a word then print that line in text area when found it. This is the Search Button's coding : [CODE]private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) { try { Scanner scan = new Scanner(file); String search = txtSearch.getText(); while (scan.hasNextLine()) { line = scan.nextLine(); … | |
Now, I've just done a calculation program. What I need now is to build a [B]Semester[/B] class that will contain information about the list of subjects taken in a semester, the corresponding grades as well as the grade average for that semester. How should i build the class to store … | |
The code for sleeping barber problem. When the status of the barber is set to busy then the customer cannot have a hair cut and is added to the waiting queue. when the customer is set to free then the customer have a hair cut. Here the problem is that … | |
I want to shift the value in columns after comparision. I am having problem with the getString command. It results in an error ….my code is like this [code]for(p=1;p<20;p++) { Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/srch","root",""); Statement stmt2=con.createStatement(); ResultSet rs2=stmt2.executeQuery("select * from "+tbl+"c"+startc+" where keyword='"+sk[i]+"'"); cnt=0; if(rs1.findColumn("count"+p) > 0) { System.out.println("count"+p); cnt=rs2.getInt("count"+p); if(cnt … | |
hi all community people iam an IT student .i have a 2 months free time.i want to do a miny project in java,i have knowledge in java(j2se),swings,jscript. if any one have mini java project ideas then send to me.iam waiting for good suggestions.pls reply me as soon as possible. | |
I would like to make a dwg->pdf one, and I also prefer java programming language, but I do not know where shall I start. Are there any good tutorials for any conversions, etc? Thanks! | |
Hi All I have been stuck on this for a number of hours now, really cant workout how I should go about making this work, I am not looking for the correct code, More looking for what I should be looking up and what I have done wrong. What the … | |
Hi Everyone. I am taking a class on java, and have made it to chapter 7 without many problems. I am having really bad problems with this, getting an illegal start of expression where it says public void sort....I have tried so many things, I probably even have things out … | |
hi can anyone give me a suggestion as to how i could replace data in dat file. the problem is that if i put the data into a string buffer and call replace it will not change the data in the file but i need that to hapen and the … | |
Hi all I am enrolled in abeginners class and am having problems with methods. I keep getting a .class expected and do not know how to fix this. It is at this line that the message appears `total = Circle.area(int radius);`. import javax.swing.JOptionPane; public class Circle { public static void … | |
Ok, using Jgrasp I was given a problem that asked me to design a GUI program to find the weighted average of four test scores. The four test scores and their respective weights are give in the following format....testscore1 weight1 This is what I have so far, the code will … | |
This is a school project. I need to read jokes from multiple files and show them in separate threads. It complies but I keep getting IndexOutOfBoundsExceptions. Any tips or help you can give would be greatly appreciated. [code] import javax.swing.*; import java.awt.*; import java.io.File; import java.io.*; import java.io.FileNotFoundException; import java.awt.event.*; … | |
so my assignment is: For this assignment, your job is to create a program that reads in multiple lines of text, and then produces the translation of that text into the English language variant known as "pig latin". Pig latin works this way: if a word begins with a vowel … | |
[code]import java.awt.*; import java.awt.event.*; import javax.swing.*; public class tictac2b1 implements ActionListener { /*Instance Variables*/ private int[][] winCombinations = new int[][] { {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, //horizontal wins {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, //virticle wins {0, 4, 8}, {2, 4, 6} //diagonal … | |
Hello, This is my first post to the community. I have never really been one to ask of much help but I am stumped. I was asked to asked to write a word count program that received input from a scanner object. The input could consist of one or more … | |
Hi, I have written this piece of code: [CODE] public class testAssert { 2 public static void main(String[] args) { 3 int x = 5; 4 int y = 7; 5 assert x != y; 6 } 7 } [/CODE] I am not sure how to make use of this … | |
Hi All, I am using ImageIcon to display an image, however, the image does not appear. See the code i am using below. Can you see what the problem is? The receivedImage will be taken out of an object it is stored in, and then i want to display it … | |
I have done a mortgage calculator program. it builds and run but I think tje GUI must be wrong because I cannot see it. I am very new to this and I am so lost. I do not know if this is the right forum. [code]import javax.swing.*; import java.awt.*; import … | |
how to change database at runtime, i use hibernate and spring. i have make like this hibernate.cfg.xml [code] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <mapping class="com.model.Person" /> <mapping class="com.model.Group" /> </session-factory> </hibernate-configuration> [/code] spring.ctx.xml [code] <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" … | |
hello can you help me how to trap the textfield length..example if i will iput in my textfield 00001 then it will only accepts 4 digits can you help me how to make this trappings...hoping for your positive responds.... | |
Hi, I'm creating a Java Swing application that lets the user enter the usual details one would expect in an address book then click the save button. The current JPanel will then be hidden while another JPanel is shown. This second panel is used for viewing all the contacts added … | |
Hello; I am trying to build a JDesktopApp The structure of a Session in a web app: a user logs in and a session specific to the user is saved.(basically). My question is dealing with a Desktop app. If a user logs in can the same concept be used? I … | |
Hey all. Ok i've written the code below with no syntax errors. However, im struggling. 1) For Button 1 - Check Balance, I want to firstly bar out the pin number so it doesn't show. How do I do this? 2) For button 1 - I have added show input … | |
For a CS project, I need to have my program "gracefully terminate" in case of certain user input errors. What is the best syntax to do this? | |
Assignment: Create a program to practice reading in from a file, search for a particular word when the user inputs a word to search for and a file via command line args. Print out the entire line each time it is found. Progress: It compiles, and runs.... kinda. Problem: I … | |
Hi, I'm trying my first program using servlets and JSP and would appreciate any help or advice about a problem I'm having. In my servlet I'm connecting to the database and displaying all the records in there. I'm then trying to add data to a JavaBean so that I can … | |
hey everyone. I am supposed to make a program that finds the smallest number out of a set of numbers. the amount of numbers input is up to the user. i have to print the smallest number, and what input it was (ex, 1st number 2nd number 3rd number...) i … | |
Hi guys, i need some help on my java homework. i need a text box which will have a piece of text. then i must show how many times every word has written in the text. in my way of thinking i should add every word to an array and … |
The End.