32,204 Topics
| |
I have a piece of Java code where users will get a bunch of outputs (outputs are numbers). I am trying to edit this code so that I can display the output as a Java Applet via webpage. Here's a part of the result I need to show. String s1 … | |
A lecturer has a text file which includes a list of students name and final exam marks. Create a Java program which: * Read all the records from the file * Sort all the records from the file and * Exit from application | |
Hi, I have a "Save" button with the following code Save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { k = k+1; System.out.println(k); } }); somehow, it is executing multiple times with single click on the button (k values is 4 at times). I googled it but couldn't find some helpful … | |
Hi, I have a split container in my frame where the right container has a Jtable and left is filled with different collapse panels displaying detailed data from different parts of the table. If the user clicks on a column then a collapse panel expands and display the information If … | |
Hi guys, I am confused on how can I access a same class reference object , that is created in class ReadInoiceFile, and be accessed in ReadErrorFile. To be more specific: I have a class called Transaction And then I have a class called ReadInvoiceFile. And finally I have a … | |
Hi All, I have written an application for traffic Study which takes traffic load for seven days, inputting traffic load during morning,lunch,evening and night for each day. The output im getting is this Morning Lunch Evening Night Average Day 0 : 5 5 5 5 5 Day 1 : 5 … | |
I get an unknown source error when I try to use the Scanner class. fabric is the name of my Scanner ojbect. while(fabric.hasNext()) { fabricID[fabricCounter] = fabric.nextInt(); name[fabricCounter] = fabric.next(); description[fabricCounter] = fabric.next(); price[fabricCounter] = fabric.nextDouble(); qty[fabricCounter] = fabric.nextInt(); vendor[fabricCounter] = fabric.next(); fabricCounter++; System.out.println("made it down here"); }//end while fabric.close(); … | |
Hi All, Im generating some output files(kind of reports) in my reportGenerator class.Acutally im creating then into hard disk and showing them in browser. But i want this scenario to be developed into my project : Want to return the generated file as stream to another class, and show that … | |
We all use `this` keyword many times explisit with our instance fields or constructor, however, this refers to* current object*, for example: class Foo imlements ActionListener{ Foo fooObject; public Foo(){ //.... button.addActionListener(this);//this work as we pass the current object reference as an argument //or button.addActionListener(fooObject);// this will compile, but the … | |
Help! application is rapidly degrading..... I have had problems with netbeans being able to keep subprojects incorporated with the main projects (loaded into tabs). Usually solved by recompiling the missing .java file, doing a clean build and they load back in. Now I have the error, component cannot be intantiated.... … | |
**I want to enter the value in jtable run time and want to dispaly its sum on same jtable when i pressed calculated button ** how to do please help :) import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import … | |
Hello, I have an app that runs good in the NETBEANS ide. When I run it as a stanalone exec.jar and place the executable in the project folder or when I place the executable on the thumb drive it runs with anomolies. When I run the app from a thumb … | |
A student of mine wrote the following code: public class Counter{ private num = 0; public void inc(){ num = num++; } } which fails to increment. Why? If num starts at 0, then the assignment should be num = 0 then num should increment during the postfix incrementation of … | |
Hello, I have a textfield price. The user has to input a price(currency) into it. I would like to do something so that when the user types in a curreny it will automatically add the commas and the zero when needed. If the user was to type in 1000000 it … | |
I need help with some methods in my constructor class. My first method receives scores, computes test totals, stores them in an array and returns them. public int[] computeStudentTotals (int[][] scores) { } My next method computes grades. It invokes the computeStudentTotals method to compute the totals of three tests … | |
Ok so im working on a mapping library for my pathfinding system and im trying to figure out what Data structure would be best to use for rapid calls up to several hundred a second, as low memory usage as possible, and not too difficult to store and load pieces(chunks) … | |
Heres my code [CODE]import java.applet.Applet; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Order extends Applet implements ActionListener { String password = "pword"; TextField txt1 = new TextField(10); TextField txt2 = new TextField(10); Button btn1 = new Button("Ok"); Button btn2 = new Button("Ok"); Label lbl1 = new Label("Choose Your Order"); … | |
hey there, in a project I am involved, someone put a test class in main code. eclipse would not find the bug but mvn, not that in eclipse, would report a compile error, and we found the bug. because of that, I wanted to build my new maven project without … | |
Hi, First, thanks for reading this stuff. I am learning java. I recognize that I am a beginner. Last weekend I have coded a clock. Sourcecode is: import javax.swing.JFrame; import java.util.GregorianCalendar; import java.awt.image.BufferedImage; import java.awt.Canvas; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Color; import java.util.TimerTask; import java.util.Timer; import java.awt.BasicStroke; public … | |
How can I get the mouse position even when an event hasn't been performed, eg. I haven't clicked or left window, etc. Kind of like mousing over something. I am currently using a class that implements MouseListener, MouseMotionListener for events such as clicking and releasing but I would like a … | |
First thing i want to say is i am sorry if this is not the appropriate place to post this. I am basically looking for an open source project to work on. I honestly have no idea how to find one or how to become a part of one. I … | |
For my **Java to C#** conversion project, I need to use something equivalent to Java's `Calender` class. I have some codes like: Calender cal = Calender.getInstance(); long time = Calendar.getInstance().getTime().getTime(); long time2 = System.currentTimeMillis(); which returns some random values at different times. I have come to know C-sharp's `DateTime` is … | |
Hi All, Im still finding it hard to understand Paint method, Almost all websites i had gone thru, they are showing examples of how to use it in an applet. I just cant understand on how to use it in a GUI application by extending Jframe object. Here is one … | |
What are the differences and similarities of JAX-WS and JAX-RS? | |
This is my ScreenManager class which is used for getting the perfect DisplayMode & setting the screen to fullscreen import java.awt.*; import java.awt.image.BufferStrategy; import java.awt.image.BufferedImage; import java.lang.reflect.InvocationTargetException; import javax.swing.JFrame; public class ScreenManager { private GraphicsDevice vc; //give vc access to monitor screen public ScreenManager() { GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment(); vc … | |
I have a project and I don't understand what the instructions want me to do. Can someone explain them better...? I don't understand constructors, objects, and methods very well but I am trying my best to do this project (i am a bit amazed how i got the highest grade … | |
Hi All,We have a java application which does deal with lots of insert,update and select statement.We are using bonecp. So we took some sample heap and analyse it with MAT and its pointing to jdbc leaking. Thus we went into the codes and ensure that all resultset,statement and connection are … | |
I have a jtable and inside this table is a column of checkboxes (other info on following columns). if the user clicks on the checkbox to change it, which it does, there is a popup that comes up for an administers password approval... got that. If the approval is accepted, … | |
I tried using BorderLayout as in label but does not work package HelloWorldGUI; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class HelloWorldGui { private JFrame a; private JPanel p; private JButton b1; private JLabel lab; public HelloWorldGui() { gui(); } public void gui() { a = new JFrame("window"); a.setVisible(true); a.setSize … | |
Hi All, I have a doubt in paint method of the Component Class. I know how to use that in Applet but im finding it hard to use it in GUI app. Im posting my code here, please edit it to make the program use paint method to render any … |
The End.