-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
Unified Tool Bar (Javadoc)
Unified Tool Bars (described here in the Apple Human Interface Guidelines) provide a container for the most frequently used tools in your application. This is most likely what your user will want to use for the main navigation.
Simple Unified Tool Bar example:
// For some versions of Mac OS X, Java will handle painting the Unified Tool Bar. // Calling this method ensures that this painting is turned on if necessary. MacUtils.makeWindowLeopardStyle(frame.getRootPane());UnifiedToolBar toolBar = UnifiedToolBar(); JButton button = new JButton("My Button"); button.putClientProperty("JButton.buttonType", "textured");
// Create a new mac button based on the JButton. AbstractButton macButton = MacButtonFactory.makeUnifiedToolBarButton(button); // Add the button to the left side of the toolbar. toolBar.addComponentToLeft(button);
// This is so that the window can be dragged from anywhere on the toolbar. // This is optional, but will make your Java application feel more like an OSX app. macMainMenu.installWindowDraggerOnWindow(MainFrame);
// Add the toolbar to the frame. frame.add(toolBar.getComponent(), BorderLayout.NORTH);
iTunes Table (Javadoc)
Create an iTunes style table like this:
String[][] data = new String[][]{ {"A", "B", "C"}, {"D", "E", "F"}, {"G", "H", "I"}}; String[] columnNames = String[]{"One", "Two", "Three"}; TableModel model = new DefaultTableModel(data, columnNames); JTable table = MacWidgetFactory.createITunesTable(model);
you can add sort indicators by doing this:
TableUtils.SortDelegate sortDelegate = new TableUtils.SortDelegate() { public void sort(int columnModelIndex, TableUtils.SortDirection sortDirection) { // initiate your sorting here. } }; TableUtils.makeSortable(table, sortDelegate);
iApp Scroll Bars (Javadoc)
iApp style scroll bars can be seen in various Apple applications, most notably iTunes.
Using iApp scroll bars with a JScrollPane
JScrollPane scrollPane = new JScrollPane(someComponent); IAppWidgetFactory.makeIAppScrollPane(scrollPane);
Using iApp scroll bars with a SourceList?
sourceList.useIAppStyleScrollBars();
Heads Up Display (HUD) (Javadoc)
HUDs, also know as Transparent Panels, (descibed here in the Apple Human Interface Guidelines) provide a way to unobtrusively display transient information.
Simple HUD example:
HudWindow hud = new HudWindow("Window"); hud.getJDialog().setSize(300, 350); hud.getJDialog().setLocationRelativeTo(null); hud.getJDialog().setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); hud.getJDialog().setVisible(true);
HUD Style Controls (Javadoc)
HUD style controls should be used in conjunction with HUD windows.
JLabel label = HudWidgetFactory.createHudLabel("Label");
JButton button = HudWidgetFactory.createHudButton("Button");
JCheckBox checkBox = HudWidgetFactory.createHudCheckBox("Check Box");
JComboBox comboBox = HudWidgetFactory.createHudComboBox( new DefaultComboBoxModel(new String[]{"Item One", "Item Two", "Item Three"}));
JTextField textField = HudWidgetFactory.createHudTextField("Text field");
Source Lists (Javadoc)
Source Lists (described here in the Apple Human Interface Guidelines) are a way to navigate or select objects in an application. There are two types of Source Lists: focusable and non-focusable. Focusable Source Lists can receive keyboard focus, and thus be navigated with the arrow keys, whereas non-focusable Source Lists cannot be navigated with the keyboard. Here is a focusable and non-focusable Source List:
Simple Source List example:
SourceListModel model = new SourceListModel(); SourceListCategory category = new SourceListCategory("Category"); model.addCategory(category); model.addItemToCategory(new SourceListItem("Item"), category); SourceList sourceList = new SourceList(model);
Dark Source Lists (Javadoc)
The SourceListDarkColorScheme can be installed on SourceLists used in applications where focus on content is critical, like photo editing applications.
SourceListModel model = new SourceListModel(); SourceListCategory category = new SourceListCategory("Category"); model.addCategory(category); model.addItemToCategory(new SourceListItem("Item"), category); SourceList sourceList = new SourceList(model); sourceList.setColorScheme(new SourceListDarkColorScheme());
Bottom Bar (Javadoc)
Bottom Bars (described here in the Apple Human Interface Guidelines) provide a mechanism to add controls to an application that affect the contents or organization of the window contents.
Simple Bottom Bar example:
BottomBar bottomBar = BottomBar(BottomBarSize.LARGE); bottomBar.addComponentToCenter(MacWidgetFactory.createEmphasizedLabel("My Label"));