32,199 Topics
| |
I would like to build a simple highlighter program. The idea is to set an image to change the cursor so that it will look like a highlighter. And then, when we move the cursor, it will trace a line along with our movement. The requirement here is to be … | |
I have installed MySql here already, now i need to connec it because I am going to make a project which it needs a Database, but my problem is that I don't know how to set the connector/j/ I don't know how to install it/I don't know how to put … | |
How do I set a new salary and a new department for the emp1 object class using a setPosition method. Everything works except that for some reason I just can't show the results on Message. Here is the Driver: import javax.swing.JOptionPane; public class Employee { public static void main(String[] args) … | |
Hello All, I need to create a java code for auto numbering. A value will be mentioned in a table in database eg 10000. The java file has to retrive the database value and start the auto numbering from that particular number. It should increment by 1 for the next … | |
I have this try-block [CODE]try { FileReader textFileReader = new FileReader(filename); BufferedReader textReader = new BufferedReader(textFileReader); String post = textReader.readLine(); int weeknumber = Integer.valueOf(post); if (weeknumber != weeknmbr) { System.out.println("Wrong weeknumber."); return false; } post = textReader.readLine(); while (post != null) { insertPost(post); post = textReader.readLine(); } textReader.close(); }[/CODE] but … | |
I'm working on a simple encryption/ decryption program for class. When I try to compile, I get a number of "expected areas" directed towards the following segment of code: [code] public static char encrypt(char c, String k) { String fullcrypt = (k + "abcdefghijklmnopqrstuvwxyz"); for (int i = 0; i … | |
[code]import java.util.*; import javax.swing.JOptionPane; import java.text.*; class playGames{ public static void main (String [] args){ Fermi fermi; fermi = new Fermi(); int num1 =fermi.fermi1(); int num2 = fermi.fermi2(); int num3 = fermi.fermi3(); boolean playGame = true; int firstGuess; int secondGuess; int thirdGuess; String inputStr; inputStr = JOptionPane.showInputDialog(null, "Enter the First … | |
Filename is "htb.java". Here is the code:- import java.io.*; import java.util.*; import java.lang.*; public class htb{ public static void main(String[] args) throws Exception{ File f= new File("dyna.txt"); BufferedReader in = new BufferedReader(new FileReader(f)); String[] line = new String[40000]; line[0] = in.readLine(); int i=0; while(line!=null) line[++i] = in.readLine(); String[] mem_add=new String[100000]; … | |
Hy , I am using netbeans to create an app. I wanted to eliminate the windows buttons (minimize , maximize , exit) so i could have full control on the exit button , and i used setUndecorated(true) in the PuppetApp.java (main app that netbeans creates). Now i created a exit … | |
here, there are two functions in branchpredictor class namely predictor and trainer. [B]what i have pointed out is that predictor is working fine but trainer is not updating the variables of the above class. is it that only first function can access the variables. [/B] if not, can any one … | |
Hi, I m writing code to map single key(Integer) with array of values. But, its not giving the correct output. Here is the code: [CODE]import java.io.*; import java.util.*; class MapDemo{ public static void main(String args[]){ TreeMap<Integer, Object[]> tMap = new TreeMap<Integer, Object[]>(); Object[] vals = {"tree", "map", "sorted"}; tMap.put(1, vals); … | |
the following code is used to get the contents of an excel document and pint it to console - will eventually filter and write a new excel file, but that will come later. [CODE]/** * */ import java.io.*; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.swing.*; import java.awt.*; import java.awt.event.*; … | |
hi, im trying to create a program that records the amount of times a number was rolled using input from the user. currently it is only printing 1 number and i need it to print 6. i am only beginning to study java so im lacking knowledge a bit. any … | |
hi I came up with this code to help me convert a string into an integer array but i keep getting a null exception when i run it and i am not sure how to fix it. [CODE] import java.io.*; import java.lang.reflect.Array; public class test { static String message; static … | |
Hi all, I'm new to java programming but finding it rather fun and interesting. Right now I have [CODE]for(String name : chkNms) { JCheckBox checkBox = new JCheckBox(name); checkBox.setMnemonic(KeyEvent.VK_C); checkBox.setSelected(false); // checkBox.setActionCommand(name); add(checkBox); checkBox.addActionListener(this); }[/CODE] to create all the check boxes I need, roughly 30 or so. The last line … | |
Hello guys, I've been trying to make a program that takes the IDs from a file and make them into a 1D array. The input file looks like this : 201053420 201052456 201488540 201384345 And it should be working even if there's more than 4 IDs. [CODE] import java.util.*; import … | |
Hi, [CODE] package guiInt; import java.awt.*; import javax.swing.*; import javax.swing.tree.*; public class Init { public Init() { } void buildFrame() { JFrame window = new JFrame(); window.setTitle("Pos Setup Tool 0.1 Alfa"); window.setSize(800, 600); window.setResizable(false); JPanel sidebar = new JPanel(new GridBagLayout()); sidebar.setPreferredSize(new Dimension(250, 600)); sidebar.setBackground(Color.black); JTree tree = buildTree(); JScrollPane sidebar_placement … | |
This is the instruction: Mrs. Rogers, the owner of "Jus' Right supermarket", has asked your consulting firm to design a program for a simple cash register system which will allow the cashiers at the shop to total the price of the items being bought by a customer, calculate the tax … | |
So I have this small program that draws circles of different colors depending on "velocity" Below is my code, btw I haven't actually implemented velocity yet. When I run it, I get these"[CODE]Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException at Mouse.paintComponent(Mouse.java:35) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown … | |
hi i'm having some trouble with objectinputstream. i wanted to know if it is possible to validate whether the contents are string or integers then i also wanted to ask how i could convert the contents to int []. For the latter i tried converting it to char [] first … | |
I have two strings like so: [CODE] String a = "on matt to"; String b = "onomatopoeia"; [/CODE] I've been trying to do... [CODE] if (a.contains(b)) return true; [/CODE] It returns true in this case since the character sequence "mat" matches the "ono[B]mat[/B]opoeia". I want it to return true only … | |
Hello programmers, can anyone tell me how to add or set alternative name for certificate to the keystore? I am trying to create web service client using netbeans and when it trying to get wsdl description from site it gives me: java.security.cert.certificateexception no subject alternative names present Site is under … | |
Hi there, I usually feel really bad posting a whole bunch of code, but might any of you have an idea of why I'm getting an output of 105553 for 55555*66666? I'm supposed to use the A La Russe algorithm for multiplication: n*m m if n = 1 (n/2)*2m if … | |
Please can you help me to solve an exercise in Java ? Here is the exercise : Create e program in Java that shows an image in a panel. The program let the user to make 2 clicks repeated ( make first click and immediately make the second click. ) … | |
i actually learned java only a day ago and we have to submit assignment after two days. i wanted to figure out what i did here with class and function definition is correct. if correct can you help me out with the compilation error. in fact all are similar. it … | |
i dont know whats wrong with this program...the compiler compiles the program but when i run it it shows: j[B]ohnrambo@ubuntu:~/Desktop$ java lora Exception in thread "main" java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:443) at lunda.l2read(lora.java:24) at lora.main(lora.java:124)[/B] [CODE] class lunda{ String[] la=new String[2048]; String[] lb=new String[2048]; int[] lvalid_a=new int[2048]; int[] lvalid_b=new int[2048]; int[] … | |
can anybody help me what is wrong in syntax of following [CODE]ihex=Integer.parseInt(s5,16); String bin=Integer.toBinaryString(ihex); System.out.println(bin); if(bin.length()-10 > 0) String orgpc=bin.substring(bin.length()-10); else String orgpc=new String(bin);[/CODE] this is what compiler shows [B]nchy@ubuntu:~/Desktop$ javac bpbc.java bpbc.java:61: error: Syntax error on token "orgpc", delete this token String orgpc=bin.substring(bin.length()-10); ^^^^^ bpbc.java:63: error: Syntax error, insert … | |
[CODE]import java.awt.*; import javax.swing.*; import java.awt.event.*; public class ClientProgram implements ActionListener{ //static FilmCollection collection = new FilmCollection(); static boolean condition = true; static int memberPassword = 123; static JButton button1, button2, button3; public static void main(String[] args){ int mPassword; JFrame myFrame = new JFrame("Member Login"); //window's title myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//perform exit when … | |
I am writing a Java program, a MP3 Manager, but I have problems to work with buttons, TextFields, and TextArea. Here are the problem descriptions. Create a class MP3 with instance variables for: artist, song, album, track length (in seconds). Provide a constructor, get/set methods, and a toString. method. The … | |
I have this assignment where I have to make an xml that has movies names and info. Then i have to make a StAX program that locates the xml file and reads it. The program should also be able to count the number of movies in the decade. Thats the … |
The End.