use of javax.swing.JComponent in project jgnash by ccavanaugh.
the class BudgetPanel method addSummaryCorner.
private void addSummaryCorner() {
JComponent footer = ((AccountRowFooterPanel) scrollPane.getRowFooter().getView()).getFooter();
scrollPane.setCorner(JScrollPane.LOWER_RIGHT_CORNER, footer);
}
use of javax.swing.JComponent in project jgnash by ccavanaugh.
the class AccountRowHeaderResizeHandler method attach.
private void attach() {
rowHeaderViewport = scrollPane.getRowHeader();
if (rowHeaderViewport == null) {
throw new IllegalArgumentException("JScrollPane does not have a row header");
}
rowHeader = (AccountRowHeaderPanel) rowHeaderViewport.getView();
minimumWidth = rowHeader.getMinimumSize().width;
maximumWidth = rowHeader.getMaximumSize().width;
corner = scrollPane.getCorner(JScrollPane.UPPER_LEFT_CORNER);
if (corner instanceof JComponent) {
Border border = ((JComponent) corner).getBorder();
Insets insets = border.getBorderInsets(corner);
borderWidth = insets.left + insets.right;
} else {
borderWidth = 0;
}
rowHeader.getTable().getModel().addTableModelListener(listener);
}
use of javax.swing.JComponent in project jdk8u_jdk by JetBrains.
the class SwingUtilities3 method getDelegateRepaintManager.
/**
* Returns delegate {@code RepaintManager} for {@code component} hierarchy.
*/
public static RepaintManager getDelegateRepaintManager(Component component) {
RepaintManager delegate = null;
if (Boolean.TRUE == SunToolkit.targetToAppContext(component).get(DELEGATE_REPAINT_MANAGER_KEY)) {
while (delegate == null && component != null) {
while (component != null && !(component instanceof JComponent)) {
component = component.getParent();
}
if (component != null) {
delegate = (RepaintManager) ((JComponent) component).getClientProperty(DELEGATE_REPAINT_MANAGER_KEY);
component = component.getParent();
}
}
}
return delegate;
}
use of javax.swing.JComponent in project jabref by JabRef.
the class EntryEditor method setupToolBar.
private void setupToolBar() {
JPanel leftPan = new JPanel();
leftPan.setLayout(new BorderLayout());
JToolBar toolBar = new OSXCompatibleToolbar(SwingConstants.VERTICAL);
toolBar.setBorder(null);
toolBar.setRollover(true);
toolBar.setMargin(new Insets(0, 0, 0, 2));
// The toolbar carries all the key bindings that are valid for the whole window.
ActionMap actionMap = toolBar.getActionMap();
InputMap inputMap = toolBar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_ENTRY_EDITOR), "close");
actionMap.put("close", closeAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.ENTRY_EDITOR_STORE_FIELD), "store");
actionMap.put("store", storeFieldAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.AUTOGENERATE_BIBTEX_KEYS), "generateKey");
actionMap.put("generateKey", generateKeyAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.AUTOMATICALLY_LINK_FILES), "autoLink");
actionMap.put("autoLink", autoLinkAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.ENTRY_EDITOR_PREVIOUS_ENTRY), "prev");
actionMap.put("prev", prevEntryAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.ENTRY_EDITOR_NEXT_ENTRY), "next");
actionMap.put("next", nextEntryAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.UNDO), "undo");
actionMap.put("undo", undoAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.REDO), "redo");
actionMap.put("redo", redoAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.HELP), "help");
actionMap.put("help", helpAction);
toolBar.setFloatable(false);
// Add actions (and thus buttons)
JButton closeBut = new JButton(closeAction);
closeBut.setText(null);
closeBut.setBorder(null);
closeBut.setMargin(new Insets(8, 0, 8, 0));
leftPan.add(closeBut, BorderLayout.NORTH);
// Create type-label
TypedBibEntry typedEntry = new TypedBibEntry(entry, panel.getBibDatabaseContext().getMode());
leftPan.add(new TypeLabel(typedEntry.getTypeForDisplay()), BorderLayout.CENTER);
TypeButton typeButton = new TypeButton();
toolBar.add(typeButton);
toolBar.add(generateKeyAction);
toolBar.add(autoLinkAction);
toolBar.add(writeXmp);
JPopupMenu fetcherPopup = new JPopupMenu();
for (EntryBasedFetcher fetcher : WebFetchers.getEntryBasedFetchers(Globals.prefs.getImportFormatPreferences())) {
fetcherPopup.add(new JMenuItem(new AbstractAction(fetcher.getName()) {
@Override
public void actionPerformed(ActionEvent e) {
new EntryFetchAndMergeWorker(panel, getEntry(), fetcher).execute();
}
}));
}
JButton fetcherButton = new JButton(IconTheme.JabRefIcon.REFRESH.getIcon());
fetcherButton.setToolTipText(Localization.lang("Update with bibliographic information from the web"));
fetcherButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
fetcherPopup.show(e.getComponent(), e.getX(), e.getY());
}
});
toolBar.add(fetcherButton);
toolBar.addSeparator();
toolBar.add(deleteAction);
toolBar.add(prevEntryAction);
toolBar.add(nextEntryAction);
toolBar.addSeparator();
toolBar.add(helpAction);
Component[] comps = toolBar.getComponents();
for (Component comp : comps) {
((JComponent) comp).setOpaque(false);
}
leftPan.add(toolBar, BorderLayout.SOUTH);
add(leftPan, BorderLayout.WEST);
}
use of javax.swing.JComponent in project JMRI by JMRI.
the class EditableList method prepareEditor.
public Component prepareEditor(int index) {
E value = getModel().getElementAt(index);
boolean isSelected = isSelectedIndex(index);
Component comp = cellEditor.getListCellEditorComponent(this, value, isSelected, index);
if (comp instanceof JComponent) {
JComponent jComp = (JComponent) comp;
if (jComp.getNextFocusableComponent() == null) {
jComp.setNextFocusableComponent(this);
}
}
return comp;
}
Aggregations