36,051 Topics
![]() | |
Hi, i'm making a java program, and I started making the gui with a `JTextArea`, and tried to add a font (`Consolas`) and It crashes with a "divide by 0" error. It works fine on windows, and if you comment out the `setFont` line.. import javax.swing.*; import java.awt.Color; import java.awt.Font; … | |
Please help me. It goes like this: Write a program that will determine the income of an employee. An employee is either a part-time or a full-time employee. A part time employee's gross income is computed as the product of his/her hourly rate and the number of hours worked. The … | |
My homework goes like this: Write a program that accepts as many integers the user wants to input. Determine the highest and lowest numbers and subtract all other numbers from the highest number. example: numbers to be entered: 6 number1 :15 number2:20 number3:29 number4:38 number5:12 number6: 42 Output: Highest: 42 … | |
I need to write a code with a constructor class in order to see the whole phonelist using an array that reads from a document txt, able to add a person and phone number, search just one person in the phonelist and able to modify their phone number. here is … | |
I need to input a name in the JMenuItem(employee name) using JOptionPane, I used this statement (JOptionPane.showInputDialog(frame, "Enter Employee Name");) and I try using a string variable but nothings happen. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.FlowLayout; import java.text.MessageFormat; import javax.swing.table.AbstractTableModel; public class Cs extends JFrame implements ActionListener { … | |
I am having a problem to understand how class inhertance works in Java.. Now I want to get information from a class to another and let's say we have class A and class B class A contains a string an int and a byte class B contains a String and … | |
I was just wondering if someone could maybe set me on the right track or tell me exactly how to do what I am about to ask. I have a bunch of answers in a notepad file, such as TFTABCD (going downwards, a letter per line), how can I make … | |
public class W4P7{ public static void main(String []args){ int [] myArray = {11, 29, 21, 23, 33, 32}; method(myArray); }//end of main /****************start of method****************/ public static void method(int [] x) { int swap; for(int i=0; i<x.length;i++){ for(int j=0; j<x.length-1;j++){ if(x[j] > x[j+1]){ swap = x[j]; x[j]=x[j+1]; x[j+1]=swap; }//end of … | |
I am trying to read a random line from a file and if that line is null it will create a random string. It works with files with upto and including 5 lines. To test it I made a 2 line file: > 1-hello > 2-but However, when run it … | |
in an assingment, i have to implement a deque ( double ended queue ). the underlying datastructure is allowed to be arrays or linkedlist. only that im not allowed to use any prebuilt java api that does the above. (like the java.util.LinkedList api) implementing the above using doubly linked list … | |
Loop trough a HashMap <String, Integer> and if the value is something, for example, 5, then put the key in an array. I'm not sure where to start, I'm having trouble on the "Loop trough a **hashmap**" part. Thank you. | |
Hey Guys, I'm want to output a calculation to a JLabel. Example: double num1 = 14; double num2 = 3; double ans; ans = num1/num2; JLabel jl = new JLabel(); add(jl); jl.setText("The Answer is: " + ans); Currently the answer for this will be 4.666666667. Now if this was a … | |
Hi Guys, I am creating a system to work on a database adding updating etc. And the combo boxes are giving me trouble. The process is as follows. The user searches for a business by location once entered all business for that area are then displayed name address owner etc. … | |
Hello I am trying to insert some data into a sql server i have but it seems like I'm formating the information wrong. This is what i have so far. product id = int; type = string; watt = float; volts = float; String query = "INSERT INTO GoodCustomer(Product ID, … | |
Hello, I have a Mysql table, where i want that after i execute the update query in the JSP form, an automated mail is send to the email id in the record.Can anyone tell me how to do this? | |
Please am new to java and i need an assistant on loading hexadecimal from a textfile and converting it into binary(Loader class) then the binary will be kept in another class(memory class). then the binary will be forwarded to another output file. | |
please help me to explain the two dimentionalsales about sales person: 1. while 2. do- while 3. if 4. if-else 5. for | |
Hi everyone. I am currently doing small exercises on classes. Suppose you have 2 classes: Person (superclass) and Student (subclass) the class Student is extending the class Person. When creating new objects of type Student, when do use the following options: option 1: student x= new student( ..); option 2;( … | |
The problem with my code is that the update method doesn't get invoked even after I notify the observers. Did I miss something in my code? package com.observer3; import java.awt.FlowLayout; import java.util.Observable; import java.util.Observer; import javax.swing.JLabel; import javax.swing.JPanel; public class A extends JPanel implements Observer{ JLabel lbl; public A(){ setLayout(new … | |
Hey guys, can anyone tell me how I could use randomaccessfile to read in a txt file and copy the content to a tree? Also how to then do the opposite and write newly changed nodes from the tree onto the text file? It's pretty much like creating a save … | |
Hi, i'm trying to use an `AffineTransform` to transform a point to pixels on a 400x400 canvas. What kind of transform would you use? For example: given the points (-1, 1) --transform--> (0, 0) (pixels) (1, 1) --transform--> (400, 0) (pixels) (-1, -1) --transform--> (0, 400) (pixels) (1, -1) --transform--> … | |
Hi, started programming 2 days ago, and i'm having a problem with Java saying one of my variables isn't initialised. Couls someone help please?! Thanks, code below: public static void adding() { int n = getN(); int total; for (int i=1; i<=n; i++) { total = i + 1; } … | |
I have less than a day to understand and learn evrything there is to know about arrays and to be able to know what the output for a code on arrays will give.. I was hoping someone will be able to suggest any good sites etc.. from which i can … | |
Hello, I am taking my second Java course this semester CSC-251 (advanced Java). I took introduction to computer programming last summer. With three programming courses under my belt will I be able to find a job out there in the real world? For a little background information about myself. I … | |
Was not sure where to post this, but let this a go. I m on my final year. And I have discovered in myself a passion for programming in C and started learning it but it is all in a beginning stage. I really bored of Java or I just … | |
i need to make the Print JMenuItem to open a printdialog box when clicked but i dont know how to make it can u help me pls p.addActionListener(new ActionListener() heres the code can u add the printdialogbox i searched but i cant put it on the program import javax.swing.*; import … | |
How can I work out these questions?? Would really appreciate your help. things like looking for things in the Hashmap. • isRally - takes a String containing a rally code as a parameter and returns true if it represents a rally object stored in the allRallies collection, and false otherwise. … | |
So we are working on loops right now, I got the first portino of my program up and running how I want, took some messing around with but I finally got it. Here is my assignment: > Credit Card Number Check. The last digit of a credit card number is … | |
hello there I m trying to do database connectivity with sqlserver2000 it runs if i write that code in a normal java file but if i run that code with jsp file it gives an exception com.microsoft.jdbc.sqlserver.SQLServerDriver Although i hav set the CLASSPATH of Jar file for sqlserver 2000 here … | |
//Hello(apologize for any formatting errors) //I am trying to finish this program that is supposed to act as a club bouncer. Only letting a max amount of people (125) in at one time. Naturally people leave throughout the night, so I was trying to //implement that with the random variable, … | |
Hello guys. I'm getting an error as follows: Error I get on the browser:- type Exception report message: descriptionThe server encountered an internal error () that prevented it from fulfilling this request. exception: org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP PWC6199: Generated servlet error: string:///GuestBookView_jsp.java:8: cannot find symbol symbol … ![]() | |
HI, I have a class Customer and Vehicle. Fist a customer needs to be added to the application. when a vehicle is being added the customer id needs to be added also so i wrote the code as below @Override public void addVehicle( String make, String model, String year, String … | |
Hello, What is the best way to check my code? I have written a program that counts the swaps required to sort an integer array using the Bubble, Selection, Insertion and Quick sort methods. How can I be absolutely certain that my swap counts are correct? Will someone take a … | |
who learn java with me if any one then ask me question ??????????????????? | |
ResultSet rs=st.executeQuery("select * from category"); rs.moveToInsertRow(); rs.updateString("cname",c); rs.insertRow(); rs.moveToCurrentRow(); i want to insert new row in table of sqlserver2000 database the row should insert at last in a table .can i use variable at place of value in updateString("column name","value") the code i m using is here ![]() | |
hello guys i want to make progress bar in netbeans i trying with this code but the progres bar doesnt work property just showing 100% when finish and doesnt have animation of doing that progress: public final class Music extends javax.swing.JFrame { public static class Start implements Runnable { @Override … | |
So I am making a GUI that the user inputs the username and password to login to my schools website. I then want it to open up the default browser and open multiple tabs to the schools website while being logged in. I'm not entirely sure how to be logged … | |
Hi everyone, I have created an implementation of the game Tic Tac Toe using a board array that is 3 x 3. It reads in a turn from the user via the keyboard, and then the computer returns a move. I have written the computer AI to basically do the … | |
import java.io.*; import java.util.*; import java.util.Scanner; public class cooperativeCanteen60 { static Scanner console = new Scanner(System.in); static Scanner sc = new Scanner(System.in); public static void main(String[]args) { //throws java.io.IOException { Scanner in = new Scanner (System.in); int type; int discountRange; int discount; int customerType; int number; int rtotal; int vtotal; … | |
Hi! I'm working on a notepad project and like original notepad i want the form title set by the name of the file that has been openned so how can i do that?! thanks... | |
Someone try my code. And help me with the txtQty TextField. import java.awt.*; import java.awt.event.*; import java.applet.*; import java.text.*; import javax.swing.*; public class Cashier extends Applet implements ActionListener, KeyListener { private final double applePrice = 15.75, orangePrice = 13.50, pomeloPrice = 95.25; Panel topPanel, eastPanel, westPanel; Label lblTitle, lblQty, lblTotal; … | |
![]() | I am trying to play an mp3 file using the JMF java library and an mp3 codec with the following code but i am getting an error and don know the source package source; import java.io.File; import javax.media.Format; import javax.media.Manager; import javax.media.MediaLocator; import javax.media.Player; import javax.media.PlugInManager; import javax.media.format.AudioFormat; import javax.media.*; … |
This is the output: https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-prn1/541619_462450913826230_932486202_n.jpg This happens when I input "1" in the quantity textfield. (The quantity textfield turns null after inputing a value) But when I put "1" in the quantity textfield and click Oranges, it overwrites the Apples. https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-ash4/299813_462450910492897_2137805386_n.jpg WHat i wanted to happen is that it'll tally … | |
Hi, I am trying to do a hotel system where i have written up this code, however i was wondering if the there was a way to make the main program simple. So what im trying to do is the code that ‘Views All rooms’ and ‘Adds customer to room’, … | |
I have to access a java swing application which is on server machine from a java web application Please help me. I have to send few attributes tu Gui apps and in turn retrieve result from that.. | |
hello i have some problem in showing button, when data exist and data not exist. i want the button show if data exist also data not exist. my current problem right now the button only show when data exist but the button automatically hide when data not exist. here what … ![]() | |
OK so what I want to do is create an infinite loop scanner that will add up all the values from the previously entered values which will then produce after each entered number the total value. How do I do this? | |
i getting error when i run my jsp project "starting tomcat v7.0 server at localhost has ecountered a problem. Server v7.0 server at localhost was undable to start within 45 mins." i think the problem might be in my web.xml fine under web-inf folder. may be i am not using … | |
I would just like to know what is the difference between a CONSOLE APPLICATION and Windows Application in netbeans?? | |
Just a curious question, not important really. More for a discussion. Isn't using int i = 0; boolean count = false; pretty much the same thing when flagging? I mean when something goes right, change i = 1; count = true; and get the same result. What's the advantage of … |
The End.