use of javax.swing.JButton in project binnavi by google.
the class CProgressPanel method createPanel.
private void createPanel(final boolean indeterminate, final boolean showSeconds, final boolean showCancelButton, final boolean addBorder) {
setLayout(new BorderLayout());
final JPanel pPb = new JPanel(new BorderLayout());
pPb.setBorder(new TitledBorder(""));
if (m_description == null) {
m_label.setVisible(false);
} else {
m_label.setText(convertTextToHtml(m_description));
}
pPb.add(m_label, BorderLayout.NORTH);
m_progressBar.setIndeterminate(indeterminate);
m_progressBar.setStringPainted(true);
final JPanel borderPanel = new JPanel(new BorderLayout());
if (addBorder) {
borderPanel.setBorder(BorderFactory.createCompoundBorder(new LineBorder(Color.GRAY), new EmptyBorder(1, 1, 1, 1)));
}
if (showCancelButton) {
final JPanel buttonPanel = new JPanel(new BorderLayout());
final JButton cancelButton = new JButton(new CancelAction());
cancelButton.setFocusable(false);
final JPanel paddingPanel = new JPanel(new BorderLayout());
paddingPanel.setBorder(new EmptyBorder(0, 1, 0, 0));
paddingPanel.setMinimumSize(new Dimension(1, 0));
buttonPanel.add(paddingPanel, BorderLayout.WEST);
buttonPanel.add(cancelButton, BorderLayout.EAST);
borderPanel.add(buttonPanel, BorderLayout.EAST);
}
borderPanel.add(m_progressBar, BorderLayout.CENTER);
pPb.add(borderPanel, BorderLayout.CENTER);
if (indeterminate && showSeconds) {
updateSecondsText();
m_timer.setRepeats(true);
}
add(pPb, BorderLayout.NORTH);
}
use of javax.swing.JButton in project binnavi by google.
the class ErrorDialog method createGui.
private void createGui() {
final JPanel topPanel = new JPanel(new BorderLayout());
final JPanel messagePanel = new JPanel(new BorderLayout());
final JTextField messageField = new JTextField();
messageField.setEditable(false);
messageField.setText(message);
messageField.setBackground(Color.WHITE);
messagePanel.add(messageField);
messagePanel.setBorder(new TitledBorder("Error Message"));
topPanel.add(messagePanel, BorderLayout.NORTH);
final JTabbedPane tabbedPane = new JTabbedPane();
final JTextArea descriptionArea = new JTextArea();
descriptionArea.setEditable(false);
descriptionArea.setText(description);
descriptionArea.setLineWrap(true);
descriptionArea.setWrapStyleWord(true);
tabbedPane.addTab("Description", descriptionArea);
if (exception != null) {
final JTextArea traceArea = new JTextArea();
traceArea.setEditable(false);
traceArea.setText(StackTrace.toString(exception.getStackTrace()));
tabbedPane.addTab("Stack Trace", new JScrollPane(traceArea));
}
add(topPanel, BorderLayout.NORTH);
add(tabbedPane);
final JPanel bottomButtonPanel = new JPanel(new BorderLayout());
final JPanel leftButtonPanelBottom = new JPanel();
final JButton reportButton = new JButton(new ReportAction());
reportButton.setMinimumSize(new Dimension(180, reportButton.getHeight()));
leftButtonPanelBottom.add(reportButton);
bottomButtonPanel.add(leftButtonPanelBottom, BorderLayout.WEST);
final JPanel rightButtonPanelBottom = new JPanel();
final JButton okButton = new JButton(new CloseButtonListener());
getRootPane().setDefaultButton(okButton);
rightButtonPanelBottom.add(okButton);
bottomButtonPanel.add(rightButtonPanelBottom, BorderLayout.EAST);
add(bottomButtonPanel, BorderLayout.SOUTH);
}
use of javax.swing.JButton in project binnavi by google.
the class MemberDialog method createControls.
private void createControls(final TypeManager typeManager) {
setBounds(100, 100, 450, 215);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
final GridBagLayout gbl_contentPanel = new GridBagLayout();
gbl_contentPanel.columnWidths = new int[] { 0, 0, 0 };
gbl_contentPanel.rowHeights = new int[] { 0, 0, 0, 0 };
gbl_contentPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
contentPanel.setLayout(gbl_contentPanel);
{
final JLabel lblMemberName = new JLabel("Member name:");
final GridBagConstraints gbc_lblMemberName = new GridBagConstraints();
gbc_lblMemberName.insets = new Insets(0, 0, 5, 5);
gbc_lblMemberName.anchor = GridBagConstraints.EAST;
gbc_lblMemberName.gridx = 0;
gbc_lblMemberName.gridy = 0;
contentPanel.add(lblMemberName, gbc_lblMemberName);
}
{
memberName = new JTextField();
final GridBagConstraints gbc_memberName = new GridBagConstraints();
gbc_memberName.insets = new Insets(0, 0, 5, 0);
gbc_memberName.fill = GridBagConstraints.HORIZONTAL;
gbc_memberName.gridx = 1;
gbc_memberName.gridy = 0;
contentPanel.add(memberName, gbc_memberName);
memberName.setColumns(10);
}
{
final JLabel lblMemberType = new JLabel("Member type:");
final GridBagConstraints gbc_lblMemberType = new GridBagConstraints();
gbc_lblMemberType.anchor = GridBagConstraints.EAST;
gbc_lblMemberType.insets = new Insets(0, 0, 5, 5);
gbc_lblMemberType.gridx = 0;
gbc_lblMemberType.gridy = 1;
contentPanel.add(lblMemberType, gbc_lblMemberType);
}
{
memberType = new TypeComboBox(new TypeListModel(typeManager.getTypes(), new TypeListModel.PrototypesFilter()));
final GridBagConstraints gbc_memberType = new GridBagConstraints();
gbc_memberType.insets = new Insets(0, 0, 5, 0);
gbc_memberType.fill = GridBagConstraints.HORIZONTAL;
gbc_memberType.gridx = 1;
gbc_memberType.gridy = 1;
contentPanel.add(memberType, gbc_memberType);
}
{
final JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
final JButton okButton = new JButton("OK");
okButton.addActionListener(new OkActionListener());
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
final JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
dispose();
}
});
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
}
use of javax.swing.JButton in project binnavi by google.
the class CGraphToolBar method addButton.
/**
* Adds a button to the toolbar.
*
* @param action The action associated with the button.
* @param rolloverIcon Path to the icon to be used when the mouse hovers over the button.
* @param pressedIcon Path to the icon to be used when the button is pressed.
*
* @return The created button.
*/
private JButton addButton(final AbstractAction action, final String rolloverIcon, final String pressedIcon) {
final JButton button = add(CActionProxy.proxy(action));
button.setFocusable(false);
button.setBorder(new EmptyBorder(new Insets(1, 0, 1, 0)));
button.setRolloverIcon(new ImageIcon(CMain.class.getResource(rolloverIcon)));
button.setPressedIcon(new ImageIcon(CMain.class.getResource(pressedIcon)));
return button;
}
use of javax.swing.JButton in project binnavi by google.
the class CGraphToolBar method createButtons.
/**
* Creates the toolbar.
*
* @param parent Parent window used for dialogws.
* @param graph The graph the toolbar is for.
* @param graphPanel Panel in which the graph is shown.
*/
private void createButtons(final JFrame parent, final ZyGraph graph, final CGraphPanel graphPanel) {
final CActionZoomIn zoomInAction = new CActionZoomIn(graph);
final JButton zoomInButton = addButton(zoomInAction, "data/magnify_hover.jpg", "data/magnify_down.jpg");
addHotkey(zoomInButton, HotKeys.GRAPH_TOOLBAR_ZOOM_IN.getKeyStroke(), zoomInAction, "Zoom In");
final CActionZoomOut zoomOutAction = new CActionZoomOut(graph);
final JButton zoomOutButton = addButton(zoomOutAction, "data/reduce_hover.jpg", "data/reduce_down.jpg");
addHotkey(zoomOutButton, HotKeys.GRAPH_TOOLBAR_ZOOM_OUT.getKeyStroke(), zoomOutAction, "Zoom Out");
final CActionZoomSelected zoomSelectedAction = new CActionZoomSelected(graph);
final JButton zoomSelectedButton = addButton(zoomSelectedAction, "data/frameall_hover.jpg", "data/frameall_down.jpg");
addHotkey(zoomSelectedButton, HotKeys.GRAPH_TOOLBAR_ZOOM_SELECTED.getKeyStroke(), zoomSelectedAction, "Zoom Selected");
final CActionZoomFit zoomFitAction = new CActionZoomFit(graph);
final JButton zoomFitButton = addButton(zoomFitAction, "data/centerview_hover.jpg", "data/centerview_down.jpg");
addHotkey(zoomFitButton, HotKeys.GRAPH_TOOLBAR_ZOOM_FIT.getKeyStroke(), zoomFitAction, "Fit Graph to Screen");
m_magnifierModeAction = new CActionMagnifyingGlassViewMode(graph);
final JButton magnifierModeButton = addButton(m_magnifierModeAction, "data/nomagnifieingglass_hover.jpg", "data/nomagnifieingglass_down.jpg");
m_magnifierModeAction.setButton(magnifierModeButton);
addHotkey(magnifierModeButton, HotKeys.GRAPH_TOOLBAR_TOGGLE_MAGNIFY.getKeyStroke(), m_magnifierModeAction, "Magnifying Glass");
final CActionFreezeView freezeAction = new CActionFreezeView(graph);
final JButton freezeButton = addButton(freezeAction, "data/viewnavi_hover.jpg", "data/viewnavi_down.jpg");
freezeAction.setButton(freezeButton);
addHotkey(freezeButton, HotKeys.GRAPH_TOOLBAR_FREEZE.getKeyStroke(), freezeAction, "Freeze view");
final CActionCircularLayout circularAction = new CActionCircularLayout(parent, graph);
final JButton circularButton = addButton(circularAction, "data/laycirc_hover.jpg", "data/laycirc_down.jpg");
addHotkey(circularButton, HotKeys.GRAPH_TOOLBAR_CIRCULAR_LAYOUT.getKeyStroke(), circularAction, "Circular Layout");
final CActionOrthogonalLayout orthogonalAction = new CActionOrthogonalLayout(parent, graph);
final JButton orthogonalButton = addButton(orthogonalAction, "data/layorth_hover.jpg", "data/layorth_down.jpg");
addHotkey(orthogonalButton, HotKeys.GRAPH_TOOLBAR_ORTHOGONAL_LAYOUT.getKeyStroke(), orthogonalAction, "Orthogonal Layout");
final CActionHierarchicLayout hierarchicAction = new CActionHierarchicLayout(parent, graph);
final JButton hierarchicButton = addButton(hierarchicAction, "data/layhier_hover.jpg", "data/layhier_down.jpg");
addHotkey(hierarchicButton, HotKeys.GRAPH_TOOLBAR_HIERARCHIC_LAYOUT.getKeyStroke(), hierarchicAction, "Hierarchical Layout");
addButton(new CActionSelectChildren(graph, true), "data/selallchild_hover.jpg", "data/selallchild_down.jpg");
addButton(new CActionSelectParents(graph, true), "data/selparent_hover.jpg", "data/selparent_down.jpg");
addButton(new CActionInvertSelection(graph, true), "data/selinvert_hover.jpg", "data/selinvert_down.jpg");
addButton(new CActionSelectByCriteria(graphPanel, true), "data/selcriteria_hover.jpg", "data/selcriteria_down.jpg");
final CActionDeleteSelectedNodes deleteSelectedAction = new CActionDeleteSelectedNodes(graph, true);
final JButton deletedSelectedButton = addButton(deleteSelectedAction, "data/deleteselectednodes_hover.png", "data/deleteselectednodes_down.png");
addHotkey(deletedSelectedButton, HotKeys.GRAPH_TOOLBAR_DELETE_SELECTED.getKeyStroke(), deleteSelectedAction, HotKeys.GRAPH_TOOLBAR_DELETE_SELECTED.getDescription());
final CActionDeleteSelectedNodesKeep deleteSelectedKeepAction = new CActionDeleteSelectedNodesKeep(graph);
final JButton deletedSelectedKeepButton = addButton(deleteSelectedKeepAction, "data/deleteselectednodeskeepedges_hover.png", "data/deleteselectednodeskeepedges_down.png");
addHotkey(deletedSelectedKeepButton, HotKeys.GRAPH_TOOLBAR_DELETE_SELECTED_KEEP_EDGES.getKeyStroke(), deleteSelectedKeepAction, HotKeys.GRAPH_TOOLBAR_DELETE_SELECTED_KEEP_EDGES.getDescription());
addButton(new CActionColorNodes(graphPanel), "data/nodecolor_hover.jpg", "data/nodecolor_down.jpg");
}
Aggregations