Results 1 to 10 of 10
Thread: GUI problem
- 11-17-2010, 06:50 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 7
- Rep Power
- 0
- 11-17-2010, 06:56 PM #2
- 11-17-2010, 06:58 PM #3
Don't double post
pls help
db
- 11-17-2010, 07:16 PM #4
Member
- Join Date
- Nov 2010
- Posts
- 7
- Rep Power
- 0
listbox and textbox not working with numbers
using textbox and lisbox to display integer number is givin error what can i use
- 11-17-2010, 07:48 PM #5
Member
- Join Date
- Nov 2010
- Posts
- 7
- Rep Power
- 0
THE TEXTBOX IS ONLY DISPLAYING THE LAST NUMBER for the result.how can i see other num
THE TEXTBOX IS ONLY DISPLAYING THE LAST NUMBER for the result.how can i see other numbers. thanks
//MAIN CLASS:
import javax.swing.JFrame;
public class arbitrarymain
{
public static void main (String args [])
{
arbitrary arbitrary1 = new arbitrary();
arbitrary1.setSize(400,120);
arbitrary1.setVisible(true);
}}
//SUB CLASS:
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax swing.JLabel;
public class arbitrary extends JFrame
{
private JTextField textfield1;
private JLabel label1;
double count;
public arbitrary()
{
super("ARBITRARY");
{
setLayout(new FlowLayout());
textField1=new JTextField(10);
label1 = new JLabel("result");
add(label1);
add(textfield1);
for(count=-1;count<=2;count=count+0.1)
{
textfield1.setText(" "+count);}}}}
- 11-17-2010, 08:09 PM #6
Member
- Join Date
- Sep 2010
- Posts
- 56
- Rep Power
- 0
Look at your code closely. You are resetting the data in the text field every time you iterate the for loop. You have to create multiple text fields or put all of the text into a JPanel with JLabels. And please enclose your code in [code*] and [/code*] tages without the asterisks.
ABLast edited by javaman1; 11-17-2010 at 08:14 PM.
-
You can put all the text in a single JTextField, but you have to extract the String already in the JTextField with getText(), append new information to it, and then set the JTextField text with the setText(String text) method.
- 11-19-2010, 07:04 PM #8
Member
- Join Date
- Nov 2010
- Posts
- 7
- Rep Power
- 0
>>>>Look at your code closely. You are resetting the data in the text field every time you iterate the for loop. You have to create multiple text fields or put all of the text into a JPanel with JLabels. And please enclose your code in [code*] and [/code*] tages without the asterisks.
Javaman1, but we're talking of just only one for (control) while did you say every time you iterate the for loop?
Also, what did you mean by [code*] and [/code*].Please can you explain this parallel?
- 11-19-2010, 07:08 PM #9
Member
- Join Date
- Nov 2010
- Posts
- 7
- Rep Power
- 0
>>>You can put all the text in a single JTextField, but you have to extract the String already in the JTextField with getText(), append new information to it, and then set the JTextField text with the setText(String text) method.
fubarable, we are dealing with integers/double not string or is there any corellation?
Any way we've try to amends changes but no show!
- 11-19-2010, 07:19 PM #10
Member
- Join Date
- Nov 2010
- Posts
- 7
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks