1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
package com.explodingpixels.macwidgets;
import java.awt.BorderLayout;
import java.util.Arrays;
import java.util.List;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import com.explodingpixels.widgets.PopupButton;
public class DComponentBottomBar {
public static void main(String[] args) {
List<String> list = Arrays.asList("Some Item One", "Some Item Two",
"Some Item Three", "Some Item Four");
PopupButton<String> popupButton = new PopupButton<String>(list.get(0),
list);
List<String> list2 = Arrays.asList("Custom...", "400%", "200%", "100%",
"75%", "50%", "25%");
PopupButton<String> placard2 = new PopupButton<String>(list2.get(3),
list2);
JComboBox comboBox = new JComboBox(list2.toArray());
JButton gradientButton = new JButton("Add");
gradientButton.putClientProperty("JButton.buttonType", "gradient");
// JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
ComponentBottomBar componentBottomBar = MacWidgetFactory
.createComponentStatusBar();
componentBottomBar.addComponentToLeftWithBorder(popupButton
.getComponent());
componentBottomBar
.addComponentToLeftWithBorder(placard2.getComponent());
componentBottomBar.addComponentToLeftWithBorder(gradientButton);
componentBottomBar.addComponentToRight((JComponent) Box
.createHorizontalStrut(14));
componentBottomBar.addComponentToCenterWithBorder(comboBox);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(componentBottomBar.getComponent(), BorderLayout.SOUTH);
frame.setSize(640, 480);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
|