Frame program in linux (GCJ) Java - need help

  • sivabalan
  • Newbie
  • Newbie
  • sivabalan
  • Posts: 5
  • Loc: INDIA

Post 3+ Months Ago

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.
  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2391
  • Loc: Edinburgh, Scotland

Post 3+ Months Ago

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. }

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 72 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.