コード例 #1
0
  private JButton createExampleButton(final CommonApp commonApp) {
    String iconResource = commonApp.getIconResource();
    Icon icon =
        iconResource == null
            ? new EmptyIcon()
            : new ImageIcon(getClass().getResource(iconResource));
    JButton button =
        new JButton(
            new AbstractAction(commonApp.getName(), icon) {
              public void actionPerformed(ActionEvent e) {
                commonApp.init(OptaPlannerExamplesApp.this, false);
              }
            });
    button.setHorizontalAlignment(JButton.LEFT);
    button.setHorizontalTextPosition(JButton.RIGHT);
    button.setVerticalTextPosition(JButton.CENTER);
    button.addMouseListener(
        new MouseAdapter() {

          public void mouseEntered(MouseEvent e) {
            descriptionTextArea.setText(commonApp.getDescription());
          }

          public void mouseExited(MouseEvent e) {
            descriptionTextArea.setText("");
          }
        });
    return button;
  }
コード例 #2
0
 /**
  * Supported system properties: {@link AbstractSolutionDao#DATA_DIR_SYSTEM_PROPERTY}
  *
  * @param args never null
  */
 public static void main(String[] args) {
   CommonApp.prepareSwingEnvironment();
   OptaPlannerExamplesApp optaPlannerExamplesApp = new OptaPlannerExamplesApp();
   optaPlannerExamplesApp.pack();
   optaPlannerExamplesApp.setLocationRelativeTo(null);
   optaPlannerExamplesApp.setVisible(true);
 }