How to make a simple textbox in javaHow to make a simple textbox in java
Page 1 of 1
10 Replies - 41211 Views - Last Post: 02 March 2009 - 06:53 PM
#1
How to make a simple textbox in java
Posted 02 March 2009 - 03:35 PM
Hey there,
I'm not doing a project or anything like that but I'm just playing around on java and was wondering how to make a simple textbox that I can use to enter numbers.
Thanks
I'm not doing a project or anything like that but I'm just playing around on java and was wondering how to make a simple textbox that I can use to enter numbers.
Thanks
Replies To: How to make a simple textbox in java
#2
Re: How to make a simple textbox in java
Posted 02 March 2009 - 03:38 PM
JTextField numberEnter = new JTextField("Enter numbers here", 20);
#3
Re: How to make a simple textbox in java
Posted 02 March 2009 - 04:05 PM
#4
Re: How to make a simple textbox in java
Posted 02 March 2009 - 04:07 PM
You need to import the class.
import javax.swing.JTextField;
And then it should run fine once you add it to the frame or panel
import javax.swing.JTextField;
And then it should run fine once you add it to the frame or panel
#5
Re: How to make a simple textbox in java
Posted 02 March 2009 - 04:16 PM
#6
Re: How to make a simple textbox in java
Posted 02 March 2009 - 04:20 PM
#7
Re: How to make a simple textbox in java
Posted 02 March 2009 - 04:47 PM
Can you paste the code you have and post it here so I can see what you are doing? Thanks
#8
Re: How to make a simple textbox in java
Posted 02 March 2009 - 04:52 PM
Have you done any GUI coding in Java before?
If not you should look into GUI programming with Java.
If not you should look into GUI programming with Java.
#9
Re: How to make a simple textbox in java
Posted 02 March 2009 - 05:49 PM
BigAnt, on 2 Mar, 2009 - 03:52 PM, said:
Have you done any GUI coding in Java before?
If not you should look into GUI programming with Java.
If not you should look into GUI programming with Java.
Here is the code I have so far:
[code]
// The "T" class.
import javax.swing.*;
public class T
{
public static void main (String[] args)
{
// Place your code here
JOptionPane.showInputDialog ("Input Text Here");
} // main method
} // T class
[code/]
It comes up with the text field that I input with but how do I use what I input to the field in a program. I have to be able to print out a row of numbers like this:
1=4
2=5
3=6
4=7
5=8
6=9
7=10
8=11
9=12
10=13
then I want to be able to edit the value on the right(4-13). Is there a way to do this by using the text boxes or any similar easy ways???
#10
Re: How to make a simple textbox in java
Posted 02 March 2009 - 05:50 PM
Store the user input as string variables and then use the parseint method to change them into numbers. you can then reassign the values of those variables as needed
#11
Re: How to make a simple textbox in java
Posted 02 March 2009 - 06:53 PM
Public Designs, on 2 Mar, 2009 - 04:50 PM, said:
Store the user input as string variables and then use the parseint method to change them into numbers. you can then reassign the values of those variables as needed
Sorry...I'm new to using textboxes in java so how do I take the number inputted into the textboxes and assign it to a number on the left. Just a little side not the left side numbers above(1-10) will actually go from 1-320 when I'm done. Thanks again for all the great help.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|