3,978 Topics
![]() | |
the question im doing is: write a java program that allows the user to enter a set of numbers and then displays the sum and the average of the values. It should begin by asking the user how many values they will enter. you should use two seperate methods to … | |
I am making an ATM machine and trying to get my accounts from a .csv file to an ArrayList and am having all sorts of issues. Can I get help? It is giving me problems on line 52 of the class where I read and put the items into Arraylist. … | |
i need to compare these two arrays. one array in the lottotest class, method getdata gets the users numbers and stores them in an array. the nest in loto class, method gendata, generates 6 random numbers between 1-9. i need to then call both methods into the main method and … | |
hi, does anyone know how it would be possible to change my code so that the circles drawn by the applet are resized as the applet screen size is changed? [CODE] import java.awt.Graphics; import javax.swing.JApplet; import java.awt.Color; @SuppressWarnings("serial") public class OvalApp extends JApplet { private int width, height, x=10, y=10; … | |
Can you help me put actions to the buttons [code]public class TimeIn extends javax.swing.JFrame { /** Creates new form Timein */ public TimeIn() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of … | |
I have been testing out the component JProgressBar, now from what i learned so far it's easy to handle but any way i try it i cannot get it to work. To explain: I want to have a JProgressBar component that will show the total and consumed amount of oil. … | |
This program is supposed to display a frame with a label that contains an image,two buttons, and a text field. When the user clicks the button the image is supposed to change. I know I don't have the code for the change in the text field. I am just trying … | |
I am trying to make a storyboard program, but I am having trouble displaying the currect amount of windows per page. my basic program looks like this [] = button to open editor [+] = add new button [>] = next page [<] = previous page Frame [] [] [] … | |
Hi there, I am trying to display three Attributes assigned to each "Student" which variables are defined in my 'Student' Class. In my show student class, I can get the user to decide how many Students they would like to add, and i also get the user to input the … | |
[CODE] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Test extends JFrame implements ActionListener { JTextField t1=new JTextField(10); JTextField t2=new JTextField(10); JTextField t3=new JTextField(10); JTextField t4=new JTextField(10); JTextField t5=new JTextField(10); JTextField t6=new JTextField(10); JButton b1=new JButton("MakeReservation"); JButton b2=new JButton("DeleteReservation"); JButton b3=new JButton("searchReservation"); JButton b4=new JButton("printResrevation"); JButton b5=new JButton("clear"); JButton b6=new … | |
I get an error "Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.JButton cannot be cast to javax.swing.JPasswordField at def3.password$MyActionListener.actionPerformed(password.java:103)" in the following code, what am I doing wrong? [CODE]static class MyActionListener implements ActionListener { private String userInput = "username"; private static final String passText = "password" ; JFrame frame ; MyActionListener(JFrame f){ … | |
I am trying to create a menu GUI. I think I am having problems with the action listeners Any help would be great. Thanks Write an GUI application that display a menu system. The menu system should allow the user to select one package, one phone, and any of the … | |
Hi, I am having a problem with this program. I don't know why the counter won't work correctly. After "doctor is out" is clicked the inCounter should be zero. So when the "doctor is in" is clicked "the doctor is in" should be displayed, but "the doctor IS IN, Already!" … | |
I've made a small program that draws black rectangles on a JPanel at random places. I would like to give the user the option to save this JPanel as a .gif file, but I'm not sure where to start. The function I need to write is SaveJPanelAsGIF below on line … | |
Hi!! my application have 2 frames including tabel 1,tabel 2 when run time i insert values though textfileds to tabel 1 ,after inserting 5 or more then i click next button then display other frame with tabel 2 and tabel 2 must auto filled. my problm is last row(i already … | |
For a school project, I am trying to make a program that gets user input and finds the factorial of the input. I wrote this bit of code and got tons of errors. Help, anybody? [CODE]import javax.swing.*; import java.awt.*; import java.io.*; import java.util.*; class TestFactorial { public int x = … | |
I am in desperate need of help... I were to create Operating System's Shortest Job First Preemptive Algorithm .... The problem is that I am not getting how to calculate the average waiting time of each process... HELP ! SJF.java: [CODE] import javax.swing.JOptionPane; import java.util.*; public class SJF { int … | |
Hey guys! I created a facebook type program. The user may load an image, tag the image, and remove tags. I've done the loading of an image, now I'm working on tagging the image. My problem is how do i make it so that when I click the "Tag photo" … | |
![]() | My Applet is working but I have 2 issues, I cannot get away from the 'metal' plaf background (trying to make it all solid blue) and when the user clicks on the 1st text box I want the prompting text to clear for the user to type their own. No … ![]() |
![]() | Im writing the Applet GUI code that uses another class to translate a string into pig latin (dubbed PigLatin.class) My gui has two text areas, a few labels, and two buttons, but I'm having some trouble with event handling. [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TxtCrypt extends JApplet … |
Using the file of sunset data, write a program using graphics that shows the sunset and sunrise. When I run the program, it says java.lang.NullPointerException. I want to know where I put the sunset data file. I am using eclipse. Here is my program: [CODE] import javax.swing.*; import java.io.*; import … | |
I'm having a hell of a time trying to make a login form. This is what I have at the moment.... [CODE]import javax.swing.*; import java.sql.*; import java.awt.*; import java.awt.event.*; class LoginDemo extends JFrame{ JButton SUBMIT; JLabel label1,label2; final JTextField text1,text2; LoginDemo(){ setTitle("Login Form"); setLayout(null); label1 = new JLabel(); label1.setText("Username:"); text1 … | |
I am getting this error. [CODE] Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 >= 0 at java.util.Vector.elementAt(Unknown Source) at Game.collision(Game.java:176) at Game.<init>(Game.java:20) at Frame.<init>(Frame.java:12) at Frame.main(Frame.java:31) [/CODE] The game was working, but when the enemies came on the screen it started lagging, so I made another thread, and just copied the … | |
Hi, I've made a JApplet trying to simulate a macroeconomy. It works as I want it to when viewed in appletviewer, but when I view it from a browser, clicking Proceed after having changed values of JSliders in EconFinalM.class doesn't work. EconFinal.java: [CODE]import java.awt.event.*; // Import Libraries. import java.awt.*; import … | |
So im making space invaders, and I cant quite figure out what I have to do in order to get the ship to move. I have the beginning of the movement code in SIbase, but I am unsure what to do from there These are the three classes that are … | |
Hi I am new to Java and this is my issue. I can compile my code successfully but when I try to get the program to run it gives me an error stating.... [code=text]Exception in thread "main" java.lang.NullPointerException at TictacToe.makeTicTacToe(TictacToe.java:37) at TictacToe.<init>(TictacToe.java:25) at TicTacToeMain.main(TicTacToeMain.java:13) Press any key to continue . … | |
I am trying to do a simple chat client for the Android (running 2.3.3 on an emulator on my computer and programing in eclipse. Below is a copy of my client code which is working fine as a normal java app. Below that I have what I have been working … | |
I've been searching the internet for a way to specify the size of a component within a JPanel, but I haven't been able to find anything that has worked. The best answer I came across was to override the getPreferredSize(), getMaximumSize(), and getMinimumSize() methods of the component, but the component … | |
Hello Forum, Vaironl here. I'm going to ask a question, that will most likely annoy you all, but first let me say this, I did some research but cannot use a Jscrollbar efficiently. That being said, I want to give more details. I'm trying to add a scrollbar to a … | |
I'm trying to make a program that has the possibility to vote for different people. When a vote is added to a person, I want the pie chart above to change according to the votes. I have everything done except for the part of the pie chart changing. This is … | |
I'm working on a program for class that uses the method Math.random( ) to generate random integers between 1 and 6. Then generate ten-thousand numbers between 1 and 6. Then calculate the number of 1 that has appeared, the number of 2 that has appeared, and so on. The final … | |
package ch07_auxiliaryclasses.taxcalculator; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class UPAdvisor extends JFrame implements ActionListener { JButton displayadvice = new JButton("Displayadvice"); JTextField displayadviceTxt = new JTextField(11); JSpinner ucasPointSp = new JSpinner(new SpinnerNumberModel(0,0,180,10)); JRadioButton Degree = new JRadioButton("Degree", true); JRadioButton FoundationDegree = new JRadioButton("Foundation Degree", false); ButtonGroup bg = new ButtonGroup(); … | |
[CODE]package ch07_auxiliaryclasses.taxcalculator; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class UPApp extends JFrame implements ActionListener { JButton displayadvice = new JButton("Displayadvice"); JSpinner ucasPointSp = new JSpinner(new SpinnerNumberModel(0,0,180,10)); JRadioButton Degree = new JRadioButton("Degree", true); JRadioButton FoundationDegree = new JRadioButton("Foundation Degree", false); ButtonGroup bg = new ButtonGroup(); JButton doneBtn = new JButton("DisplayAdvice"); … | |
I cant seem to save these data correctly I have mainly doubles and strings, I am saving these in a .txt file called "autosAudi.txt", I get these weird codes and boxes and sometimes for whatever reason Chinese in my textfields? Here is a example of what appears: [url]http://www.flickr.com/photos/63259070@N06/6449175293[/url] as you … ![]() | |
I'm supposed to be making an inventory program with a logo. I can get the inventory part working fine in a jframe, and I can get the logo working fine in jpanel, but if I combine them it starts acting really weird. Every time I click a button, it generates … | |
Hi everyone i have this simple banking program here and i was hoping someone could help me jazz it up.. Something simple like making it easier to use or making it look better. Just trying to go beyond what was asked for.. [CODE] import javax.swing.JOptionPane; class MiniLab5z { public static … | |
Hi, I am a new Java Programmer.could you help me in resolving this. I am trying to created a JPanel withing a main JPanel. For the nested one, i have included Grid Layout and i am trying to add components to it dynamically. i.e i have added a combo box … | |
import javax.swing.*; class ch9reverse{ public static void main (String [] args){ int Character, count = 0; char letter; String Str; Str = "The gate to Java nirvana is near"; [COLOR="Green"]For this must print out the "ehT etag ot avaJ anavrin si raen[/COLOR] Character = Str.length(); System.out.print(reverseString(Str)); | |
![]() | [B][I]This it only for people who are running a DUAL Monitor system.[/I][/B] I wrote a sample program to display what occurs. No matter which button I click on (Primary Display OR Secondary Display), the JOptionPane will pop up on the Primary Display. What I would like to happen is... If … ![]() |
I am writing a program that has a few requirements. Here is what it looks like the picture that I attached. [B][COLOR="red"]The first button is used to add (append) a record to a text file containing MP3 records.[/COLOR][/B] When an MP3 is added to the file, all text fields should … | |
I have four JFrames open in an application. I wish for one of them to be the base JFrame, and when one of the others is closed than everything except the base frame will dispose. How do I link the other three JFrames so that when any one of them … ![]() | |
![]() | Hello people, I found a program on internet that reads 2 text files "maze.txt" and "randomMaze.txt" in which we can find *, space, S (for start) and E (for end). It resolves this maze by using DFS algorithm. My problem is that it does not run, it says there is … ![]() |
Okay I am fine tuning my program and would like to have a new JOption Message appear when a particular input is caught and have the exception message thrown. I am trying to get my input to come from my combo box but getting the cannot find symbol message". Am … | |
Hey guys! So, created a File Chooser that gets a picture. And I want the program to display the picture on the jFrame. How can I accomplish this? I'm using NetBeans, and I'm still kinda new to it :P Thanks guys! :D Here's my code: [code] import java.awt.image.BufferedImage; import javax.imageio.ImageIO; … | |
![]() | Hello people I have a JFrame which container is a JPanel: can you give me a piece of code that shows how to create a grid of rectangles ? I need this information for my poject Thank you ![]() |
Hello. I have a piece of code currently where I have a JFrame that I have removed the title bar and borders etc from using .setUndecorated(true). I have tried a number of ways with no success to make this window draggable by it's client area. [CODE] JFrame f = new … | |
Do you have any ideas of how to bring Swing to a web site? Not use applet, but Swing only. Any sample code is appreciated. MyDreamGirl | |
![]() | Hello people, I have a 2 dimensional array of integers where 0 indicates a road and 1 indicates a wall: can you give me a general idea on how to draw a maze according ot my matrix on JFrame window that has JPanel as its contente pane ? Thank you … |
I cannot figure out why i have this error.It may just be a missing semicolon but i can't find where. Here is my code:(error occurs in many lines, so i can't show where exactly is the problem) /* * To change this template, choose Tools | Templates * and open … | |
Ok so i have this work for my java class done so far. And i cannot figure out how to get the different letters from an inputted word to output as a number. The assignment is get a user to input a 7 letter word and output it as a … |
The End.