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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
I use a JPanel, and tried to show a JComboBox on it.But somehow the JComboBox is not shown. Needhelp here. Thank you.
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). ...
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
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 ...
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? No function or method allowed.For example:Given:A = 35B = 10ResultA = 10B = 35
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 ...
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. ...
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?
I want to add MenuBar in Applet's Panel not in a Frame.What is the solution?
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("" ...
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 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?
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!
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 ...
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 ...
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?
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 ...
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
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
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
I added a listener to my JListlist.addListSelectionListener()when I click in my List two events are fired. Why? I just want one.
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. ...
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
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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?
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 ...
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.
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 ...
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 ...
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.