Results 1 to 2 of 2
Thread: JFrame issues
- 12-17-2009, 08:01 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 5
- Rep Power
- 0
JFrame issues
Hi guys,
I am new to Java and I am trying to build a window-based application.
I have some idea of how to do this, however I have run into a few problems. Here is the frame section of my code, below that I will post my concerns:
//Method that creates a blank frame
public static void Form()
{
//Code that creates a blank frame
JFrame frame = new JFrame("Wages");
frame.setResizable(true);
frame.setSize(400, 400);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
JPanel panel = new JPanel();
frame.add(panel);
JTextArea jat = new JTextArea("Test",10,20);
JLabel label1 = new JLabel("Label 1");
JButton button1 = new JButton("Button 1");
panel.add(label1);
panel.add(button1);
panel.add(jat);
}
//Main method
public static void main(String[] args)throws FileNotFoundException
{
/*I use a main method because the frame is
* not the only method that I am using
*/
Form();
}
Core issues:
1. When I run the program, I have to resize (either maximize or minimize) the window in order for it to show the contents (i.e. the text area, button, and the label).
2. Whenever I do try to change the location of any of my panel items (eg. jat.setLocation(20, 20);), they still appear in the same location as if I did not set the location to begin with.
If any of my declarations or method uses seem elementary, remember that I am still a newbie.
I would appreciate any help that you all can offer.
Regards,
Brent
- 12-17-2009, 08:26 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Similar Threads
-
Passing data from one JFrame to another JFrame
By tarami in forum New To JavaReplies: 3Last Post: 08-06-2009, 05:44 PM -
How to make a Jframe un-focusable when another Jframe is active?
By Robert_85 in forum Advanced JavaReplies: 4Last Post: 04-22-2009, 11:02 PM -
Issues with Jva I.O
By Annatar01 in forum New To JavaReplies: 0Last Post: 02-08-2008, 01:16 AM -
Array issues
By Neo82 in forum New To JavaReplies: 1Last Post: 12-31-2007, 03:22 AM -
Compatibility issues with IE7
By Aneesha in forum New To JavaReplies: 7Last Post: 11-30-2007, 05:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks