Frame program in linux (GCJ) Java - need help

  • sivabalan
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jul 21, 2005
  • Posts: 5
  • Loc: INDIA
  • Status: Offline

Post August 12th, 2005, 12:32 am

In our lab we are doning java chating program, so we need windows for this program. How do create window by using frame in java program.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post August 12th, 2005, 12:32 am

  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 07, 2004
  • Posts: 2390
  • Loc: Edinburgh, Scotland
  • Status: Offline

Post August 12th, 2005, 1:41 am

The syntax is identical to creating Java windows in MS Windows etc. In it's simplest form:

Code: [ Select ]
import javax.swing.*;

public class Test extends JFrame {

  public Test() {
   setTitle("My frame test");
   setSize(800, 600);
   setVisible(true);
  }

  public static void main(String[] args) {
   Test t = new Test();
  }

}
  1. import javax.swing.*;
  2. public class Test extends JFrame {
  3.   public Test() {
  4.    setTitle("My frame test");
  5.    setSize(800, 600);
  6.    setVisible(true);
  7.   }
  8.   public static void main(String[] args) {
  9.    Test t = new Test();
  10.   }
  11. }
Why do geeks get Halloween and Christmas confused?
Because 31 Oct == 25 Dec
www.darren-king.co.uk

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 64 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.