LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-30-2006, 12:19 PM   #1
mema_UAE
LQ Newbie
 
Registered: Apr 2006
Posts: 14

Rep: Reputation: 0
Smile How to use the Grid Layout Function ????


[LEFT]I face difficulty in organizing the design of my program and also I had another difficultly in labeling 3 or 4 sentences each one in a new line [LEFT]


code:


import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;




public class answer extends Applet implements ActionListener
{
Button b1=new Button("red");
Button b2=new Button("pink");
Button b3=new Button("Black");
Button b4=new Button("blue");
Button b5=new Button("brown");




public void init ()
{

Label L1 = new Label(" button programs")
Label L2 = new Label(" This is My Program")

add(b1);
add(b2);
add(b3);
add(b4);
add(b5);



b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);



public void paint (Graphics g)
{
g.setColor(blue);

g.drawOval(30, 50, 200, 200);
g.drawOval(19, 100, 200, 200);

}


}


}

button programs (This should be center)
This is My Program (This should be new line +center)



circles
should be here and should also be in
center



finally the five buttons should be in bottom and center
 
Old 04-30-2006, 12:20 PM   #2
mema_UAE
LQ Newbie
 
Registered: Apr 2006
Posts: 14

Original Poster
Rep: Reputation: 0
I face difficulty in organizing the design of my program and also I had another difficultly in labeling 3 or 4 sentences each one in a new line


code:


import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;




public class answer extends Applet implements ActionListener
{
Button b1=new Button("red");
Button b2=new Button("pink");
Button b3=new Button("Black");
Button b4=new Button("blue");
Button b5=new Button("brown");




public void init ()
{

Label L1 = new Label(" button programs")
Label L2 = new Label(" This is My Program")

add(b1);
add(b2);
add(b3);
add(b4);
add(b5);



b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);



public void paint (Graphics g)
{
g.setColor(blue);

g.drawOval(30, 50, 200, 200);
g.drawOval(19, 100, 200, 200);

}


}


}

button programs (This should be center)
This is My Program (This should be new line +center)



circles
should be here and should also be in
center



finally the five buttons should be in bottom and center[/QUOTE]
 
Old 04-30-2006, 12:21 PM   #3
mema_UAE
LQ Newbie
 
Registered: Apr 2006
Posts: 14

Original Poster
Rep: Reputation: 0
[QUOTE=mema_UAE]I face difficulty in organizing the design of my program and also I had another difficultly in labeling 3 or 4 sentences each one in a new line


code:


import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;




public class answer extends Applet implements ActionListener
{
Button b1=new Button("red");
Button b2=new Button("pink");
Button b3=new Button("Black");
Button b4=new Button("blue");
Button b5=new Button("brown");




public void init ()
{

Label L1 = new Label(" button programs")
Label L2 = new Label(" This is My Program")

add(b1);
add(b2);
add(b3);
add(b4);
add(b5);



b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);



public void paint (Graphics g)
{
g.setColor(blue);

g.drawOval(30, 50, 200, 200);
g.drawOval(19, 100, 200, 200);

}


}


}
button programs (This should be center)

This is My Program (This should be new line +center)



circles
should be here and should also be in center

finally the five buttons should be in bottom and center
 
Old 05-02-2006, 11:31 PM   #4
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
1
please dont post the same thing three times. if you made a mistake, then use the edit function to change it.

2
when you post code put it within the code tags.

for the previous two reasons, im sure you have lost alot of feedback due to people not wanting to bother with this thread, based on the appearance.

3
i assume your talking about the GridLayout layout manager..? have you read around to see what layout manager to use and how it works? try here
let us know any other specific questions about the layout manager you choose.

Last edited by nadroj; 05-02-2006 at 11:33 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Does anybody knows SUN GRID ENGINE?? meng_en Linux - General 4 02-24-2010 11:03 PM
grid control 10.1.0.3 waqar General 0 03-27-2006 03:09 AM
Grid Computing Oxagast Linux - General 4 12-01-2005 02:30 AM
The Grid And Linux JerryMcFarts General 7 02-24-2005 09:58 AM
XWindows (Snap to Grid) podollb Linux - Software 2 10-15-2003 08:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration