Integer « Development « Java Swing Q&A





1. Limiting JTextFieldInput to positive integers    stackoverflow.com

What is the best way to restrict a JTextField input to only positive integers? Thanks!

2. Efficiently monitor an int value    stackoverflow.com

I changed the code to a much more detailed version so you can get a better idea of my problem. I need to "watch" an integer value and immediately respond to when ...

3. getRowForLocation(int x, int y)    coderanch.com

4. Conversion of Object to int    coderanch.com

6. GUI's and inputting doubles or ints    java-forums.org

hey, im working on a basic gui program and i need to input some numbers from the interface so i can calculate their average. So far my program is working, except for that part Java Code: import javax.swing.*; // Required library import java.awt.*; // Required library import java.awt.event.*; // Required library public class MyGUI extends JFrame { private JTextField myExam = ...

7. Celsius Fahrenheit converter GUI; problems with char vs int?    forums.oracle.com

Thanks, I think I fixed all the quote things, but what should I do instead of the Char.parseChar? When I try to compile these errors come up. C:\Documents and Settings\Administrator\My Documents\Temp1.java:93: cannot find symbol symbol : variable getText location: class javax.swing.JTextField char cf = (Char.parseChar(jtfCF.getText.trim())); ^ C:\Documents and Settings\Administrator\My Documents\Temp1.java:93: cannot find symbol symbol : variable Char location: class Temp1 char ...

8. Trouble with Integer.parseInt(inputString) in Swing    forums.oracle.com

// This line is the only way I can get this file to compile and run with expected results monthNumber = (int) Long.parseLong(myInput); switch (monthNumber) { case 1: //System.out.println("January"); JOptionPane.showMessageDialog(null,"January","The month is:",JOptionPane.INFORMATION_MESSAGE); break; case 2: JOptionPane.showMessageDialog(null,"February","The month is:",JOptionPane.INFORMATION_MESSAGE); break; case 3: JOptionPane.showMessageDialog(null,"March","The month is:",JOptionPane.INFORMATION_MESSAGE); break; case 4: JOptionPane.showMessageDialog(null,"April","The month is:",JOptionPane.INFORMATION_MESSAGE); break; case 5: JOptionPane.showMessageDialog(null,"May","The month is:",JOptionPane.INFORMATION_MESSAGE); break; case 6: JOptionPane.showMessageDialog(null,"June","The month ...