Input « Event « Java Swing Q&A





1. Testing keyboard input with java.awt.Robot    stackoverflow.com

I have a test that exercises a custom Swing component using java.awt.Robot. I'd like to run the test in our build server, but the build servers run on locked windows ...

2. Java - Efficient way to get specific input from user    stackoverflow.com

I am trying to get my options straight with some inputs that I want to enter in an application I am developing. I want the user to input a list(of Strings) ...

3. How can I listen for keyboard input? such as arrow keys?    stackoverflow.com

what is the easiest way to listen for key presses from the user? Specifically I am writing an image viewer program that uses a JFileChooser to select images and on the ...

4. Get input from keyboard with Canvas    stackoverflow.com

I want to create an Upwords application for desktop and so I think that the game table should be displayed as canvas. In the beginning of the game I ...

5. JGoodies Binding bug question about bufferedModels and keyboard input    stackoverflow.com

I am using JGoodies Binding on a JTextField like so:

    trigger = new Trigger();

    PresentationModel<SpectralControlsModel> adapter = new PresentationModel<SpectralControlsModel>(model, trigger);

    ValueModel valueModelStartingSampleJTextField ...

6. User input and output    stackoverflow.com

I have started some code, and I would like to be able to enter a number of no more than five numbers and the return result would place 5 spaces in ...

7. I want my graphical user interface to accept an integer    stackoverflow.com

Hello I'm having trouble with my work. I want a graphical user interface to accpet a single statement in the form "insert name number". For example of such a command is ...

8. How to pass user input from GUI to main class    stackoverflow.com

I'm just starting to work with Java Swing again and I have the same problem as last time. I want to write a program which reads some user input, executes an algorithm ...

9. Swing GUI doesn't wait for user input    stackoverflow.com

I am new to Swing, and I have created a simple GUI class with a button and text field. There is a method in this class, String createAndShowUI(), and I want ...





10. How to intercept and authorize user input with a server    stackoverflow.com

Short introduction: I have a [physics] simulation framework which used to be a single-user desktop version. The framework serves as a toolkit to enable e.g. teachers to build various kinds of simulation ...

11. Java Application GUI seeking input in different classes    stackoverflow.com

I am making an application in java. and i am strucked at Design issue. It has a class

class UserInterface //class that 
extends JFrame // and 
implements KeyListener{ ...

12. Java: How can I detect the user has finalised their save name without using an actionListener?    stackoverflow.com

Basically I wan't to obtain a string from the user, I have created a class called "frames" in which I have a load of methods such as exitChoice(), infoPop(), ect... I ...

13. Why would I be getting a Null pointer exception with Gui input and listener methods?    stackoverflow.com

I am new to Java and I am trying to allow a user to enter an employees first and last name via the Gui and when they press the submit button ...

14. How to capture keyboard inputs in my JWindow using Java?    stackoverflow.com

When i press keyboard with F1 to 12 or 0 to 9 or A to Z (all buttons). I do not see its capturing my keyboard inputs. How do i fix ...

15. Swing choose device to read ASCI string input from    stackoverflow.com

I have several devices that install as HID keyboard devices in most any operating system and, when used, send a string of text back, just like a keyboard. Is there ...

16. Storing and Using user input in GUI    bytes.com

in Main you've got occupants[aptNo] = 0; but you haven't set aptNo yet. In your event handler you use aptNo = Integer.valueOf(apartment.getText()).intValue(); without handling the case where the string isn't an ...





17. How can I store user input from GUI into a text file?    coderanch.com

Hi, I have spent ages trying to get this to work. I'm trying to store the value of a textBox into a textFile when the button is clicked. Instead of out.println("This is line 1"); would I use something like: out.println(textBox.text) ?? private void displayDetailsButtonMouseClicked(java.awt.event.MouseEvent evt) { String value = "C:\\textfile.txt"; FileWriter outFile = null; try { outFile = new FileWriter(value); } ...

18. How to get input from input dilog and do action according to user response?    coderanch.com

Mindy, Below is a brief example: import javax.swing.*; public class Test { public static void main(String args[]) { String inputValue = JOptionPane.showInputDialog("Please input a value"); if(inputValue == null) { JOptionPane.showMessageDialog(null, "You clicked the Cancel or Close button"); } else { if(inputValue.length() == 0) { JOptionPane.showMessageDialog(null, "You forgot to enter a value"); } else { JOptionPane.showMessageDialog(null, "You entered: " + inputValue); } ...

20. key/input buffering in 1.3 vs 1.4    coderanch.com

Does anybody know if 1.4 handles key/input buffering differently than 1.3 did? We have a payment entry interface that is linked to a bar code reader, on our last release (1.3) users could buffer up entries, on this release 1.4 each payment need to wait for the other to resolve first, no code has changed, just the jvm. Robert

21. What listener for keyboard input?    coderanch.com

22. JSpinner keyboard input event    coderanch.com

Thanks so much Jose for your input, I'm trying to check the input as it is being typed in. I get changeEvent only when the input has changed, ie when the press the up or down arrow. Sometimes a user may want to type in the number in the textfield, and if its an invalid number I would like to pop ...

23. How can I get the users input?    coderanch.com

Hello All, In this piece of code it reads in a file (work.csv), and then counts how many rows are in the file, which is fine. but I want to be able to get the users input so they can read in what file they want. ie when the user types in the directory of there file, the JTable rows will ...

24. JtextBox input event    coderanch.com

25. Limiting User Input    coderanch.com

I am writing a connect four game for an artificial intelligence course. The first phase of the project is to write a user interface. Since I'm sometimes a little bit of an over-achiever, I decided to create a GUI and do some fancy animations and such. I've written the program and it's good enough to turn in. Since there is quite ...

26. Buffering Keyboard Input...Probably...    coderanch.com

Thanks Joe, that makes a lot of sense. To be completely honest, something like that was bubbling away in the back of my head after I wrote the post, but I couldn't think of an easy way to articulate it. Also, I didn't want to suggest something that I had no idea about, but might influence the replies! Working for a ...

28. How can I store user input from GUI into a text file?    coderanch.com

Hi, I have spent ages trying to get this to work. I'm trying to store the value of a textBox into a textFile when the button is clicked. Instead of out.println("This is line 1"); would I use something like: out.println(textBox.text) ?? private void displayDetailsButtonMouseClicked(java.awt.event.MouseEvent evt) { String value = "C:\\textfile.txt"; FileWriter outFile = null; try { outFile = new FileWriter(value); } ...

29. Recommendation for Collecting double [][] from user input    coderanch.com

I am building a GUI to lay over a script that I have already written for calculating some chemistry "stuff." The crucial input is a list of solutes with a few associated parameters. Like so double[][] adsorbateList = {{119500, 1, 7.27, 0.756, 0, 0.5}, {252700, 2, 1.98, 0, 25, 1}, {131500, 3, 60, 0, 0, 0.25}}; The whole point of the ...

30. User Interface for taking input based on XSD    coderanch.com

I have an XSD file with some complex types inside it; meaning all the xml nodes do not take the same structure; some have choice; and based on the choice made there are some additional properties etc. How do I build a user interface for it? My dream UI would be a jtable, and based on the value provided in the ...

31. TicTacToe! Stop user from changing input    coderanch.com

Basically I have this code almost done,but i'm not sure how to prevent the user from cheating. Which is from changing the X's and O's I need a little guidance. import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import static java.lang.System.*; class tictactoe { static JButton[][] buttons = new JButton[3][3]; static Winner wincon; enum Winner {none, x_wins, o_wins, tie}; static boolean ...

33. Getting user input using Swing    coderanch.com

Hello What is the best way to get a list of input entered by the user and put them in an array or arraylist so that you can do calculations such as adding all the numbers or multiplying them. for example: Enter numbers to add: 2 3 4 5 ----------------- | CLick to add | ---------------- I tried using JTextArea but ...

34. Getting User Input to Drawing Shapes    java-forums.org

Hi I am developing a program that allows users to draw shapes like Rectangle, Oval, Triangle on a JFrame. The user will select a shape from a menu items and then I am supposed to ask the user to enter specifications of the shape he selected like: location, size and color of the shape. I have JMenu that deals with the ...

35. User input- Pop Up Box    java-forums.org

Hello, I want to create a pop-up box in Eclipse, which accepts user input and on clicking Enter, processes that input to do something else. Eg: A pop up box which says: Enter a value User enters: 5 and hits Enter After that, 5 is accepted and multiplied by 7 and stored in a variable for further processing. Please suggest how ...

36. How to draw and delete according to user input?    java-forums.org

Hello everybody, Currently I'm developing an app that should behave as follows: The user will be presented with a frame. When the user clicks a button on the frame, the app must wait a certain amount of time, and draw a shape on the frame. When the user clicks again (on the button or elsewhere), the shape must be deleted. After ...

37. How to get user input using GUI    forums.oracle.com

Hi, I need to get a string from the user using GUI and the use the input to create a buffer. I tried using JTextField but for some reason I just cant pass the input as a string to another class for creating the buffer. For example here is the code. Same package and same class {code} Class 123{ Method x(); ...

38. Problem getting user input from GUI and saving in text file    forums.oracle.com

Hi, I have been trying to get this to work for ages but still not sure of the right way to do this. I have a text file on my hard disk called textFile.txt and I have a JFrame with two fields 'FirstName' and 'LastName' with a submit button and want to append the details to the text file. What is ...

39. User input determine number of components to be created in GUI    forums.oracle.com

I am making a small program that keeps track of card game points etc. When I start the program it asks for the number of players, rounds, and the player names. Then the GUI is supposed to appear with JLabels for all the names and rounds etc. I thought this would be easy, but I can't figure out how to create ...

40. User input w/out GUI    forums.oracle.com

41. GUI APIs and Input Events    forums.oracle.com

I'm working on some of my own APIs for game development in Java as both a learning project and hopefully something I can carry through to an actual product. One of the APIs is something like an Input Registry. It is designed to keep track of key/mouse events and notify registered listeners when it's registry changes. I've noticed that different GUI ...