how to move pointer in Textfield to newline
consider my case and provide me solutions:
import java.awt.;
import java.awt.event.;
class Table1 extends Frame implements ActionListener{
TextField tf1,tf2,tf3;
Table1(){
Label l1=new Label("WELCOME TO TABLE WIZARD");
l1.setBounds(100,10,200,30);
Label l2=new Label("Enter the value to get its Table");
l2.setBounds(100,50,200,20);
tf1=new TextField();
tf1.setBounds(100,80,200,20);
Label l3=new Label("Enter the till you want the table");
l3.setBounds(100,110,200,20);
tf2=new TextField();
tf2.setBounds(100,140,200,20);
Button b=new Button("click me");
b.setBounds(310,140,60,20);
Label l4=new Label("The Result is:");
l4.setBounds(100,170,200,20);
tf3=new TextField();
tf3.setBounds(100,200,200,200);
add(b);
b.addActionListener(this);
add(l1);
add(l2);
add(l3);
add(l4);
add(tf1);
add(tf2);
add(tf3);
setSize(400,600);
setLayout(null);
setVisible(true);
}
public void actionPerformed(ActionEvent a)
{
String s1=tf1.getText();
String s2=tf2.getText();
int a1=Integer.parseInt(s1);
int a2=Integer.parseInt(s2);
int c[]=new int[10];
for(int i=1;i<=a2;i++)
c[i]=a1*i;
String s3="",s4="",s5="";
s3=String.valueOf(a1);
for(int i=1;i<=a2;i++)
{
int a3=0;
s4=String.valueOf(i);
a3=c[i];
s5=s5+String.valueOf(a3);
tf3.setText("\n");
tf3.setText(s3+"X"+s4+"="+s5+"\n");
}
}
public static void main(String args[])
{
new Table1();
}
}
View Answers
June 7, 2012 at 1:42 PM
The given code accepts the two integer values from the user and display the multiplication table on to the textarea. Using the append() method of textarea, the value is easily added to the textarea.
import java.awt.*;
import java.awt.event.*;
class Table1 extends Frame implements ActionListener{
TextField tf1,tf2;
TextArea area;
Table1(){
Label l1=new Label("WELCOME TO TABLE WIZARD");
l1.setBounds(100,10,200,30);
Label l2=new Label("Enter the value to get its Table");
l2.setBounds(100,50,200,20);
tf1=new TextField();
tf1.setBounds(100,80,200,20);
Label l3=new Label("Enter the till you want the table");
l3.setBounds(100,110,200,20);
tf2=new TextField();
tf2.setBounds(100,140,200,20);
Button b=new Button("click me");
b.setBounds(310,140,60,20);
Label l4=new Label("The Result is:");
l4.setBounds(100,170,200,20);
area=new TextArea(10,20);
area.setBounds(100,200,200,200);
add(b);
b.addActionListener(this);
add(l1);
add(l2);
add(l3);
add(l4);
add(tf1);
add(tf2);
add(area);
setSize(400,600);
setLayout(null);
setVisible(true);
}
public void actionPerformed(ActionEvent a) {
String s1=tf1.getText();
String s2=tf2.getText();
int a1=Integer.parseInt(s1);
int a2=Integer.parseInt(s2);
for(int i=1;i<=a2;i++) {
System.out.println(a1+"*"+i+"="+(a1*i));
area.append(a1+"*"+i+"="+(a1*i));
area.append("\n");
}
}
public static void main(String args[]) {
new Table1();
}
}
June 7, 2012 at 6:00 PM
Thank you very much sir for this answer. actually i am developing the javap tool, in that this concept is applied.
dear sir if you have any programs or like simple application source code that can be helpful for a java beginner please send me by mail.
Related Tutorials/Questions & Answers:
how to move pointer in Textfield to newlinehow to
move pointer in
Textfield to newline consider my case...;
class Table1 extends Frame implements ActionListener{
TextField tf1,tf2,tf3...");
l2.setBounds(100,50,200,20);
tf1=new
TextField();
tf1.setBounds(100,80,200,20
Advertisements
how to print dot in python without newlinehow to print dot in python without newline Hi,
I a debugging... to print 20 dots without new line.
Is there any easy solution?
how to print dot in python without
newline?
Can I use variable to decide no of times dot
how to print dot in python without newline?
how to print dot in python without
newline?ADS_TO_REPLACE_2
Can I use variable...
how to print dot in python without newline Hi,
I a debugging python program and I am using following code to print dots:
print
how to set size of button,textfield.how to set size of button,
textfield.
how we set size of button
textfield etc and reduce problem when click maximize button the text or
textfield get large
how to set as a preferd size in the panel or frame .when we click
How to Type in japanese in java Textfield?How to Type in japanese in java
Textfield? Hello Sir/madam;
Am... in
textfield ..Please help me and tell me
how to write in japanese... user.User needs to type in japanese in the textField.but I dont know
how to type
How to move a value in array? How to
move a value in array? Enter value at the End: 5
Display...]5
Index at [3]8
and when i enter 0 in last index it will
move and if i enter again zero in last index it will not
move anymore... pls help..thank you
How to move a value in array? How to
move a value in array? Enter value at the End: 5
Display...]5
Index at [3]8
and when i enter 0 in last index it will
move and if i enter again zero in last index it will not
move anymore... pls help..thank you
pointerpointer CONSTRTUCT A STRUCTURE FOR EMPLOYEE RECORD THAT CONTAINS A PERSON'S NAME, AGE, EMPLOYEE AND SALARY.WRITE A STATEMENT THAT DECLARES A VARIABLE empInfo and a
pointer emPtr of type EMPLOYEE.then use the
pointer to display
How to pass value of a link to a textfieldHow to pass value of a link to a textfield Dear Sir, in my project I'm initially making a value of the
textfield as a link. Now, I want to pass the value of the link in the
textfield after clicking the link and dont want to open
how to move file in python scripthow to
move file in python script Hi,
In my Python program I have to
move a file from one directory to another. What is the best way to
move the file from one directory to another in Python?
Thanks
(adsbygoogle
how can u reduce the size of textfield?how can u reduce the size of
textfield?
how can u reduce the size of
textfield?
thanks in advance
import javax.swing.*;
public class ReduceTextField extends JFrame {
public static void main(String
print the newlineprint the newline Why doesn?t the following code print the
newline properly?
<?php $str = ?Hello, there.\nHow are you?\nThanks for visiting.?; print $str; ?>
Hi friends,
Inside the single quotes \n (
newline How to move a file from a directory to other directoryHow to
move a file from a directory to other directory I tried the above example it will
move the folder to other directory but it does not
move the image file or other file to a specified directory. Can anyone help me?
Thanks
python replace newline with spacepython replace
newline with space Hi,
I want to replace
newline character
\n
With space in python.
How to replace
newline with space in python?
Thanks
Hi,
Its easy in python.
You can use the replace method
python replace newline with spacepython replace
newline with space Hi,
I want to replace
newline character
\n
With space in python.
How to replace
newline with space in python?
Thanks
Hi,
Its easy in python.
You can use the replace method
Java write newline
Java write
newline
Following example demonstrates,
how to get
newline
feature... of abstract writer class.
ADS_TO_REPLACE_1
In the example
newLine feature
How To Move Image Smoothly
How To
Move Image Smoothly
In this example you will see
how to
move image smoothly on mouse motion using
Java.
To
move an image, we have used the Listener interface
print without newline in pythonprint without
newline in python Hi,
I have a Python program...")
But the output is coming in new lines. I want to know
how to print without
newline in python?
Thanks
Hi,
You can use following code
print without newline in pythonprint without
newline in python Hi,
I have a Python program... ")
print("Python")
But the output is coming in new lines. I want to know
how to print without
newline in python?
Thanks
Hi,ADS_TO_REPLACE_2
TextField validationsTextField validations I want to know
How to check first letter capital or not in a text field and also check all are characters or not in same
textfield?
and also want to know
how to check all digits or not in a
textfield?
ex
Pointer a variablePointer a variable hii,
Pointer is a variable or not ?
hello,ADS_TO_REPLACE_1
Yes, a
pointer is a variable
pointer error javapointer error java
How to catch null
pointer errors in java if the if(value != null) or null
TextField
TextField
... as the
TextField.
In the example given below, shown a
textfield in the applet by creating its...;new
TextField("Type in the box");
null pointernull pointer dear sir ,
what is mean by null
pointer in c
ModuleNotFoundError: No module named 'pointer' '
pointer'
How to remove the ModuleNotFoundError: No module named '
pointer...ModuleNotFoundError: No module named '
pointer' Hi,
My Python... to install padas library.
You can install
pointer python with following command
TextField validationsTextField validations I want to know
How to check first letter capital or not in a text field and also check all are characters or not in same
textfield?
and also want to know
how to check all digits or not in a
textfield?
ex
incomplete pointer type NSMutableDictionaryincomplete
pointer type NSMutableDictionary My iphone app is throwing the "incomplete
pointer type NSMutableDictionary" issue on running the iphone app. What is this issue and
how can i remove it.
NSMutableDictionary *dict
pointer to a referencepointer to a reference
pointer to a reference in C++
#include <iostream>
using namespace std;
void foo1(int& x)
{
int* p = &x;
*p = 123;
}
void foo2(int* x)
{
int
pointer to a referencepointer to a reference
pointer to a reference in C++
#include <iostream>
using namespace std;
void foo1(int& x)
{
int* p = &x;
*p = 123;
}
void foo2(int* x)
{
int
s:textfield - Strutss:textfield I am using the s:
textfield tag in an appication and need to display % after the field on the same line.
How would I go about doing this? Hi friend,
Textfield Tag Example
Java file moveJava file
move
In this section, you will learn
how to
move a file... is used to rename a file but here we have used
this method to
move a file from... an object of File class and parse the file with
its full path. Now to
move this file
Pointer in java - JSP-ServletPointer in java Hello ! All
i know that java has no
pointer type facility.
but i have a problem to related
pointer.
Actually m using a dll... .
i want to get address of a byte type variable,
how can i do
Pointer in C operator
Example:
In this example you will see
how pointer works. ADS...About
Pointer
A
pointer is a variable which contain the memory
address...;
used when dealing with
pointer.
1
&
Validate textfield in Java SwingValidate Jtextfield in Java Swing
In this section,you will learn
how to validate the
textfield by allowing only numbers to enter. For this purpose, we have used the keyEvent class.Using the method getKeyChar() of keyEvent class, we have