3,978 Topics

Member Avatar for
Member Avatar for kinger29

I have created a JApplet and I want to be able to clear the screen and draw new components depending on what button I click on. Right now the code below will clear the screen but it doesn't redraw the JTextFields (label_1 & label_2). However I did notice whenever I …

Member Avatar for quuba
0
249
Member Avatar for BlendedFrog

Working on a project that is basically a simple bowling program that uses a gui to read in from a given text file a pre-determined amount of names and scores...runs through the standard 10 frame scoring system, prints out the score, and who won. Now I can't seem to get …

Member Avatar for eggmatters
0
145
Member Avatar for FriQenstein

Hello all, I have an app that I'm building, slowly as I learn, and I'm having some issues with the JDialog implementation. I'm using NetBeans which generates pretty much everything except for the gutsy bits of code needed... (i.e. code for button actions, etc) I have my main application which …

Member Avatar for FriQenstein
0
1K
Member Avatar for tsfaridi

I am using this code for displaying images on JPanel, in which i succeeded, but the images are volatile. When i maximize or minimize the frame, it vanishes. [code] public class ImagePanel extends JPanel{ private BufferedImage image; public ImagePanel() { try { image = ImageIO.read(new File("image name and path")); } …

Member Avatar for tsfaridi
0
90
Member Avatar for karen.tao

I am creating a GUI program with java and when I run it, I get this stack of errors. [CODE] Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at ButtonPanel$AllocateListener.actionPerformed(ButtonPanel.java:52) 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:6263) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:6028) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4630) at java.awt.Container.dispatchEventImpl(Container.java:2099) at …

Member Avatar for darkagn
0
268
Member Avatar for beshoyatef

Here i draw chessBoard and adjust affect of appearin blue rect when player press by mouse on the above two rows but the pawn image not appear . I made [B]intializingIcoss()[/B] on class[B] BoardGame[/B] then the method appear but when the image not appear when i put the method on …

Member Avatar for beshoyatef
0
127
Member Avatar for pradeep_09

This error is triggerred whether the bpressed objects is an Integer or a string I have defined the seatno as a number type in ms access and status as a text type in ms access I hav tried [CODE]bpressed=Integer.parseInt(ae.getActionCommand())[/CODE] But it does not make any difference to the outcome Thanks …

-1
56
Member Avatar for cgeier

I am trying to write a program to display the unicode character when a user enters a unicode character code. ex: If the user enters: "\u00C3" in the textfield, I want to display a capital "A" with a tilda (~) over the top of it. Here's my code so far: …

Member Avatar for cgeier
0
2K
Member Avatar for xonxon

[code] import javax.swing.*; import java.awt.GridLayout; import java.awt.event.*; import java.text.*; public class TFE extends JFrame implements ActionListener { public TFE() { str txtfNum1,txtfNum2,lblAnswer; setLayout(new GridLayout(3,2,5,5)); add(new JLabel("First Number:")); add(txtfNum1); add(new JTextField(10)); add(new JLabel("Second Number:")); add(txtfNum2); add(new JTextField(10)); add(new JLabel("Total Summation:")); add(lblAnswer); txtfNum1.addActionListener(this); txtfNum2.addActionListener(this); } public void actionPerformed(ActionEvent e) { String str; …

Member Avatar for JamesCherrill
0
136
Member Avatar for ahmedshayan

Write a class Employee. An employee has a private first name (string), private last name (string), private job title (string), private employment ID (string), private monthly income (double), private joining date (string), and private mailing address (string). Provide a default constructor, a parameterized constructor, and a clone constructor. Write separate …

Member Avatar for ahmedshayan
0
238
Member Avatar for Room101

I'm attempting to create an applet for teaching languages, it plays a sound, then lets you record your voice, then plays back the sound again and then your voice. It has two buttons, one to move on to the next word, and another to repeat the same word (NOTE: repeat …

Member Avatar for Room101
0
87
Member Avatar for RejectKid

ok so i need my code to be able to have the balls on the screen detect collision and remove a ball when they collide but for some reason every time i hit the add a ball button they disappear on me. and they dont detect collision in the first …

Member Avatar for quuba
0
235
Member Avatar for JavaCode

OK I'm making a script and I get this error and have no clue off have to fix heres the code all help is thanked: [CODE]import java.awt.*; import java.util.*; import java.util.List; import java.util.logging.Level; import javax.accessibility.*; import javax.swing.*; import org.rsbot.bot.Bot; import org.rsbot.script.*; import org.rsbot.script.wrappers.*; import org.rsbot.accessors.*; import org.rsbot.event.listeners.PaintListener; import org.rsbot.event.listeners.ServerMessageListener; import …

Member Avatar for kekkaishi
0
175
Member Avatar for rjay_lolerzz

import java.io.*; import javax.swing.*; class GS { static public void main(String[]args) throws Exception{ double q, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, x, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, quotient, quotient1, quotient2, quotient3, quotient4, quotient5, sum, sum1, sum3; System.out.println("PRELIM LEC"); { …

Member Avatar for peter_budo
0
245
Member Avatar for vampshay

can u help me how to connect to MS Access database using java codes?? import java.applet.Applet; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.lang.StringBuffer; import java.io.IOException; import java.io.*; import java.sql.*; public class sample1 extends JFrame { private DataPanel myDataPanel; private Connection dbconn; private static int numPeople=0; private static String info; …

Member Avatar for masijade
0
123
Member Avatar for xonxon

[code] this is the simple program that i write import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JFrame; import java.awt.FlowLayout; public class ShowFlowLayout extends JFrame { public ShowFlowLayout() { setLayout(new FlowLayout(FlowLayout.LEFT,10,20)); add(new JLabel("firstname")); add(new JTextField(10)); add(new JLabel("MI")); add(new JTextField(10)); add(new JLabel("Lastname")); } public static void main(String[] args) { JFrame frame=new JFrame("ShowFlowLayout"); frame.setSize(400,500); frame.setLocationRelativeTo(null); …

Member Avatar for xonxon
0
106
Member Avatar for eggmatters

Hello all, I am writing a java application where I have a Jtable with checkboxes next to the data. If the user checks a box, I want to store a specific value from the data table. I can do this inelegantly by setting setCellSelectionEnabled(true) and adding the following to the …

Member Avatar for eggmatters
0
142
Member Avatar for ahmedshayan

1. Create a class Account that has following instance variables: a. private account number (string) b. private account holder name (string) c. private balance (floating-point) d. private account opening date (string) e. profitRate (final, floating-point): 5% for all accounts Supply a default constructor, a parameterized constructor, and a clone constructor. …

Member Avatar for javaAddict
0
785
Member Avatar for tipalm

Hello all I am trying to get a JButton to toggle the setVisible on a JPanel label with an image on it. Below is my code. Thx in advance! [CODE] import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class ButtonExample_Extended implements ActionListener { JPanel titlePanel, buttonPanel, dealerPanel, playerPanel; JLabel dealerLabel, playerLabel, …

Member Avatar for quuba
0
165
Member Avatar for chengeto

I am trying to get this program to count the number of characters in a string. By number of characters l mean not punctuation or a space.What is wrong with my code because l don't understand why the program won't work? [CODE]import javax.swing.*; publiemc class ExamPractise { public static void …

Member Avatar for ~s.o.s~
0
166
Member Avatar for bigsilk

It used to be good enough that you could design well. Those times have changed. Now you have to be a programmer, dba, and a competent designer. So, I'm seeking out all resources to become a better php, javascript, MySql, CSS, AJAX, XML, XSL, HTML, XHTML coder and still swing …

Member Avatar for Loved
0
66
Member Avatar for george21

I can't figure out how to display the ImageIcons after I get three random cards. I tried to add the .png to the random number and that didn't work. I would appreciate your help. import java.awt.GridLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class Exercise139 { public static void main(String[] …

Member Avatar for IrishWay
0
109
Member Avatar for feoperro

Hi, I would like to know if it's possible to edit specific rows from inside a textarea in a java swing application. So if I had a text area that held the following content: Row1 Row2 Row3 And I had a command like this: jTextArea1.getText().row[2].setText("New Row2"); Then I would want …

Member Avatar for peter_budo
0
123
Member Avatar for guerrund

I need to know how to do the following: Allow for editing and Allow for searching by state or by any other options This is what I have so far: [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; public class AddressBook extends JFrame { // Specify the size of …

Member Avatar for masijade
0
162
Member Avatar for beshoyatef

Hi, Here i draw chess boardgame ,but i want when i pressed by mouse on any square , blue rectangle appear .. I did this but when i pressed on any square the black and white coloe disappear and not only the square which i pressed has blue rect but …

Member Avatar for beshoyatef
0
134
Member Avatar for nope3d

....can any one knows how to sort my class union.... ...since when i run it the output is correct but i need to sort it to feel much better...... here is my program.... this is my MAIN..... [CODE]public class FinalProjectBitString { public static void main(String[] args) { MySet universalSet = …

Member Avatar for masijade
0
66
Member Avatar for Superfat

Ok, i have been working on a simplistic game for about an hour now. This is what i have so far: [CODE]import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Game extends JApplet { private int APPLET_WIDTH = 500, APPLET_HEIGHT= 100; private int money; private int owned; private JLabel labelMoney; private …

Member Avatar for VernonDozier
0
12K
Member Avatar for lllllIllIlllI

I am making a slider puzzle applet. And i have this problem when i display it as an applet my buttons do not seem to act the same was as they did before i made it into an applet by using a JApplet rather than a JFrame as my extension …

Member Avatar for lllllIllIlllI
0
119
Member Avatar for nope3d

....Can anyone knows how to put some functions that if I run my program, the menu will disable my logoff menu, Maintenance and emloyee and the auhtor.........but if i press my log in it will enables the log off menu, Maintenace and employee and the author itself.... then the log …

0
54
Member Avatar for _dragonwolf_

I am having an issue converting words into phonetic spellings. Example: userInput = apple / outResult = Alpha Papa Papa Lima Echo I can get my code to convert a single letter to its respective phonetic. I can also get it to split a string into separate characters. Here is …

Member Avatar for _dragonwolf_
0
2K
Member Avatar for Clawsy

All these days I've been trying to access a Swing component (e.g.: JLabel) from a separate thread. I tried using "Thread", "Timer", "SwingWorker" but I couldn't find the solution. - Using a thread results in stack overflow. - Using a timer doesn't access the Swing component (e.g.: change the text …

Member Avatar for Clawsy
0
230
Member Avatar for akulkarni

I wish to create an application using swing to update data to the database. I will need three buttons add, modify and delete. i have so far created JDBC connection with Ms acess. i have also created a textfield where i will enter data like this... [code=JAVA] import java.awt.*; import …

Member Avatar for akulkarni
0
251
Member Avatar for shopnobhumi

This is not running in Eclipse but ran in other jvm. Not sure if there is anything missing :( [CODE]import javax.swing.JOptionPane; import java.io.*; public class file1 { static int[][] number=new int[1000][1000];; static int row,column; public static void main(String[] args) { readFile(); /*for(int i=0;i<row;i++) for(int j=0;j<column;j++) System.out.println(number[i][j]); */ String result=""; for(int …

Member Avatar for shopnobhumi
0
93
Member Avatar for No1unoin98

Ok i need some help with this JSP page that has some java in it. My assignment is to create a fictional webpage that requires a login or registration and that checks with the database to make sure that it will verify that no user with the proposed user id …

Member Avatar for masijade
0
214
Member Avatar for tnccjavaMatt

As discussed on this forum, I'm not looking for a quick answer, just an explanation on why what I have written is not working and a point in the right direction that will make this program work. Problem: Purpose of this program is to create a GUI that presents to …

Member Avatar for Jocamps
0
284
Member Avatar for HappyGoTyping

[CODE]import javax.swing.JOptionPane; public class PossitiveNegative{ public static void main(String[]args){ int N1, N2, product, PoNoN1, PoNoN2; String N1Str, N2Str, productStr, OutputPoNoN; N1Str=JOptionPane.showInputDialog("Enter a number :"); N1=Integer.parseInt(N1Str); N2Str=JOptionPane.showInputDialog("Enter another number :"); N2=Integer.parseInt(N2Str); product=N1*N2; if (N1>0) PoNoN1=N1+"(POSITIVE)"; else if (N1<0) PoNoN1=N1+"(NEGATIVE)"; else PoNoN1="(NEUTRAL)"; if (N2>0) PoNoN2=N2+"(POSITIVE)"; else if (N2<0) PoNoN2=N2+"(NEGATIVE)"; else PoNoN2="(NEUTRAL)"; if …

Member Avatar for BestJewSinceJC
0
108
Member Avatar for fortex

Hello everyone, right now I'm taking a java class, and I'm having one error in my app. Right now I have to .java files, one which calls the methods from another .java file. When I compile the first java file, it doesn't give me any error. But when compiling the …

Member Avatar for BestJewSinceJC
2
149
Member Avatar for beshoyatef

I designed chess board game before , i did for loop for rows and i did for loop for column ... and the result appear good . But here i want to make the board by two inner loop inside them . I do that but the rows not appear …

Member Avatar for beshoyatef
0
125
Member Avatar for george21

I need to display the loan table with the annual interest rate, monthly payment, and total payment for the number of years entered. When I run my program, it only displays the info for 8%, when I need to display all interest rates from 5% to 8% in increments of …

Member Avatar for BestJewSinceJC
0
111
Member Avatar for locked_twilight

This is a working program. But there is a logical error. Try this with the calculator: Press 2,M; Press R,*,2; Press R,*2; The output in the same order must be: 2 2*2 = 4 2*2 = 4 but the third one outputs 88 instead. M stands for Memory, it stores …

Member Avatar for locked_twilight
0
147
Member Avatar for scias23

WHAT i want to happen is, when i click the CALCULATOR menu item, my separate Calculator.java will run on the MenuShortCut JFrame. AGAIN, i want the separate .java file to appear on THE SAME JFrame of MenuShortCut class. here's what i've got [CODE=java] import javax.swing.*; import java.awt.event.*; public class MenuShortcut …

0
107
Member Avatar for locked_twilight

package MyJava; //change package name according to what the name of the package //the class would be installed to import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class [B]Calculator[/B] extends JFrame implements ActionListener{ private JTextField displayText = new JTextField(30); private JButton[] button = new JButton[16]; private String[] keys = …

Member Avatar for locked_twilight
0
952
Member Avatar for keekee

Uncaught error fetching image: java.lang.NullPointerException at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:99) at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:113) at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.j ava:240) at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172) at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136) [CODE]import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.FlowLayout; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.Image; import java.awt.Toolkit; import java.awt.Dimension; import java.net.URL; class Inventory { String number; // item number String name; // item name int …

Member Avatar for masijade
0
189
Member Avatar for george21

I am getting an error that says "The type Chapter165 must implement the inherited abstract method ActionListener.actionPerformed(Action Event). Can someone help me with where I went wrong? [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; class Chapter165 extends JFrame implements ActionListener { private JTextField inputMile = new JTextField(10); private JTextField outputKm …

Member Avatar for BestJewSinceJC
0
3K
Member Avatar for Zero-Method

hello smile.gif i am having trouble with the 2D array i am making.......it is supposed to be an address book of sorts Miller, Joseph, 910 Auburn Avenue, McLean, VA, 7035551234 Frank, Michael, 1 York Road, Baltimore, MD, 4105551234 Roland, Frank, 346 Bellona Avenue, Lutherville, MD, 4435551234 Smith, Jan, 432 Burke …

Member Avatar for JamesCherrill
0
92
Member Avatar for Teethous

[TEX]Hey everyone, I am having a problem with converting my character array. The program runs, but in the display box I get little squares instead of a string. The program should display the first char of the fist name, the first five of the second name and a random number …

Member Avatar for Teethous
0
180
Member Avatar for guilh_22

Hi everybody, I need some help with my first Java program. My teacher don't teach really good ... I have a problem to solve in my script. At that time all are okay but all number must be rounding to 2 decimal :S That's all my Java program (He is …

Member Avatar for javaAddict
0
135
Member Avatar for keekee

My code runs fine, but I keep getting this error message: I would like to change this logo from a paperclip logo to a book logo, my code is under the error. Can you tell me what's wrong and how to change it to a book logo? Uncaught error fetching …

Member Avatar for masijade
0
95
Member Avatar for gunjannigam

I needed to draw an image and paint a needle on it. Since my image is stationary(it doesnt change) I dont want to paint it each time I call repaint. Thats why I thought of using JLabel with an Icon image. The problem is I cant paint anything on top …

Member Avatar for gunjannigam
0
257
Member Avatar for BestJewSinceJC

It took me very little effort to put a JComboBox in a JTable so that when the cells in a certain column are clicked, it lets the user choose from a drop down list of items. However, my program requires that the underlying combo box can change, since the list …

Member Avatar for BestJewSinceJC
0
2K

The End.