File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes How to make a neat form? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to make a neat form?" Watch "How to make a neat form?" New topic

How to make a neat form?

Avin Sinanan
Ranch Hand

Joined: Nov 07, 2001
Posts: 109
Hello there does anyone know how to make a form. I need a form with the headings on the lesft handside of the JFrame-
First Name , Last Name , Age
and on the left hand side I need 3 textfields to put the information into.
I tried using a JTable but that did not work... the code I tried is below
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
class AvinTable
public static void main(String[] args)
JFrame frame = new JFrame("Table of Buttons and TextFields");
JPanel pane = new JPanel();
JTextField field1 = new JTextField("",20);
JTextField field2 = new JTextField("",20);
JButton button = new JButton("Click Me");
Object[][] data ={{button , field1},
{"Enter Number of Call Setups" , field2} };
String[] columnNames ={"Description","Value"};
final JTable table = new JTable(data,columnNames);
JScrollPane scrollPane = new JScrollPane(table);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
frame.setVisible(true) ;
This did not worked as I expected it. I looks to much like excel. Instead I would like it to look just like how this Java Forum looks when you are posting a message. You will see "Your UserNAme , Your Password and Messssage title. Cam someone tell how to get it to look this neat.
Thanks for reading

yours respectfully<br />Avin Sinanan
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Avin,
How about the code below, for a start?

I agree. Here's the link:
subject: How to make a neat form?
It's not a secret anymore!