This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to make a neat form?" Watch "How to make a neat form?" New topic
Author

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));
pane.add(table);
frame.getContentPane().add(pane);
frame.getContentPane().add(pane);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500,500);
frame.pack();
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
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?

Regards,
Manfred.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to make a neat form?
 
Similar Threads
Edit cell with another JTable
jButton in jTable Cell with Action
Vector and JTable
How to make a neat form...
JTable ........