use of javax.swing.JComponent in project adempiere by adempiere.
the class CompiereUtils method printParents.
/**
* Print Oarent of Component
* @param c component
*/
static void printParents(JComponent c) {
if (c.getName() == null)
c.setName("C" + String.valueOf(s_no++));
System.out.print(c.getName());
System.out.print(" - " + c.getClass().getName());
System.out.println(" ** " + c.isOpaque() + " bg=" + (c.getClientProperty(CompiereLookAndFeel.BACKGROUND) != null));
//
Container container = c.getParent();
while (container != null) {
System.out.print(" - " + container.getName() + " " + container.getClass().getName() + " ** " + container.isOpaque());
if (container instanceof JComponent)
System.out.print(" bg=" + (((JComponent) container).getClientProperty(CompiereLookAndFeel.BACKGROUND) != null));
System.out.println();
container = container.getParent();
}
}
use of javax.swing.JComponent in project adempiere by adempiere.
the class VLookup method processKeyBinding.
// VLookup_mouseAdapter
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
if (e.getSource() == m_combo || e.getSource() == m_text || e.getSource() == this) {
return super.processKeyBinding(ks, e, condition, pressed);
}
JComponent editorComp = null;
if (m_lookup != null && m_lookup.getDisplayType() != DisplayType.Search)
editorComp = m_combo;
else
editorComp = m_text;
InputMap map = editorComp.getInputMap(condition);
ActionMap am = editorComp.getActionMap();
if (map != null && am != null && isEnabled()) {
Object binding = map.get(ks);
Action action = (binding == null) ? null : am.get(binding);
if (action != null) {
return SwingUtilities.notifyAction(action, ks, e, editorComp, e.getModifiers());
}
}
return false;
}
use of javax.swing.JComponent in project jmeter by apache.
the class MenuScroller method refreshMenu.
private void refreshMenu() {
if (menuItems != null && menuItems.length > 0) {
firstIndex = Math.max(topFixedCount, firstIndex);
firstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, firstIndex);
upItem.setEnabled(firstIndex > topFixedCount);
downItem.setEnabled(firstIndex + scrollCount < menuItems.length - bottomFixedCount);
menu.removeAll();
for (int i = 0; i < topFixedCount; i++) {
menu.add(menuItems[i]);
}
if (topFixedCount > 0) {
menu.addSeparator();
}
menu.add(upItem);
for (int i = firstIndex; i < scrollCount + firstIndex; i++) {
menu.add(menuItems[i]);
}
menu.add(downItem);
if (bottomFixedCount > 0) {
menu.addSeparator();
}
for (int i = menuItems.length - bottomFixedCount; i < menuItems.length; i++) {
menu.add(menuItems[i]);
}
int preferredWidth = 0;
for (Component item : menuItems) {
preferredWidth = Math.max(preferredWidth, item.getPreferredSize().width);
}
menu.setPreferredSize(new Dimension(preferredWidth, menu.getPreferredSize().height));
JComponent parent = (JComponent) upItem.getParent();
parent.revalidate();
parent.repaint();
}
}
use of javax.swing.JComponent in project jmeter by apache.
the class JMeterMenuBar method makeFileMenu.
private void makeFileMenu() {
// FILE MENU
//$NON-NLS-1$
fileMenu = makeMenuRes("file", 'F');
//$NON-NLS-1$
JMenuItem fileSave = makeMenuItemRes("save", 'S', ActionNames.SAVE, KeyStrokes.SAVE);
fileSave.setEnabled(true);
//$NON-NLS-1$
fileSaveAs = makeMenuItemRes("save_all_as", 'A', ActionNames.SAVE_ALL_AS, KeyStrokes.SAVE_ALL_AS);
fileSaveAs.setEnabled(true);
//$NON-NLS-1$
fileSelectionAs = makeMenuItemRes("save_as", ActionNames.SAVE_AS);
fileSelectionAs.setEnabled(true);
//$NON-NLS-1$
fileSelectionAsTestFragment = makeMenuItemRes("save_as_test_fragment", ActionNames.SAVE_AS_TEST_FRAGMENT);
fileSelectionAsTestFragment.setEnabled(true);
//$NON-NLS-1$
fileRevert = makeMenuItemRes("revert_project", 'R', ActionNames.REVERT_PROJECT);
fileRevert.setEnabled(false);
//$NON-NLS-1$
fileLoad = makeMenuItemRes("menu_open", 'O', ActionNames.OPEN, KeyStrokes.OPEN);
//$NON-NLS-1$
recentFilesOpen = makeMenuRes("menu_recent");
recentFilesOpen.setEnabled(false);
// Set default SAVE menu item to disabled since the default node that
// is selected is ROOT, which does not allow items to be inserted.
fileLoad.setEnabled(false);
//$NON-NLS-1$
templates = makeMenuItemRes("template_menu", 'T', ActionNames.TEMPLATES);
templates.setEnabled(true);
//$NON-NLS-1$
fileNew = makeMenuItemRes("new", 'N', ActionNames.CLOSE, KeyStrokes.CLOSE);
//$NON-NLS-1$
fileExit = makeMenuItemRes("exit", 'X', ActionNames.EXIT, KeyStrokes.EXIT);
//$NON-NLS-1$
fileMerge = makeMenuItemRes("menu_merge", 'M', ActionNames.MERGE);
fileMerge.setEnabled(false);
fileMenu.add(fileNew);
fileMenu.add(templates);
fileMenu.add(fileLoad);
fileMenu.add(recentFilesOpen);
fileMenu.add(fileMerge);
fileMenu.addSeparator();
fileMenu.add(fileSave);
fileMenu.add(fileSaveAs);
fileMenu.add(fileSelectionAs);
fileMenu.add(fileSelectionAsTestFragment);
fileMenu.add(fileRevert);
fileMenu.addSeparator();
// Add the recent files, which will also add a separator that is
// visible when needed
fileLoadRecentFiles = LoadRecentProject.getRecentFileMenuItems();
for (JComponent jc : fileLoadRecentFiles) {
recentFilesOpen.add(jc);
}
recentFilesOpen.setEnabled(LoadRecentProject.hasVisibleMenuItem(fileLoadRecentFiles));
addPluginsMenuItems(fileMenu, menuCreators, MENU_LOCATION.FILE);
fileMenu.add(fileExit);
}
use of javax.swing.JComponent in project jgnash by ccavanaugh.
the class AboutDialog method initComponents.
private void initComponents() {
tabbedPane = new javax.swing.JTabbedPane();
setTitle(rb.getString("Title.About"));
addHTMLTab(rb.getString("Menu.About.Name"), "notice.html");
addHTMLTab(rb.getString("Tab.Credits"), "credits.html");
JComponent defaultTab = addHTMLTab("jGnash License", "jgnash-license.html");
addHTMLTab(rb.getString("Tab.GPLLicense"), "gpl-license.html");
addHTMLTab(rb.getString("Tab.LGPLLicense"), "lgpl.html");
addHTMLTab("Apache License", "apache-license.html");
addHTMLTab("JGoodies Common License", "jgoodies-common-license.html");
addHTMLTab("JGoodies Forms License", "jgoodies-forms-license.html");
addHTMLTab("JGoodies Looks License", "jgoodies-looks-license.html");
addHTMLTab("Tango Icons License", "sharealike-license.html");
addHTMLTab("XStream License", "xstream-license.html");
addHTMLTab("Substance License", "substance-license.html");
addHTMLTab("JXLayer License", "jxlayer-license.html");
tabbedPane.addTab(rb.getString("Tab.SysInfo"), new SystemPropertiesPanel());
tabbedPane.setSelectedComponent(defaultTab);
}
Aggregations