@Test public void createButton() { ApplicationContext context = new ApplicationContext(); ButtonFactory buttonFactory = context.getButtonFactory(); JButton button = buttonFactory.createButton(CopyAction.class); assertEquals("F5 Copy", button.getText()); }
public ApplicationFrame(ApplicationContext context) { this.context = context; this.actionFactory = context.getActionFactory(); this.buttonFactory = context.getButtonFactory(); this.uiFactory = context.getUiFactory(); setSize(1024, 768); setLocationRelativeTo(null); setTitle("Jar Commander"); setFocusable(true); setPreferredSize(new Dimension(1024, 768)); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new CustomWindowAdapter()); GridBagLayout gridBagLayout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); setLayout(gridBagLayout); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; add(createHeaderPanel(), c); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; c.gridy++; add(uiFactory.createSessionsPanel(), c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.weighty = 0; c.gridy++; JPanel footerPanel = createFooterPanel(); add(footerPanel, c); pack(); ((SessionPanel) context.getSessionsPanel().getSelectedComponent()) .getSelectedNavigationPanel() .getFileTablePane() .getTable() .requestFocusInWindow(); }