protected GraphPanel createSystemPanel() { GraphPanel localSystemPanel = new SystemPanel(); localSystemPanel.setName("systemPanel"); localSystemPanel.addValidator(new ConsistencyValidator()); localSystemPanel.addValidator(new SubGraphValidator()); return localSystemPanel; }
public JPanel createContentPane(int x, int y) { GraphPanel dl = new GraphPanel(x, y); dl.setBackground(Color.white); dl.setOpaque(true); return dl; }
public static void main(String[] args) { JFrame frame = new JFrame("Plot"); frame.getContentPane().setLayout(new BorderLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel commandPanel = new JPanel(new FlowLayout()); JButton openButton = new JButton("Open Ctrl-O"); JButton plotButton = new JButton("Plot Ctrl-P"); JButton quitButton = new JButton("Quit Ctrl-Q"); quitButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); commandPanel.registerKeyboardAction( new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }, KeyStroke.getKeyStroke("control Q"), JComponent.WHEN_IN_FOCUSED_WINDOW); commandPanel.add(openButton); commandPanel.add(plotButton); commandPanel.add(quitButton); frame.getContentPane().add(commandPanel, "North"); GraphPanel graphpanel = new GraphPanel(frame); plotButton.addActionListener(graphpanel); commandPanel.registerKeyboardAction( graphpanel, KeyStroke.getKeyStroke("control P"), JComponent.WHEN_IN_FOCUSED_WINDOW); openButton.addActionListener(graphpanel.getDataPanel()); commandPanel.registerKeyboardAction( graphpanel.getDataPanel(), KeyStroke.getKeyStroke("control O"), JComponent.WHEN_IN_FOCUSED_WINDOW); frame.setVisible(true); frame.pack(); }
protected GraphPanel createTaskPanel() { GraphPanel localTaskPanel = new TaskPanel(); localTaskPanel.setName("taskPanel"); localTaskPanel.addValidator(new CyclingValidator()); return localTaskPanel; }