use of javax.swing.JToolBar in project gephi by gephi.
the class PropertiesBar method select.
public void select(JPanel propertiesBar) {
this.propertiesBar = propertiesBar;
propertiesBar.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
add(propertiesBar, BorderLayout.CENTER);
propertiesBar.setOpaque(false);
for (Component c : propertiesBar.getComponents()) {
if (c instanceof JPanel || c instanceof JToolBar) {
((JComponent) c).setOpaque(false);
}
}
revalidate();
}
use of javax.swing.JToolBar in project jgnash by ccavanaugh.
the class DynamicJasperReportPanel method initializeUI.
private void initializeUI() {
GridBagConstraints gridBagConstraints;
JToolBar toolBar = new JToolBar();
firstButton = new JButton();
previousButton = new JButton();
nextButton = new JButton();
lastButton = new JButton();
actualSizeButton = new JToggleButton();
fitPageButton = new JToggleButton();
fitWidthButton = new JToggleButton();
zoomInButton = new JButton();
DefaultComboBoxModel<String> zoomModel = new DefaultComboBoxModel<>();
for (int z : ZOOM) {
zoomModel.addElement(z + "%");
}
zoomComboBox = new JComboBox<>(zoomModel);
DefaultComboBoxModel<Integer> fontModel = new DefaultComboBoxModel<>();
for (int i = 0; i <= 10; i++) {
fontModel.addElement(5 + i);
}
fontSizeComboBox = new JComboBox<>(fontModel);
fontSizeComboBox.setToolTipText(ResourceUtils.getString("ToolTip.FontSize"));
fontSizeComboBox.setSelectedItem(report.getBaseFontSize());
fontSizeComboBox.addActionListener(this);
zoomOutButton = new JButton();
mainPanel = new JPanel();
JScrollPane scrollPane = new JScrollPane();
scrollPanePanel = new JPanel();
pageGluePanel = new JPanel();
JPanel pagePanel = new JPanel();
JPanel shadowPanel1 = new JPanel();
JPanel shadowPanel2 = new JPanel();
JPanel shadowPanel3 = new JPanel();
JPanel shadowPanel4 = new JPanel();
JPanel shadowPanel5 = new JPanel();
setLayout(new BorderLayout());
toolBar.setFloatable(false);
toolBar.setRollover(true);
saveButton = new JButton(new ImageIcon(getClass().getResource("/jgnash/resource/document-save-as.png")));
saveButton.setToolTipText(resourceBundle.getString("save"));
saveButton.setFocusable(false);
saveButton.addActionListener(this);
toolBar.add(saveButton);
printButton = new JButton(new ImageIcon(getClass().getResource("/jgnash/resource/document-print.png")));
printButton.setToolTipText(resourceBundle.getString("print"));
printButton.setFocusable(false);
printButton.addActionListener(this);
toolBar.add(printButton);
toolBar.add(new JToolBar.Separator());
pageSetupButton = new JButton(new ImageIcon(getClass().getResource("/jgnash/resource/document-properties.png")));
pageSetupButton.setToolTipText(ResourceUtils.getString("ToolTip.PageSetup"));
pageSetupButton.setFocusable(false);
pageSetupButton.addActionListener(this);
toolBar.add(pageSetupButton);
fontSizeComboBox.setMaximumSize(new Dimension(50, pageSetupButton.getMinimumSize().height));
fontSizeComboBox.setMinimumSize(new Dimension(50, pageSetupButton.getMinimumSize().height));
fontSizeComboBox.setPreferredSize(new Dimension(50, pageSetupButton.getPreferredSize().height));
toolBar.add(fontSizeComboBox);
toolBar.add(new JToolBar.Separator());
firstButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/go-first.png")));
firstButton.setToolTipText(resourceBundle.getString("first.page"));
firstButton.setFocusable(false);
firstButton.setEnabled(false);
firstButton.addActionListener(this);
toolBar.add(firstButton);
previousButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/go-previous.png")));
previousButton.setToolTipText(resourceBundle.getString("previous.page"));
previousButton.setFocusable(false);
previousButton.setEnabled(false);
previousButton.addActionListener(this);
toolBar.add(previousButton);
nextButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/go-next.png")));
nextButton.setToolTipText(resourceBundle.getString("next.page"));
nextButton.setFocusable(false);
nextButton.setEnabled(false);
nextButton.addActionListener(this);
toolBar.add(nextButton);
lastButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/go-last.png")));
lastButton.setToolTipText(resourceBundle.getString("last.page"));
lastButton.setFocusable(false);
lastButton.setEnabled(false);
lastButton.addActionListener(this);
toolBar.add(lastButton);
toolBar.add(new JToolBar.Separator());
actualSizeButton.setIcon(new ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/actualsize.GIF")));
actualSizeButton.setToolTipText(resourceBundle.getString("actual.size"));
actualSizeButton.setFocusable(false);
actualSizeButton.addActionListener(this);
toolBar.add(actualSizeButton);
fitPageButton.setIcon(new ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitpage.GIF")));
fitPageButton.setToolTipText(resourceBundle.getString("fit.page"));
fitPageButton.setFocusable(false);
fitPageButton.addActionListener(this);
toolBar.add(fitPageButton);
fitWidthButton.setIcon(new ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitwidth.GIF")));
fitWidthButton.setToolTipText(resourceBundle.getString("fit.width"));
fitWidthButton.setFocusable(false);
fitWidthButton.addActionListener(this);
toolBar.add(fitWidthButton);
toolBar.add(new JToolBar.Separator());
zoomInButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/zoom-in.png")));
zoomInButton.setToolTipText(resourceBundle.getString("zoom.in"));
zoomInButton.setFocusable(false);
zoomInButton.addActionListener(this);
toolBar.add(zoomInButton);
zoomComboBox.setEditable(true);
zoomComboBox.setToolTipText(resourceBundle.getString("zoom.ratio"));
zoomComboBox.setMaximumSize(new Dimension(90, zoomInButton.getMinimumSize().height));
zoomComboBox.setMinimumSize(new Dimension(90, zoomInButton.getMinimumSize().height));
zoomComboBox.setPreferredSize(new Dimension(90, zoomInButton.getPreferredSize().height));
zoomComboBox.addItemListener(evt -> zoomStateChange());
zoomComboBox.addActionListener(this);
toolBar.add(zoomComboBox);
zoomOutButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/zoom-out.png")));
zoomOutButton.setToolTipText(resourceBundle.getString("zoom.out"));
zoomOutButton.setFocusable(false);
zoomOutButton.addActionListener(this);
toolBar.add(zoomOutButton);
JPanel reportController = report.getReportController();
if (reportController != null) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(toolBar, BorderLayout.NORTH);
panel.add(reportController, BorderLayout.CENTER);
add(panel, BorderLayout.NORTH);
} else {
add(toolBar, BorderLayout.NORTH);
}
mainPanel.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(final ComponentEvent evt) {
pnlMainComponentResized();
}
});
mainPanel.setLayout(new BorderLayout());
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scrollPanePanel.setLayout(new GridBagLayout());
pageGluePanel.setLayout(new BorderLayout());
pagePanel.setLayout(new GridBagLayout());
spaceHoldPanel = new JPanel();
spaceHoldPanel.setMinimumSize(new Dimension(5, 5));
spaceHoldPanel.setOpaque(false);
spaceHoldPanel.setPreferredSize(new Dimension(5, 5));
spaceHoldPanel.setLayout(null);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = GridBagConstraints.BOTH;
pagePanel.add(spaceHoldPanel, gridBagConstraints);
shadowPanel1.setBackground(java.awt.Color.gray);
shadowPanel1.setMinimumSize(new Dimension(5, 5));
shadowPanel1.setPreferredSize(new Dimension(5, 5));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = GridBagConstraints.VERTICAL;
pagePanel.add(shadowPanel1, gridBagConstraints);
shadowPanel2.setMinimumSize(new Dimension(5, 5));
shadowPanel2.setPreferredSize(new Dimension(5, 5));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
pagePanel.add(shadowPanel2, gridBagConstraints);
shadowPanel3.setBackground(Color.gray);
shadowPanel3.setMinimumSize(new Dimension(5, 5));
shadowPanel3.setPreferredSize(new Dimension(5, 5));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
pagePanel.add(shadowPanel3, gridBagConstraints);
shadowPanel4.setBackground(Color.gray);
shadowPanel4.setMinimumSize(new Dimension(5, 5));
shadowPanel4.setPreferredSize(new Dimension(5, 5));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 2;
pagePanel.add(shadowPanel4, gridBagConstraints);
shadowPanel5.setMinimumSize(new Dimension(5, 5));
shadowPanel5.setPreferredSize(new Dimension(5, 5));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
pagePanel.add(shadowPanel5, gridBagConstraints);
pageRenderer = new PageRenderer(this);
pageRenderer.setBackground(Color.white);
pageRenderer.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0)));
pageRenderer.setOpaque(true);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
pagePanel.add(pageRenderer, gridBagConstraints);
pageGluePanel.add(pagePanel, BorderLayout.CENTER);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
scrollPanePanel.add(pageGluePanel, gridBagConstraints);
scrollPane.setViewportView(scrollPanePanel);
mainPanel.add(scrollPane, BorderLayout.CENTER);
add(mainPanel, BorderLayout.CENTER);
zoomComboBox.setSelectedIndex(DEFAULT_ZOOM_INDEX);
}
use of javax.swing.JToolBar in project jgnash by ccavanaugh.
the class MainFrame method buildUI.
private void buildUI() {
ActionParser actionParser = new ActionParser(this);
actionParser.preLoadActions("jgnash.ui.actions");
actionParser.preLoadAction("copy-command", new DefaultEditorKit.CopyAction());
actionParser.preLoadAction("cut-command", new DefaultEditorKit.CutAction());
actionParser.preLoadAction("paste-command", new DefaultEditorKit.PasteAction());
actionParser.preLoadAction("exit-command", new AbstractAction() {
@Override
public void actionPerformed(final ActionEvent e) {
shutDown();
}
});
actionParser.preLoadAction("open-command", new OpenFileAction());
actionParser.preLoadAction("open-command-tb", new OpenFileAction());
actionParser.preLoadAction("account-filter-command", new AbstractEnabledAction() {
@Override
public void actionPerformed(final ActionEvent e) {
expandingAccountPanel.showAccountFilterDialog();
}
});
actionParser.preLoadAction("register-filter-command", new AbstractEnabledAction() {
@Override
public void actionPerformed(final ActionEvent e) {
registerTreePanel.showAccountFilterDialog();
}
});
actionParser.preLoadAction("currency-background-update-command", new UpdateExchangeRateAction());
actionParser.preLoadAction("security-background-update-command", new UpdateSecuritiesAction());
try (final InputStream stream = MainFrame.class.getResourceAsStream("/jgnash/resource/main-frame-actions.xml")) {
actionParser.loadFile(stream);
} catch (final IOException exception) {
logger.log(Level.SEVERE, exception.getMessage(), exception);
}
menuBar = actionParser.createMenuBar("main-menu");
JToolBar toolBar = actionParser.createToolBar("main-toolbar");
toolBar.setFloatable(false);
toolBar.setRollover(true);
viewMenu = (JMenu) actionParser.getJMenuItem("view-menu-command");
reportMenu = (JMenu) actionParser.getJMenuItem("report-menu-command");
windowMenu = (JMenu) actionParser.getJMenuItem("window-menu-command");
Objects.requireNonNull(windowMenu);
windowMenu.setEnabled(false);
editAction = actionParser.getAction("edit-menu-command");
if (EngineFactory.getEngine(EngineFactory.DEFAULT) == null) {
setOpenState(false);
}
setTitle(Main.VERSION);
mainView = buildMainView();
backgroundOperationLabel = new JXBusyLabel(new Dimension(18, 18));
statusField = new JTextField();
statusField.setEditable(false);
statusField.setFont(statusField.getFont().deriveFont(statusField.getFont().getSize2D() - 1f));
infoColor = statusField.getForeground();
JXStatusBar statusBar = new JXStatusBar();
statusBar.setResizeHandleEnabled(true);
statusBar.add(statusField, new JXStatusBar.Constraint(JXStatusBar.Constraint.ResizeBehavior.FILL));
if (ThemeManager.isLookAndFeelSubstance()) {
statusBar.add(new SubstanceFontSlider());
}
statusBar.add(backgroundOperationLabel);
statusBar.add(new MemoryMonitor(), new JXStatusBar.Constraint(120));
JPanel contentPanel = new JPanel(new BorderLayout());
contentPanel.add(toolBar, BorderLayout.NORTH);
contentPanel.add(mainView, BorderLayout.CENTER);
contentPanel.add(statusBar, BorderLayout.SOUTH);
JPanel rootPanel = new JPanel(new BorderLayout());
rootPanel.add(menuBar, BorderLayout.NORTH);
rootPanel.add(contentPanel, BorderLayout.CENTER);
waitPanel = new WaitMessagePanel();
busyLayerUI = new BusyLayerUI();
JLayer<JPanel> rootLayer = new JLayer<>(rootPanel, busyLayerUI);
getContentPane().add(rootLayer, BorderLayout.CENTER);
setGlassPane(waitPanel);
}
use of javax.swing.JToolBar in project jgnash by ccavanaugh.
the class CheckDesignDialog method initComponents.
private void initComponents() {
toolBar = new JToolBar();
toolBar.setRollover(true);
openButton = new RollOverButton(rb.getString("Menu.Open.Name").replace("_", ""), IconUtils.getIcon("/jgnash/resource/document-open.png"));
saveButton = new RollOverButton(rb.getString("Menu.Save.Name").replace("_", ""), IconUtils.getIcon("/jgnash/resource/document-save.png"));
toolBar.add(openButton);
toolBar.add(saveButton);
checkLayout = new CheckLayout();
layout = new PrintableCheckLayout(checkLayout);
countField = getIntegerField();
xPosField = getFloatField();
yPosField = getFloatField();
heightField = getFloatField();
previewPanel = new PrintPreviewPanel(layout, layout.getPageFormat());
objectList = new JList<>();
//objectList.setPrototypeCellValue("Some dummy text");
setupButton = new JButton(rb.getString("Button.PageSetup"));
addButton = new JButton(rb.getString("Button.Add"));
removeButton = new JButton(rb.getString("Button.Remove"));
clearButton = new JButton(rb.getString("Button.Clear"));
applyButton = new JButton(rb.getString("Button.Apply"));
printButton = new JButton(rb.getString("Button.PrintSample"));
closeButton = new JButton(rb.getString("Button.Close"));
nameField = new JTextFieldEx();
typeCombo = new JComboBox<>();
DefaultComboBoxModel<CheckObjectType> comboModel = new DefaultComboBoxModel<>(CheckObjectType.values());
typeCombo.setModel(comboModel);
model = new DefaultListModel<>();
objectList.setModel(model);
objectList.addListSelectionListener(this);
addButton.addActionListener(this);
applyButton.addActionListener(this);
closeButton.addActionListener(this);
clearButton.addActionListener(this);
countField.addActionListener(this);
removeButton.addActionListener(this);
setupButton.addActionListener(this);
heightField.addActionListener(this);
saveButton.addActionListener(this);
openButton.addActionListener(this);
printButton.addActionListener(this);
heightField.addFocusListener(this);
countField.addFocusListener(this);
}
use of javax.swing.JToolBar in project jgnash by ccavanaugh.
the class RecurringPanel method initComponents.
private void initComponents() {
JPanel toolPanel = new JPanel(new BorderLayout());
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
toolBar.setRollover(true);
newButton = new RollOverButton(rb.getString("Button.New"), IconUtils.getIcon("/jgnash/resource/document-new.png"));
modifyButton = new RollOverButton(rb.getString("Button.Modify"), IconUtils.getIcon("/jgnash/resource/document-properties.png"));
deleteButton = new RollOverButton(rb.getString("Button.Delete"), IconUtils.getIcon("/jgnash/resource/edit-delete.png"));
remindersButton = new RollOverButton(rb.getString("Button.CheckReminders"), IconUtils.getIcon("/jgnash/resource/view-refresh.png"));
reminderTable = new FormattedJTable();
reminderTable.setAutoCreateRowSorter(true);
reminderTable.setFillsViewportHeight(true);
reminderTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
reminderTable.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(final KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_DELETE) {
deleteReminder();
}
}
});
reminderTable.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
if (e.getClickCount() == 2) {
showModifyDialog();
}
}
});
setLayout(new BorderLayout());
toolBar.add(newButton);
toolBar.add(modifyButton);
toolBar.add(deleteButton);
toolBar.addSeparator();
toolBar.add(remindersButton);
toolPanel.add(toolBar, BorderLayout.NORTH);
toolPanel.add(new JSeparator(), BorderLayout.CENTER);
add(toolPanel, java.awt.BorderLayout.NORTH);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBorder(new EmptyBorder(new Insets(0, 0, 0, 0)));
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setAutoscrolls(true);
scrollPane.setViewportView(reminderTable);
add(scrollPane, java.awt.BorderLayout.CENTER);
deleteButton.addActionListener(this);
modifyButton.addActionListener(this);
newButton.addActionListener(this);
remindersButton.addActionListener(this);
}
Aggregations