Search in sources :

Example 1 with FormattedJTable

use of jgnash.ui.components.FormattedJTable 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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) RollOverButton(jgnash.ui.components.RollOverButton) MouseEvent(java.awt.event.MouseEvent) Insets(java.awt.Insets) KeyAdapter(java.awt.event.KeyAdapter) MouseAdapter(java.awt.event.MouseAdapter) JToolBar(javax.swing.JToolBar) JSeparator(javax.swing.JSeparator) FormattedJTable(jgnash.ui.components.FormattedJTable) KeyEvent(java.awt.event.KeyEvent) BorderLayout(java.awt.BorderLayout) EmptyBorder(javax.swing.border.EmptyBorder)

Example 2 with FormattedJTable

use of jgnash.ui.components.FormattedJTable in project jgnash by ccavanaugh.

the class NotificationDialog method layoutMainPanel.

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:p, 4dlu, fill:p:g", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.border(Borders.DIALOG);
    cancelButton = new JButton(rb.getString("Button.RemindLater"));
    okButton = new JButton(rb.getString("Button.AckSel"));
    table = new FormattedJTable(model);
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.getSelectionModel().addListSelectionListener(this);
    table.setColumnSelectionAllowed(false);
    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setAutoscrolls(true);
    builder.appendRow(RowSpec.decode("fill:80dlu:g"));
    builder.append(scrollPane, 3);
    builder.nextLine();
    builder.appendUnrelatedComponentsGapRow();
    builder.nextLine();
    builder.append(rb.getString("Label.RemindLater"), periodCombo);
    builder.nextLine();
    builder.appendRelatedComponentsGapRow();
    builder.nextLine();
    builder.append(StaticUIMethods.buildOKCancelBar(okButton, cancelButton), 3);
    getContentPane().add(builder.getPanel());
    pack();
    setMinimumSize(getSize());
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) FormattedJTable(jgnash.ui.components.FormattedJTable) JScrollPane(javax.swing.JScrollPane) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) JButton(javax.swing.JButton)

Example 3 with FormattedJTable

use of jgnash.ui.components.FormattedJTable in project jgnash by ccavanaugh.

the class TransactionListDialog method initComponents.

private void initComponents() {
    setTitle(rb.getString("Title.TransactionList"));
    selectButton = new JButton(rb.getString("Button.SelectAll"));
    clearButton = new JButton(rb.getString("Button.ClearAll"));
    invertButton = new JButton(rb.getString("Button.InvertSelection"));
    okButton = new JButton(rb.getString("Button.Ok"));
    cancelButton = new JButton(rb.getString("Button.Cancel"));
    model = new Model(_getPrintableTransactions());
    table = new FormattedJTable(model);
    table.getSelectionModel().addListSelectionListener(this);
    cancelButton.addActionListener(this);
    okButton.addActionListener(this);
    selectButton.addActionListener(this);
    clearButton.addActionListener(this);
    invertButton.addActionListener(this);
}
Also used : FormattedJTable(jgnash.ui.components.FormattedJTable) JButton(javax.swing.JButton) AbstractTableModel(javax.swing.table.AbstractTableModel)

Aggregations

FormattedJTable (jgnash.ui.components.FormattedJTable)3 JButton (javax.swing.JButton)2 JScrollPane (javax.swing.JScrollPane)2 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)1 FormLayout (com.jgoodies.forms.layout.FormLayout)1 BorderLayout (java.awt.BorderLayout)1 Insets (java.awt.Insets)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 JPanel (javax.swing.JPanel)1 JSeparator (javax.swing.JSeparator)1 JToolBar (javax.swing.JToolBar)1 EmptyBorder (javax.swing.border.EmptyBorder)1 AbstractTableModel (javax.swing.table.AbstractTableModel)1 RollOverButton (jgnash.ui.components.RollOverButton)1