ctrl-alt-Development
Your hotkey to alternative software development
Oct '03
05
Hier onder staat een voorbeeld van het button panel zoals ik dat gebruik in veel van mijn applicaties.
package nl.da.gui.panel;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.JComponent;
import javax.swing.JPanel;
/**
* A Panel for creating a horizontal series of
* buttons at the right side of the panel.
* Useful for Buttons at the bottom of dialogs.
* @author E.Hooijmeijer
*/
public class ButtonPanel extends JPanel {
/**
* Constructs a panel with a series of
* components placed horizontally at
* the right side of the panel.
* @param args the components to be placed.
*/
public ButtonPanel(JComponent[] args) {
super(new FlowLayout(FlowLayout.RIGHT));
JPanel sub=new JPanel();
sub.setLayout(new GridLayout(1,0,8,0));
//
for (int t=0;t<args.length;t++) {
sub.add(args[t]);
}
//
this.add(sub);
}
}
Links | |
Speed up your Swing GUI construction with better building blocks | www.javaworld.com |
SWT : The Standard Widget Toolkit - Part 1 | www.eclipse.org |
Effective Layout Management Short Course | developer.java.sun.com |