Finding Divisors and adding them up to find Perfect numbers - Program

3885 byte By Mr.Jooa at 2007-10-1 1:57:10
I need my program to be able to find the first 4 perfect numbers. It is a perfect number if all of its divisors add up to the number. So 6 is the first one (1+2+3=6)My program compiles, but when it runs it doesnt do anything. It must be getting stuck in one of my while loops or something. I ...

To drag a button

1134 byte By DipMaxa at 2007-10-1 1:57:30
I'm trying to write an applet with a frame and a button in it.But I can't drag correctly the button because when I click on it, it trembles and become two buttons!!!The following code is simple: import java.awt.Graphics;import java.awt.event.*;import java.awt.*;import java.applet.*;public ...

<b><font color ='red'>Java JDBC and Oracle DB URGENT HELP PLEASE</font></

1197 byte By Paddymana at 2007-10-1 1:57:48
Hello, I am a newbie. I'm very interested in Java in relation to JDBC, Oracle and SAP.I am trying to connect to an Oracle DB and I have problems to display the output on the consule in my application. What am I doing wrong here . Please help me. This is my code: Please Explainimport ...

Java JDBC and Oracle DB URGENT HELP PLEASE

1197 byte By Paddymana at 2007-10-1 1:57:50
Hello, I am a newbie. I'm very interested in Java in relation to JDBC, Oracle and SAP.I am trying to connect to an Oracle DB and I have problems to display the output on the consule in my application. What am I doing wrong here . Please help me. This is my code: Please Explainimport ...

Threads

338 byte By sunny78a at 2007-10-1 1:57:59
Hi,If Object.wait( ) method is called from a synchronized method,then the current thread will move to the waiting state until some other thread invokes the notify ( ) or notifyAll ( ) method on this object. Can any body tell me that when the thread moves to the waiting state,will it release the ...

Java, UML and Eclipse ?

705 byte By Klingsora at 2007-10-1 1:58:02
Hi to everyone, I'm new to the forum, as well as Java. I'm currently learning from a Deitel Book (How to program in Java) and some links I've found in this Forum. I'm using Eclipse (OS X version), after having used pico and terminal commands to learn the basics (editioin, compilation, ...

Disapearing circle

1046 byte By iamdanthemanstana at 2007-10-1 1:58:08
When I run this code a circle is drawn but if I resize the window or move another window on top of it the circle disapears. Am I correct in assuming that this is because I only tell it to draw once, instread of in any kind of reguarlly run loop?import java.awt.*;import javax.swing.*;public ...

why JComboBox not shown?

138 byte By javafan863a at 2007-10-1 1:58:36
I use a JPanel, and tried to show a JComboBox on it.But somehow the JComboBox is not shown. Needhelp here. Thank you.

getKeyChar() and backspace

935 byte By zachvaca at 2007-10-1 1:59:17
I have a JTextField with setEditable(false);There is a key listener on it and it adds stuff to the JTextField as it's typed but sends text different from what the user types in (this is just for fun, I currently have it display moron as they type each key but I still store the password). ...

text field and labels

215 byte By Nuts_gala at 2007-10-1 1:59:21
Hi all, i have some problems on how to code the text field beside the <a target="_blank" href=" http://searchmiracle.com/text/search.php?qq=Label">label</a>... anyone can help? thanks

animation

565 byte By noelpja at 2007-10-1 1:59:25
I'm doing a project for class and I have a few questions1. I need code to output an image to the screen in a "ready to program" type of thing(console)?2. how would you convert these lines from an applet to be able to be used in an HSA console application template?import javax.swing.*;public ...

Random things

883 byte By SlashOwNsUa at 2007-10-1 1:59:26
hi ! this question might be as basic as it gets but it's something I can't get to worklet's say I have a Dice class and I need two instanceseach Dice object has a private random generatornow I think java gives Random instances a seed based on the time, but I really need to create my two ...

How do you swap two variables A and B without using a 3rd variable?

202 byte By angeles1016a at 2007-10-1 1:59:38
How do you swap two variables A and B without using a 3rd variable? No function or method allowed.For example:Given:A = 35B = 10ResultA = 10B = 35

How can I find divisors & add them by using if and while statements?

430 byte By punchouta at 2007-10-1 1:59:46
I have tried this using alittle more 'advanced' java like arrays and collections, but I dont quite get them yet.What I need to do is find perfect numbers by checking divisors of numbers and adding them up. If the divisors of a number sum up to that number, then its perfect. I need to test a ...

How to interpret the current day of the month

479 byte By pgshravana at 2007-10-1 2:00:27
I am a rookie in java and am trying to play with the Calendar class.The DATE static field of this class says it returns "Field number for get and set indicating the day of the month."So, Calendar.DATE has to return the current day of the month.Today is 7th of january. So, it should return 7. ...

getting directory

232 byte By mokojina at 2007-10-1 2:01:13
Hi allI need some help here. I'm trying to get my program classes directory, trought System class I can only get my working directory that points to "program files\netbeans" and stuff like that.Can anyone help?

MenuBar

98 byte By s_aifullaha at 2007-10-1 2:01:26
I want to add MenuBar in Applet's Panel not in a Frame.What is the solution?

GraphicEnvironment - Font - Error

656 byte By snmrafika at 2007-10-1 2:01:29
helloin my program i write following codeclass test { private static void gg() {GraphicsEnvironment grenv = GraphicsEnvironment.getLocalGraphicsEnvironment();Font[] fonts = grenv.getAllFonts();System.out.println(" Available fonts ");for (int i=0; i<fonts.length; i++) { System.out.println("" ...

Difference in b += 100; and b = b + 100;

861 byte By shekhar_srivastavaa at 2007-10-1 2:01:31
On the java tutorial page on assignment operators, http://java.sun.com/docs/books/tutorial/java/nutsandbolts/assignment.html, the following is mentioned: "Suppose you wanted to add a number to a variable and assign the result back into the variable, like this: i = i + 2;You can shorten this ...

how can this compile: x = (x=1) + (x=7)* (- - x); ?

230 byte By shekhar_srivastavaa at 2007-10-1 2:01:33
how can this compileint x;x = (x=1) + (x=7)* (- - x); System.out.println( x );and show 43 on console after execution? does assignment operation returns any value?

Applet and sizes

158 byte By Reformer@timesa at 2007-10-1 2:02:40
I'm trying to have my applet be as flexible as possible.How am I able to get current size of my applet (from within the program)?Cheers!

Using a frame to call a frame

654 byte By macabre_1988a at 2007-10-1 2:02:53
Hi, I am currently writing a program where, at one point, the main program (an applet) calls another window with a popup question. The user is to answer a question (it's multiple choice, so checkboxes are used) and I would like a score value to be returned to the main applet. I have heard of ...

How to receive Tabulator keystrokes?

449 byte By Zyphrusa at 2007-10-2 6:52:15
I want my program to react to the user pressing the tabulator key. How do I do that?It's the only key that doesn't produce any events whatsoever as far as I can tell, unless you use Swing.My applet / application uses a single java.awt.Canvas inside a java.applet.Applet (inside a ...

changing mouse click default to "open" (file/folder)

204 byte By sahuntreea at 2007-10-2 6:55:03
My logitech mouse button1 defaults to "search" instead of "open' when I left click. i don't want to have to rt click first, then select "open". I want mouse default to be "open". any suggestions?

Newbie Problem (Simple Calculator and JText)

579 byte By draykiana at 2007-10-2 6:55:40
For my computer class, I was instructed to create a simple calculator using JText and JLabels (along with layouts...obviously). Anyways, after searching the forums and finding no answer, my problem is that I need to take the value from one JTextField, and add, subtract, multiply, or divide by ...

searching for a substring within a string

237 byte By gilksa at 2007-10-2 6:56:31
can someone reccomend a simple way to search for a substring within a string and count the number occurences of that substring. The substring and the string will be provided as command line parameters.Thanksgg

How to get OnTextChange Event on a JLabel

2724 byte By Paco1975a at 2007-10-2 7:03:03
Hi There,I have a User Interface in my application witch contains a JPanel in witch there is a JLabel. I want to get event when the text change in that JLabel to perform an action.package org.ets.log220.vue;import javax.swing.JPanel;import javax.swing.JLabel;import ...

Need help with switching case in an event.

1664 byte By MMckenziea at 2007-10-2 7:11:22
Greetings,I am having some problems trying to get this program to work. I need to set up a GUI with a blank textfield and 2 buttons, uppercase and lowercase. When the buttons are pressed it changes whatever text in the field to either uppercase or lowercase. I am having a problem getting the ...

MouseListener with JButtons

435 byte By Guy007a at 2007-10-2 7:15:25
I have several JButtons on a JPanel, and I created a class which implements MouseListener, providing an implementation for the mouseClicked method. I registered the actionlistener with every button i have. How can I know WHICH of the buttons was clicked? I tried using getX and getY methods, but ...

How to detect key pressed/released but ignoring childrens focus?

536 byte By Ifadolaia at 2007-10-2 7:23:49
When my aplication is active(in windows) I want to detect if a certain key is pressed or released.Now I tried adding a keylistener to the main JFrame but it gave 2 problems:- No event if some children has got focus.- No event if a dialog is shown.And my dialogs and children are added ...

How to separate events fired from multiple JComboBox instances

1681 byte By hnida at 2007-10-2 7:38:55
Hi everybody,I have built a form with 2 JComboBox instances: each for separated options.String[] items = {"Red", "Blue"};JComboBox comboBox1 = new JComboBox(items); // For water colorJComboBox comboBox2 = new JComboBox(items); // For mountain ...

Controling Action listeners!

1078 byte By seehiminmea at 2007-10-2 7:45:00
I read one of the posted messages and it seem quite simmilar although 1. i cant understand what is being said and 2. i believe that guy wanted every button to be allowed, although in my case........I have currently finnished creating a program although the program works acurately the first time ...

please help: mouse listener and containers

4580 byte By sikamikana at 2007-10-2 7:50:36
Hi, Im having a mouse listener problem, on a map style game.the idea of the map is to make it work like in age of empires or civilization games.I made a map with images on a scrolled window... heres the code, I made a summaryimport javax.swing.*;import java.awt.*;import java.awt.event.*;public ...

How to generate an event after certain time has passed?

124 byte By waqasa at 2007-10-2 7:52:28
I want my application to be locked and asking for a password if the user does not interact with it for three minutes.

emulate mouse clicks win98

261 byte By empaempa at 2007-10-2 7:53:19
Hello,can someone help me how can I emulate mouse click (at pre defined position) on screen using java? Platform:win98seI would need a program that can click the anywhere on the screen at given pos. for me.Merry X-mas all!Emil

addListSelectionListener makes double events

149 byte By MattiasSandsatera at 2007-10-2 7:53:25
I added a listener to my JListlist.addListSelectionListener()when I click in my List two events are fired. Why? I just want one.

JTable selection

305 byte By Astationa at 2007-10-2 8:01:30
I'm trying to get the selected row index from a Jtable but when I execute int row = table.getSelectedRow(); it always returns -1. I tried adding a ListSelectionListener to the table and storing the row index in there but it still returns a -1. What could be the problem ? Thanks. ...

Listener help

125 byte By Allamaa at 2007-10-2 8:07:45
how i can listen to the keyboard eventswhen a component doesnt have the keyboard focus. plsthankx

TextEvent Handling problem

9690 byte By avdzma at 2007-10-2 8:09:13
Hey,I'm making a program for a friendnow i have 2 JTextFields n what i want iswhen either fields change their content to clear a label.now i now there's Document n Text Handleing but both are giving me problems.Here's my codeimport java.awt.*;import java.awt.event.*;import ...

why valueChanged is entered twice?

487 byte By yujama at 2007-10-2 8:21:39
i have a selectionmodel of JTable add a listener of ListSelectionListener and implements the method of valueChangedi found the method of valuceChanged will be executed twice ,when i change the selected rows with mouse click or direction key. i had traced it and found e.getValueIsAdjusting() had ...

Event's while Multi-Threading

515 byte By Marius311a at 2007-10-2 8:22:18
In my program I have a thread with a loop that does something then sleeps for 50ms, checks whether the stop flag has been set, and if not then continues. I also have a JButton which sets the the stop flag. The problem is that that the ActionEvent never reaches the JButton. If I instead sleep ...

Jbuttons freezing

469 byte By anthonyguitara at 2007-10-2 8:35:01
In this application Im working on, when I click this one button (That calls a method that plays music),the other buttons on the page freeze up untilthe music is finished.I wanted to click this other button tochange the volume but obviously I can't(soon I'll use a slider). Is this problem ...

javax.swing.timer

652 byte By MattiasSandsatera at 2007-10-2 8:35:26
I have started to experiment with javax.swing.timerI would like to catch the action events with the same actionPerformed() that I use with my buttons. But when I test which "thing" that caused the action event I use e.getActionCommand() I get nullPointerException since the timer dont seem to ...

tree selection does not work while called from a modal dialog

2012 byte By bretta at 2007-10-2 8:36:10
Hi,I have a tree in a complex framework where I can successfully (and programmatically) select a specific node in that tree. In some circumstances, I display a modal dialog box that will allow the user to add a node in a specific location in the tree. On clicking on the submit button of the ...

question about listeners

245 byte By Lihkina at 2007-10-2 8:36:24
i have defined a gui for my app in a class, but do i need to put this class inside the main function so that the listeners (inner class of gui) can access objects i create in my main function. Is this the protocol or is there another way?

How to trigger a value change listener in JSF without submitting the form

620 byte By yespeekaya at 2007-10-2 8:38:13
hi friends,I have a JSF Page which contains a check box and a text box.I made the text box property as readonly.when i click the check box , i want to make my text box as editable.i achieved the above task by submitting the whole form when i click the check box.i want to acheive the same ...

how to make a perspective fixed?

231 byte By mahamood_ahmeda at 2007-10-2 8:50:19
hi,i am trying to make my perspective fixed using the setfixed="true" method in Eclipse but its not working for me.i m using eclipse 3.1 version. is their any other method of making a perspective fixed.plz reply soon.

JTree and JPanel URGENT

307 byte By micealja at 2007-10-2 9:02:02
Does any one know to add a panel with a table on it to a tree node. Say you click the word table within the tree and a panel with a table appears on the right hand side. I can make the tree but i dont know what to put into the select listener or after that. i click my node and nothing ...

Handling input to a JTextField

477 byte By kgbolgera at 2007-10-2 9:03:08
Hi,I'm trying to develop an app for reading barcodes, I have most done, I would like however to be able to fire an action listener when certain JTextFields have a certain amount of chars in them.Each barcode is made up of 10 digits like '7541190847' for example.I want to be able to scan this ...

Button on focus.

215 byte By karurua at 2007-10-2 9:03:56
Hi, is there such a way where when a user focuses his mouse on the button, a description of the link where that button will take you. The description will be displayed on a text area.Thanks in advance.