controls=new JPanel();
controls.setBackground(Color.white);
controls.setLayout(new BorderLayout());//new GridLayout(2,1));
// top part of grid: zoom buttons.
ComponentCluster buttons=new ComponentCluster("Zoom");
ImageIcon zoomOutIcon=new ImageIcon("images/zoom_out.gif");
JButton zoomOut=new JButton(zoomOutIcon);
buttons.addContent(zoomOut);
zoomOut.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Interval zoom=visuals.getViewInterval().subinterval(-1, 2).intersection(visuals.getGlobalInterval());
moveTime(zoom);
}});
ImageIcon zoomOut100Icon=new ImageIcon("images/zoom_out_100.gif");
JButton zoomOutAll=new JButton(zoomOut100Icon);
buttons.addContent(zoomOutAll);
zoomOutAll.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
moveTime(visuals.getGlobalInterval());
}});
/*
// UI for zooming to precisely fit the visible selection.
// No one seemed to think this was so important, but we may want it again some day.
// if you uncomment this, then also uncomment the line in reset().
ImageIcon zoomSelection=new ImageIcon("images/zoom_selection.gif");
fit=new JButton(zoomSelection);
fit.setBackground(Color.white);
buttons.addContent(fit);
fit.setEnabled(false);
fit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
moveTime(visuals.getFitToVisibleRange());
}});
*/
controls.add(buttons, BorderLayout.NORTH);
// ok, now do second part of grid: layout style buttons.
ComponentCluster layoutPanel=new ComponentCluster("Layout");
ButtonGroup layoutGroup=new ButtonGroup();
ImageIcon looseIcon=new ImageIcon("images/layout_loose.gif");
JRadioButton loose=new JRadioButton(looseIcon, true);
loose.setSelectedIcon(new ImageIcon("images/layout_loose_selected.gif"));
layoutPanel.addContent(loose);
loose.addActionListener(new LayoutSetter(TimelineVisuals.Layout.LOOSE));
layoutGroup.add(loose);
ImageIcon diagonalIcon=new ImageIcon("images/layout_diagonal.gif");
JRadioButton diagonal=new JRadioButton(diagonalIcon, false);
diagonal.setSelectedIcon(new ImageIcon("images/layout_diagonal_selected.gif"));
layoutPanel.addContent(diagonal);
diagonal.addActionListener(new LayoutSetter(TimelineVisuals.Layout.TIGHT));
layoutGroup.add(diagonal);
ImageIcon graphIcon=new ImageIcon("images/layout_graph.gif");
JRadioButton graph=new JRadioButton(graphIcon, false);
graph.setSelectedIcon(new ImageIcon("images/layout_graph_selected.gif"));
layoutPanel.addContent(graph);
graph.addActionListener(new LayoutSetter(TimelineVisuals.Layout.GRAPH));
layoutGroup.add(graph);
controls.add(layoutPanel, BorderLayout.CENTER);
}