Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-17-2008, 07:12 AM
Member
 
Join Date: Jan 2008
Posts: 16
banie is on a distinguished road
Merge 2 button become one
Hi..

I'm newbie in this java. Need help here.. I want to merge button 10 and 14 become one. How to do that?

Quote:
import java.awt.*;

public class GridExample {
private Frame f;
private Button b1, b2, b3, b4, b5, b6, b7, b8, b9;
private Button b10, b11, b12, b13, b14, b15, b16, b17, b18, b19;
private Button b20, b21, b22, b23, b24, b25, b26;

public GridExample() {
f = new Frame("Contoh Grid");
b1 = new Button("1");
b2 = new Button("2");
b3 = new Button("3");
b4 = new Button("4");
b5 = new Button("5");
b6 = new Button("6");
b7 = new Button("7");
b8 = new Button("8");
b9 = new Button("9");
b10 = new Button("10");
b11 = new Button("11");
b12 = new Button("12");
b13 = new Button("13");
b14 = new Button("14");
b15 = new Button("15");
b16 = new Button("16");
b17 = new Button("17");
b18 = new Button("18");

}

public void launchFrame() {
f. setLayout (new GridLayout(5,6));

f.add(b1);
f.add(b2);
f.add(b3);
f.add(b4);
f.add(b5);
f.add(b6);
f.add(b7);
f.add(b8);
f.add(b9);
f.add(b10);
f.add(b11);
f.add(b12);
f.add(b13);
f.add(b14);
f.add(b15);
f.add(b16);
f.add(b17);
//b13.setHgap(2);

f.setSize(200,200);
b1.setVisible(false);
b2.setVisible(false);
b6.setVisible(false);
b2.setVisible(false);
b3.setVisible(false);
b4.setVisible(false);
//b7.setVisible(false);
b8.setVisible(false);
//b9.setVisible(false);
//f.pack();
f.setVisible(true);
}

public static void main (String[] args) {
GridExample grid = new GridExample();
grid.launchFrame();
}
}
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-17-2008, 06:26 PM
Senior Member
 
Join Date: Jul 2007
Posts: 1,029
hardwired is on a distinguished road
I don't think you can do it so well with GridLayout. Depends on what you want to do with your grid. I would consider drawing a grid, use an int or boolean array to track/control visibility.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge Sort in Java Java Tip Algorithms 0 04-15-2008 08:43 PM
Merge Two Xml files ???? alwz_nikhil XML 3 03-28-2008 12:40 PM
How do merge two xml files into one xml? veera XML 1 03-27-2008 06:06 PM
Merge Sort Help Hollywood New To Java 5 01-30-2008 04:26 AM
PDF Split and Merge 0.7 beta 1 JavaBean Java Announcements 0 06-24-2007 09:46 AM


All times are GMT +3. The time now is 01:05 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org