Computers & Internet Logo

Related Topics:

Posted on Mar 13, 2009

Table creation via textfields using swings

Helllo
Iam praveen,
here i created three textfields, one submit button & table in that window itself using 'Swings'. If i give the details in text that should go to table by the click of submit button.but iam not getting this.so please do this favour
& be thankful.

with regards
praveen

1 Answer

Anonymous

Level 1:

An expert who has achieved level 1.

Corporal:

An expert that has over 10 points.

Mayor:

An expert whose answer got voted for 2 times.

Problem Solver:

An expert who has answered 5 questions.

  • Contributor 5 Answers
  • Posted on Apr 10, 2009
Anonymous
Contributor
Level 1:

An expert who has achieved level 1.

Corporal:

An expert that has over 10 points.

Mayor:

An expert whose answer got voted for 2 times.

Problem Solver:

An expert who has answered 5 questions.

Joined: Apr 10, 2009
Answers
5
Questions
0
Helped
1852
Points
16

Import java.lang.Object;
import javax.swing.table.DefaultTableModel;


public class tabletest extends javax.swing.JFrame {
String[][] row = null;
String[] title=new String[3];
private int i;


/** Creates new form tabletest */
public tabletest() {
initComponents();
setTitle("table test");
setVisible(true);
System.out.print("NO Database Needed");
title[0]="Name";
title[1]="Desig";
title[2]="id";
}


/*
" In middle of this two source one generated code will be there that will be done by dragging ur fields to ur frame. THIS IS FOR netbeans IDE "
*/

private void b1ActionPerformed(java.awt.event.ActionEvent evt) {
row=new String[4][3];
// TODO add your handling code here:

String s1=t1.getText();
System.out.println(" event 1");
String s2=t2.getText();
System.out.println(" event 2");
int k=Integer.parseInt(t3.getText());
String s3=""+k;
System.out.println(" event 3");
try{
// for(int i=0;i<=2;i++)
row[i][0]=s1;
row[i][1]=s2;
row[i][2]=s3;
i++;

}catch(Exception e){
e.printStackTrace();

}
table.setModel(new DefaultTableModel(row,title));
}

private void b2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

t1.setText("");
t2.setText("");
t3.setText("");

}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new tabletest().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JButton b1;
private javax.swing.JButton b2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel l1;
private javax.swing.JLabel l2;
private javax.swing.JLabel l3;
private javax.swing.JPanel p2;
private javax.swing.JScrollPane scp1;
private javax.swing.JTextField t1;
private javax.swing.JTextField t2;
private javax.swing.JTextField t3;
private javax.swing.JTable table;
// End of variables declaration

}

Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

0helpful
1answer

Were can I find a replacement canopy for courtyard creations three person swing RUS459C

You are on the wrong website for this type of inquiry. This is a self help website for the repair and use of consumer manufactured products

Jun 20, 2017 • Baby Gear
tip

Creat a backup of your mbile data

install the required pc suit on your pc and mbile.
attach the mbile to the pc via blue tooth or cable wire.
double click the pc suit icon in the lower right corner.
after opening the menue click on the backup icon.by plcing mouse there it can be find out.
after opening a new window click the backup button, select a proper location and click the next button.
the back up creation will begin.
this backup can be reloaded at any time when it is required. this backup creation will help yu to protect the importnt data. after formating your mbile you can regain the formted data from backup
on Oct 11, 2010 • Cell Phones
0helpful
2answers

To creat a new email account.

Go to Sign up for Yahoo account and then
menu icon .
Tap Sign in.
Tap Create Account.
Enter in the requested info and tap Create account.
Make sure that the mobile number shown can receive text messages then tap Send SMS. ...
Enter the code and tap Submit code.
Tap Get started.
How To Create New Yahoo Account
1helpful
1answer

How do I create a youtube account

Create a Google Account to use a Google product https://support.google.com/accounts/answer/27441
A Google Account grants access to Google products like Gmail and Youtube with a single username and password.
  1. Visit the Account Creation page.
  2. Fill in the requested information and submit.
0helpful
1answer

My excavator hitachi ex200-1 weak swing and when you swing then stop vibration begin on turn table when i stop to swing,and when i swing and lift cylinder raise,vibration on the turn table will contin

Not sure would need to have a good look ,but i suspect a safety valve isnt closing properly causing thumping within the hydraulic system which is the vibration you can feel,shouldnt cost a lot to repair providing the faulty valve can be located so return to the dealer as they will have a good idea as yours isnt the first to go wrong iam sure
0helpful
1answer

Hello. I need a simple help (I think). If I have an webbadress like "http://my.adress.com/home.html" and I want to make a form that puts whatever you type in a textfield at the end of the...

A simple solution would be!

<form action="http://my.address.com/home.html<?php echo $name; ?>" method="get"><!-- Note a variable after the link -->
<input type="text" name="name" value=""/>
<input type="submit" name="submit" value="Submit"/>
</form>
<?php
    if(isset($_GET['submit'])) {
        $name = $_GET['name'];
    }
?>
0helpful
1answer

Can u plz mail me tha easiest way to use Ms Access, like Creating relationship, with the table, creating form, query etc.

In general you initiate this process by pressing the "Relationships" button on the MS Access toolbar. It is the button with three small boxes arranged in a triangle shape.
rowell_randy_0.jpg

When it first comes up it will give you the option to add tables. You can add any set of tables including the possibility of adding one table more than once (you would do this if you wanted to create a relationship between fields in the same table).

Once you see the tables you're interested in, you simply drag the field from one table over a field in another table. The fields should be those that will define the relationship. Once done, you should see an Edit Relationships window. You can get back to the Edit Relationships window later by double clicking the line in the relationships window.
rowell_randy_1.jpg

MS Access does a good job of figuring out the relationship type. For example, if you match a field in one table, that is not a key, with a primary key in another table, Access will make this a Many-to-One relationship.

This can become a very deep subject. Hope this at least gets you in the right direction.
0helpful
1answer

Vb project

One of three ways:
1 make the table using vb creating a Bload screen.
2 using the visual data manager.
3 import a windows access or excel data base table.

Try the data wizard, easiest to use and U can program the program to manipulate the data in the tables.
0helpful
2answers

Need to Know fully info about Macros

Macro is a simple way to automate tasks in Microsoft Office programs. It allows advanced users to program or create their own commands in Office, thereby automating tasks. For example, a user might want to create a table with four values already in them. The user could create one, and then copy it, and paste it. However, when you restart your computer, that data is lost. Unless you open the old document and copy the table, you'll have to start all over again. Macros helps you do your tasks. By recording the table creation to a macro, creating the same table over and over is just a simple macro away.
Not finding what you are looking for?

199 views

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Grand Canyon Tech
Grand Canyon Tech

Level 3 Expert

3867 Answers

Brad Brown

Level 3 Expert

19187 Answers

Cindy Wells

Level 3 Expert

6688 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...