3,978 Topics

Member Avatar for
Member Avatar for rena0514

I get this when i click on the done button in my program: [CODE]Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at BillPanel.getTotalPrice(BillPanel.java:49) at BillPanel$ButtonListener.actionPerformed(BillPanel.java:62) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) …

Member Avatar for rena0514
0
194
Member Avatar for stain3d

Hello! I'm doing a thing to where the java program will let the user input a length, and width of a triangle. In return it will show the length, width, and the area. I think I have everything correct here, however, the public voids I inserted does not work... Any …

Member Avatar for cale.macdonald
-1
128
Member Avatar for KillerZ123

I am new to sockets and trying to make a simple two person chat program and I have everything working except for the receiving and printing of the messages to the jtextarea. I am not sure why it isn't working here is my code: Driver: [CODE]import java.awt.*; import javax.swing.*; public …

0
39
Member Avatar for jxmst32

I am currently writing a program which will perform binary to decimal, decimal to binary, hexadecimal to decimal, decimal to hexadecimal conversions, 1's compliment, 2's compliment, and show the list of boolean algebra rules. I have created the JFrame and the JButtons to create the GUI however, I cannot figure …

Member Avatar for BestJewSinceJC
0
380
Member Avatar for vampshay

import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; // user defined type where we put name class riot2{ private String name; public riot2(String _name){ name = _name; } public String toString(){ return name; } } public class finalriot2 extends JFrame{ Container c = getContentPane(); private Stack sstack; // …

Member Avatar for stultuske
0
75
Member Avatar for adity

I have an eclipse application from which i trigger an Swing widget.On click of a button on the SWT composite a window pops out which contains the Swing Table. Now i want a button on this Swing page to show up an eclipse workbench window. Any idea on how I …

Member Avatar for BestJewSinceJC
0
351
Member Avatar for nyny11211

please tell me where i'm off the window opens but no menu bar. the error says : java:52: '.class' expected menuInput[][] = array [row][col]; thanks hs [CODE] import java.awt.*; import java.awt.event.KeyEvent; import javax.swing.*; public class Driver{ public static void main(String[] args) { TheWindowObject aTestFrame = new TheWindowObject ("test"); } } …

Member Avatar for nyny11211
0
80
Member Avatar for BuhRock

I just wrote my first program using methods (I am only on chapter 5). I am not sure where I would use javadocs other than the ones that I already have in my code. Can someone help me? [code]/** * @author Brock Shelton * Date: March 15, 2010 * purpose: …

Member Avatar for BestJewSinceJC
0
157
Member Avatar for xsimsyx

I am using netbeans 6.8 and the program is running in a applet. Hi,would you know the answer to this simple question.When a user is prompted from the text area to input their name in the textfield what would make the program display the next paragraph of text in the …

0
52
Member Avatar for zheka

Hi all, I am very new to the Java and would like to get help with the Swing components in the thread: below is an ActionListener for the MOVE button which would simulate random movement of random circles on JPanel. I have created separate class RandomCircles which extends JPanel and …

0
55
Member Avatar for idlackage

I'm supposed to allow the user to draw shapes based on their combobox choices (eg. line, rectangle, circle), colour, fill state, etc. However, nothing is showing up. Model class: [CODE]import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; import javax.swing.JLabel; import javax.swing.JOptionPane; import java.awt.event.MouseAdapter; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.MouseEvent; public class DrawPanel …

Member Avatar for Ezzaral
0
191
Member Avatar for ozidub

Hi, I'm new to Java and am having a problem getting my program to run, any help would be greatly appreciated. Here is the program: [CODE]//This program displays a message asking the user if they //want to know the Top Premiership Players. If they say Yes, //they will then be …

Member Avatar for masijade
0
107
Member Avatar for Dark.Paladin

hy im having a little problem with a loop with jgrasp here is my basic program [code] import javax.swing.JOptionPane; public class loops1 { public static void main (String[]args) { String name do { String name = JOptionPane.showInputDialog ("who is the cleverest person in the room?"); } while (name != "erin"); …

Member Avatar for Dark.Paladin
0
156
Member Avatar for pfuturama

//less than 10= "too cold", 10-20= "avarage", 21-30="hot",bigger than 30 ="Too Hot" import javax.swing.JOptionPane; public class TmaTwo { public static void main(String[] args) { int number; int temp; String numString; numString = JOptionPane.showInputDialog ("Enter temperature:"); number = Integer.parseInt(numString); if (number < 10 ) JOptionPane.showMessageDialog(null, "Too cold", "Output", JOptionPane.INFORMATION_MESSAGE); else if …

Member Avatar for stultuske
0
106
Member Avatar for JavaNewbieEK

Hi, I am a student who has been given the following assignment. Before I am reprimanded for posting asking for assistance without providing an attempt at code, please allow me to explain. We have been given the assignment shown below with no explanation. We have not covered any of the …

Member Avatar for stultuske
0
191
Member Avatar for Alex_

Hello, i made a basic java desktop application. After building the interface in the form, i compiled it and it worked perfectly. But after i added an event to a button (on click) my app won't close. I use the X button from the title bar, or ctrl+q from the …

Member Avatar for Alex_
0
2K
Member Avatar for dj118

Hi viewers, I'm in dire need of some help. I'm currently doing a program for my studies and I have successfully compiled it and tested it. However when I try to execute the program it comes up with the error java.lang.NoSuchMethodError: Main. I've identified the problem which is the fact …

Member Avatar for dj118
0
195
Member Avatar for hallinan

[B]Hi I am trying to create a generic class form existing code I have tried to figure it out but with no avail if anyone could help it would be much appreciated I have tried to do it and this is what I have so far[/B] Here is the Class …

0
55
Member Avatar for pocix

question: The program should prompt the user to enter data for the width and height of the 2 rectangles and use the setWidth() and setLength() methods to store this data in the instance variables. driver [CODE] import javax.swing.*; public class Room { public static void main(String[ ] args) { double …

Member Avatar for pocix
0
76
Member Avatar for keny2020j

My code is : /* Database.java*/ [code] import java.sql.*; import java.awt.*; import javax.swing.*; public class Database{ private static Connection con = null; public static Statement statement = null; public static void makeConnection() { JOptionPane.showMessageDialog(null, "database"); String driver = "sun.jdbc.odbc.JdbcOdbcDriver"; String url = "jdbc:odbc:lib"; String username = ""; String password = …

Member Avatar for keny2020j
0
217
Member Avatar for hockey87

I need to write a program that prompts the user to enter 4 numbers (x1, x2, y1, y2) and the program should output the circles area, diameter, circumference, and area. I have to create these methods, distance, radius, circumference and area. I have the code done but everytime i enter …

Member Avatar for gangsta1903
0
93
Member Avatar for ctsarsh

i need to convert this java code to java applet code here in my java code: import java.io.*; import java.util.*; public class fyp { static int t_value=2; static int no_of_parameter = 0; String binary_setting; static int data[]; static ArrayList<String> constraint = new ArrayList<String>(); static ArrayList<String> seeding = new ArrayList<String>(); static …

Member Avatar for masijade
0
183
Member Avatar for ctsarsh

i need to convert this java code to java applet code here in my java code: [CODE]import java.io.*; import java.util.*; public class fyp { static int t_value=2; static int no_of_parameter = 0; String binary_setting; static int data[]; static ArrayList<String> constraint = new ArrayList<String>(); static ArrayList<String> seeding = new ArrayList<String>(); static …

0
57
Member Avatar for shawnfrancis

I am going to come right out front and say I am in computer science class and we are working on java code and I am needing help. I keep getting an error message that reads: ComputeChange.java:4: class, interface , or enum expected java.swing I understand that it is telling …

Member Avatar for stultuske
0
166
Member Avatar for pocix

hi everyone i need help how to -creates an array for 5 integers and store it in array -use the highest & lowest integer and cube it i stuck in array, i confuse how to input integers to array with JOptionPane so far for the input [CODE] import javax.swing.*; import …

Member Avatar for pocix
0
119
Member Avatar for hawglinx

I am in my first java class and I am writing an amortization program. I have gotten every thing to work correctly thus far except when I try to put in an outer loop I get the following error: 1 error found: \gnixon00Lab3Test.java:116: cannot find symbol symbol : variable restart …

Member Avatar for hawglinx
0
473
Member Avatar for handrews3583

I am very new to programming and am really struggling with Java. I'm currently working on the below code, but when I compile the program, I'm getting several messages referring to multiple lines in my code, all stating things like the following: C:\Users\Heather\Documents\HACH5_8.java:111: cannot find symbol symbol : variable showFeet …

Member Avatar for handrews3583
0
216
Member Avatar for habibalbi

I already created a class Calculator that performs basic arithmetic, now I need to create a class called ScientificCalculator that the functionalities of "Calculator" class through use of inheritance. Scientific Calculator has additional operstions of 1) taking a log of a number to any base 2) taking any number to …

0
50
Member Avatar for Dmith

how to deal with awt and swing component in java .error is produced when i compare the swing component so what i do for solving it;

Member Avatar for javaAddict
0
105
Member Avatar for Bemani_lover

I am having a small bit of trouble with a certain program. Here's the program requires. The program developed in Chapter 8 sent data to an external, sequential data named payment11192007 (or payment plus the system date for your computer). It opened a connection to the DataOutputStream and used the …

Member Avatar for BestJewSinceJC
0
237
Member Avatar for its.avinash

Hi guys, Anybody know how to generate checkboxes dynamically if i want to generate them with the result i have fetched from a database query. The query would be like that, SELECT calltype From table Where phone_no=123456; Now result of this query will vary everytime, there total number of checkboxes …

Member Avatar for stultuske
0
93
Member Avatar for bibiki

hey there, I have the following code: [CODE]import java.awt.*; import javax.swing.*; public class TabelaEShahut extends JPanel{ public static void main(String[] args){ new TabelaEShahut(); } public TabelaEShahut(){ JFrame f = new JFrame(); f.setSize(500, 500); f.setVisible(true); f.setTitle("shah"); f.getContentPane().add(this); } public void paintComponent(Graphics g){ g.setColor(Color.white); g.fillRect(0, 0, 700, 700); g.setColor(Color.red); g.fillRect(50, 50, 400, …

Member Avatar for bibiki
0
347
Member Avatar for rena0514

[CODE]//PizzaPanel.java Author: Carien Anderson import java.awt.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.JOptionPane; import java.awt.event.*; public class PizzaPanel extends JPanel { public PizzaPanel() { setLayout(new BorderLayout()); setBackground (Color.white); setPreferredSize (new Dimension(700,280)); //North panel JPanel ppan1 = new JPanel(); JLabel l1 = new JLabel("Lets Eat!"); ppan1.add(l1); ppan1.setBackground(Color.green); add(ppan1, BorderLayout.NORTH); //West panel JPanel …

Member Avatar for stultuske
0
138
Member Avatar for iammirko

Hi, I have used the following code (this is from HeadFirst Java Book) [CODE] import java.awt.*; import javax.swing.*; import javax.sound.midi.*; import java.util.*; import java.awt.event.*; public class BeatBox { JPanel mainPanel; ArrayList<JCheckBox> checkboxList; Sequence sequence; Sequencer sequencer; Track track; JFrame theFrame; String[] instrumentNames = {"Bass Drum", "Closed Hi-Hat", "Open Hi-Hat", "Acoustic …

Member Avatar for gangsta1903
0
152
Member Avatar for ceyesuma

Why does this give the error "cannot reference this before supertype constructor has been called" I thought that is the first thing I did in the constructor. [code] /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package application1; import …

Member Avatar for ceyesuma
0
193
Member Avatar for timrhon

Last minute attempts to find what I am doing wrong here. I am a beginning Java Programmer, as you will see, and need help understanding why my paint method will not draw onto the panel. So far all I have tried to accomplish is to get the circle object to …

Member Avatar for timrhon
0
196
Member Avatar for JuneM

I am trying to compile this java file and it is giving me an error say : java.lang.nosuchmethodeorror.main what could be the problem? [code=c] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class JChangeFont extends JApplet implements ActionListener { JLabel banner = new JLabel("Your Name"); int fontSize = 18; Font theFont …

Member Avatar for sincerelibran
0
216
Member Avatar for laelzio.mosca

I`m trying to write a sample program in java, but the book doesn`t explain how I should write my html code to execute it, I don`t even know what I should use to write a HTML code, I looked online, but didn`t find much. this is the java code: [CODE]import …

Member Avatar for sincerelibran
0
86
Member Avatar for JuneM

I am trying to compile my java file here but I am getting 8 erros with the same sybmol : illegal start of an expression here is my coding: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class JChangeFont extends JApplet implements ActionListener { JLabel banner = new JLabel("Your Name"); int …

Member Avatar for sincerelibran
0
406
Member Avatar for nonexcep

Hi there. I'm learning Java and this is a sample applet in which I try some basic drawing operations. I hit some roadblocks and I'm hoping someone can point me in the right direction. What I want to do here basically is make a rectangle with exactly 10 pixels of …

Member Avatar for gangsta1903
0
108
Member Avatar for hondros

Okay, so I have about 6 GB of music on my iPod. I don't want to go through and copy everysingle file and rename it manually, so I am making a python script to do it for me. I would just like to have some feedback on my code, make …

Member Avatar for hondros
0
554
Member Avatar for jofin123

Hi Friends i want to Print the JTable content with Grid Could you please help me how to do that I AM POSTING my CODE HERE [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.table.*; import java.util.*; import java.sql.*; import java.awt.print.*; public class Report extends JFrame implements ActionListener, Printable,Pageable { private …

Member Avatar for rdavid
0
184
Member Avatar for litchi

Hi :) I am writing an application that converts text to braille for a varsity project. I got it working by using a library given to us by our professor, but I am trying to understand the code I am using, so I am re-writing the code and omitting any …

0
68
Member Avatar for chern4ever

i have 2 applets each in separate files. lets say i wan to click a button in applet1, and it will show applet2, hide applet1 and vice versa. how can i achieve tat? [CODE]/** * @(#)ATM.java * * * @author * @version 1.00 2010/3/1 */ import java.awt.*; import java.awt.event.*; import …

Member Avatar for jamesonh20
0
121
Member Avatar for Geodude0487

I'm trying to write an external log-in class for my Adv Java class in school. It's an online section and the teacher is very hard to reach thus why I'm asking for help here :). But my problem is right now I have my log-in form and I have it …

Member Avatar for Geodude0487
0
126
Member Avatar for syed aamiruddin

[code] import java.awt.*; import java.awt.event.*; import javax.swing.*; public class SelectLayout extends JFrame implements ItemListener{ public static void main (String[] args) { SelectLayout sl=new SelectLayout(); } JMenuBar menuBar; JMenu lmenu,cmenu; JRadioButtonMenuItem lrbmenuItem,crbmenuItem; JPanel menuPanel,bPanel; JButton button; public SelectLayout() { super("Select Layout in swing"); menuPanel=new JPanel(); menuBar=new JMenuBar(); lmenu=new JMenu("layout"); ButtonGroup gp=new …

Member Avatar for stultuske
0
295
Member Avatar for Bemani_lover

Ok, so I'm having a bit of trouble with understanding how swing interfaces work. Here's the problem. Write a Swing program that declares an empty array of grades with a maxium of 10. Implement a JOptionPane input box within a while loop to allow the user to enter grades using …

Member Avatar for kvass
0
173
Member Avatar for astronomical

All, I have worked extensively on my looping and sentinels here. As you can see I have my program working but it is not taking the series. I know I am missing something stupid but I just can't put my finger on it. I have my inupt validation working as …

Member Avatar for javaAddict
0
841
Member Avatar for LucarioWill

Thanks so much for bothering to look at this n.n; I've been kind of confused in this class, mainly because I have no idea what the teacher's saying; her English isn't that great, and she has no in-class coding exercises so we're learning entirely from her crappy powerpoints. I'd have …

Member Avatar for Ezzaral
0
132
Member Avatar for sandyben

i hava a code called home.java [CODE] import javax.swing.*; import javax.swing.JScrollPane; import javax.swing.JTextArea; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.Random; import java.util.*; import java.text.*; class home extends JFrame implements ActionListener, Runnable { JButton btndetect,btntest,btnstart,btnexit,btntransfer; ImageIcon ic,ic1,bc; JLabel lbltitle; JTextArea textArea ; JScrollPane scrollPane; JPanel panel; Thread t; public home() …

Member Avatar for sandyben
0
2K

The End.