######################
ButtonCol.java Nested container where the top-level panels are positioned by hand
######################
import java.applet.Applet;
import java.awt.*;
/** An example of a layout performed manually. The top-level
* panels are positioned by hand, after you determine the size
* of the applet. Since applets can't be resized in most
* browsers, setting the size once when the applet is created
* is sufficient.
*
***************************
public class ButtonCol extends Applet {
public void init() {
setLayout(null);
int width1 = getSize().width*4/10,
width2 = getSize().width - width1,
height = getSize().height;
Panel buttonPanel = new Panel();
buttonPanel.setBounds(0, 0, width1, height);
buttonPanel.setLayout(new GridLayout(6, 1));
buttonPanel.add(new Label("Buttons", Label.CENTER));
buttonPanel.add(new Button("Button One"));
buttonPanel.add(new Button("Button Two"));
buttonPanel.add(new Button("Button Three"));
buttonPanel.add(new Button("Button Four"));
buttonPanel.add(new Button("Button Five"));
add(buttonPanel);
Panel everythingElse = new Panel();
everythingElse.setBounds(width1+1, 0, width2, height);
everythingElse.add(new Label("Everything Else"));
add(everythingElse);
}
}
Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017 From: http://sitestree.com/?p=10353
Categories:Programming Code Examples, Java/J2EE/J2ME, Layout Managers
Tags:Java/J2EE/J2MELayout Managers
Post Data:2017-01-02 16:04:35
Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada
