The Artima Developer Community
Sponsored Link

Java Answers Forum
how to put three button into one borders

1 reply on 1 page. Most recent reply: Jul 13, 2003 5:19 PM by zenykx

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
xiaobin liu

Posts: 1
Nickname: xbl2
Registered: Jul, 2003

how to put three button into one borders Posted: Jul 13, 2003 2:23 AM
Reply to this message Reply
Advertisement
Hello:
Please tell me how to set up a borders for multiple buttons.
For example, I got six JButtons, their name are bOne, bTwo,bThree, bFour, bFive, bSix. I want a borders for
bOne, bTwo,bThree, and another borders for bFour, bFive, bSix.

Thanks


/////////////////////////////////////////////
/*
 *This program for add six Buttons on the JFrame
 */
import javax.swing.*;
import java.awt.*;
 
public class TestButton extends JFrame{
	
	private static TestButton tB;
	private static JButton jB;
	
	public static void main(String [] args){
		
		tB=new TestButton();
		tB.pack();
		tB.setVisible(true);
	}
	
	public TestButton(){
		Container c=getContentPane();
		c.setLayout(new GridLayout(1,6));
		
		//add six buttons to frame
		jB=new JButton("Bone  ");
		jB.setBorder(null);
		c.add(jB);
		jB=new JButton("Btwo  ");
		jB.setBorder(null);
		c.add(jB);
		jB=new JButton("Btree  ");
		jB.setBorder(null);
		c.add(jB);
		jB=new JButton("Bfour  ");
		jB.setBorder(null);
		c.add(jB);
	    jB=new JButton("Bfive  ");
	    jB.setBorder(null);
		c.add(jB);
		jB=new JButton("Bsix");
		jB.setBorder(null);
		c.add(jB);
		
	}	
	
	
}
 


zenykx

Posts: 69
Nickname: zenykx
Registered: May, 2003

Re: how to put three button into one borders Posted: Jul 13, 2003 5:19 PM
Reply to this message Reply
You place them inside a JPanel and set one border for this JPanel.

Flat View: This topic has 1 reply on 1 page
Topic: Multiple trandaction in EJB using CMP Previous Topic   Next Topic Topic: CORBA.TRANSACTION_ROLLEDBACK Exception on Websphere 5.0

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use