File: DBottomBar.java

package info (click to toggle)
mac-widgets 0.10.0%2Bsvn416-dfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,968 kB
  • sloc: java: 9,909; makefile: 13; sh: 12
file content (58 lines) | stat: -rw-r--r-- 2,065 bytes parent folder | download | duplicates (4)
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
57
58
package com.explodingpixels.macwidgets;

import java.awt.BorderLayout;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;

import com.explodingpixels.widgets.WindowUtils;

public class DBottomBar {

	public static void main(String[] args) {

		JButton leftButton = new JButton(new ImageIcon(
				DBottomBar.class.getResource("/com/explodingpixels/macwidgets/icons/AddItem16.png")));
		leftButton.putClientProperty("JButton.buttonType", "segmentedTextured");
		leftButton.putClientProperty("JButton.segmentPosition", "first");
		leftButton.setFocusable(false);

		JButton rightButton = new JButton(new ImageIcon(
				DBottomBar.class.getResource("/com/explodingpixels/macwidgets/icons/RemoveItem16.png")));
		rightButton.putClientProperty("JButton.buttonType", "segmentedTextured");
		rightButton.putClientProperty("JButton.segmentPosition", "last");
		rightButton.setFocusable(false);

		ButtonGroup group = new ButtonGroup();
		group.add(leftButton);
		group.add(rightButton);

		JButton lockButton = new JButton(new ImageIcon(
				DBottomBar.class.getResource("/com/explodingpixels/macwidgets/icons/lock.png")));
		lockButton.putClientProperty("JButton.buttonType", "textured");

		JTextArea textArea = new JTextArea();

		BottomBar bottomBar = new BottomBar(BottomBarSize.SMALL);
		bottomBar.addComponentToLeft(leftButton, 0);
		bottomBar.addComponentToLeft(rightButton);
		bottomBar.addComponentToCenter(MacWidgetFactory.createEmphasizedLabel("362 Items"));
		bottomBar.addComponentToRight(lockButton);

		JFrame frame = new JFrame();
		bottomBar.installWindowDraggerOnWindow(frame);
		MacUtils.makeWindowLeopardStyle(frame.getRootPane());
		WindowUtils.createAndInstallRepaintWindowFocusListener(frame);
		frame.add(bottomBar.getComponent(), BorderLayout.SOUTH);
		frame.add(textArea, BorderLayout.CENTER);
		frame.setSize(500, 200);
		frame.setLocationRelativeTo(null);
		frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		frame.setVisible(true);

	}

}