示例#1
0
 protected GraphPanel createSystemPanel() {
   GraphPanel localSystemPanel = new SystemPanel();
   localSystemPanel.setName("systemPanel");
   localSystemPanel.addValidator(new ConsistencyValidator());
   localSystemPanel.addValidator(new SubGraphValidator());
   return localSystemPanel;
 }
示例#2
0
  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();
  }
示例#3
0
 protected GraphPanel createTaskPanel() {
   GraphPanel localTaskPanel = new TaskPanel();
   localTaskPanel.setName("taskPanel");
   localTaskPanel.addValidator(new CyclingValidator());
   return localTaskPanel;
 }