예제 #1
0
 protected JPanel south() {
   JPanel panel = new JPanel();
   panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
   completedB = new JButton("Completed Analysis " + (openFrameCount));
   cancelB = new JButton("Cancel");
   completedB.setAlignmentX(Component.CENTER_ALIGNMENT);
   cancelB.setAlignmentX(Component.CENTER_ALIGNMENT);
   // add ActionListener to objects
   completedB.addActionListener(this);
   cancelB.addActionListener(this);
   // add objects to panel
   panel.add(completedB);
   panel.add(cancelB);
   return panel;
 }
예제 #2
0
  public JPanel creerHaut() {
    JPanel panneauHaut = new JPanel();
    panneauHaut.setLayout(new BoxLayout(panneauHaut, BoxLayout.Y_AXIS));

    JLabel fonction = new JLabel("Stocks");
    fonction.setFont(new Font("Helvetica", Font.ITALIC, 48));
    fonction.setAlignmentX(CENTER_ALIGNMENT);
    panneauHaut.add(fonction);

    panneauHaut.add(Box.createRigidArea(new Dimension(0, 20)));

    combobox = new ComboBoxes(cets, 1);
    panneauHaut.add(combobox.getBox());

    panneauHaut.add(Box.createRigidArea(new Dimension(0, 20)));

    JButton ok = new JButton("OK");
    ControlJButtonOkDirection controlOk = new ControlJButtonOkDirection(cets, this, modele);
    ok.addActionListener(controlOk);
    ok.setAlignmentX(CENTER_ALIGNMENT);
    panneauHaut.add(ok);
    panneauHaut.add(Box.createRigidArea(new Dimension(0, 20)));

    return panneauHaut;
  }
예제 #3
0
  /**
   * Create a new tab to the FlexiBar, with the specified title and the specified component inside
   * the tab.
   *
   * @param title the title of the tab to be added
   * @param comp the component inserted in the tab
   */
  public void add(String title, JComponent comp) {
    JButton button = new JButton(title);
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            System.out.println("click");
            setSelected((JButton) arg0.getSource());
          }
        });
    button.setMinimumSize(new Dimension(this.B_WIDTH, this.B_HEIGHT));
    button.setMaximumSize(new Dimension(this.B_WIDTH, this.B_HEIGHT));
    button.setPreferredSize(new Dimension(this.B_WIDTH, this.B_HEIGHT));
    button.setAlignmentX(LEFT_ALIGNMENT);
    comp.setMinimumSize(new Dimension(this.P_WIDTH, this.P_HEIGHT));
    comp.setMaximumSize(new Dimension(this.P_WIDTH, this.P_HEIGHT));
    // comp.setPreferredSize(new Dimension(this.P_WIDTH,this.P_HEIGHT));
    comp.setAlignmentX(LEFT_ALIGNMENT);
    if (currentSelected == -1) {
      comp.setVisible(true);
      currentSelected = 0;
    } else comp.setVisible(false);

    listComponent.add(button);
    listComponent.add(comp);

    panel.add(button);
    panel.add(comp);
  }
예제 #4
0
 protected void initButtons(JComponent panel) {
   mergeRunnerB = new JButton(GecoIcon.createIcon(GecoIcon.MergeRunner));
   mergeRunnerB.setToolTipText(Messages.uiGet("RegistryBoard.MergeEcardTooltip")); // $NON-NLS-1$
   mergeRunnerB.setEnabled(false);
   mergeRunnerB.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           RunnerRaceData mergedData =
               control()
                   .mergeRunnerWithData(
                       getSelectedRunner(), wizard().getECardData(), wizard().getSourceRunner());
           wizard().closeAfterMerge(mergedData);
         }
       });
   overwriteWarningL = new JLabel(GecoIcon.createIcon(GecoIcon.Overwrite));
   overwriteWarningL.setToolTipText(
       Messages.uiGet("RegistryBoard.OverwriteWarning")); // $NON-NLS-1$
   overwriteWarningL.setVisible(false);
   mergeRunnerB.setAlignmentX(MergeWizard.CENTER_ALIGNMENT);
   overwriteWarningL.setAlignmentX(MergeWizard.CENTER_ALIGNMENT);
   Box buttons = Box.createVerticalBox();
   buttons.add(mergeRunnerB);
   buttons.add(overwriteWarningL);
   panel.add(buttons, buttonsCol(3));
 }
예제 #5
0
  /** Initializes the call button. */
  private void initCallButton() {
    List<ProtocolProviderService> telephonyProviders = CallManager.getTelephonyProviders();

    if (telephonyProviders != null && telephonyProviders.size() > 0) {
      if (callButton.getParent() != null) return;

      callButton.setAlignmentX(JButton.CENTER_ALIGNMENT);

      callButton.setMnemonic(
          GuiActivator.getResources().getI18nMnemonic("service.gui.CALL_CONTACT"));

      buttonPanel.add(callButton);

      callButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              String searchText = parentWindow.getCurrentSearchText();

              if (searchText == null) return;

              CallManager.createCall(searchText, callButton);
            }
          });
    } else {
      buttonPanel.remove(callButton);
    }
  }
예제 #6
0
  public DirectionStock(DirectionAccueil mere, ChicEtStyle cets, boolean creation) {
    super("Chic & Style");
    this.mere = mere;
    this.cets = cets;
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    Dimension tailleEcran = Toolkit.getDefaultToolkit().getScreenSize();
    this.setSize((int) (tailleEcran.getWidth() * 3 / 4), (int) (tailleEcran.getHeight() * 3 / 4));
    this.setLocation((int) (tailleEcran.getWidth() / 8), (int) (tailleEcran.getHeight() / 8));
    Container conteneur = this.getContentPane();
    conteneur.setLayout(new BorderLayout());
    conteneur.add(creerHaut(), BorderLayout.NORTH);

    tableau = new JTable(modele); // tableau
    getContentPane().add(new JScrollPane(tableau), BorderLayout.CENTER); // tableau

    JPanel sudHaut = new JPanel();
    sudHaut.setLayout(new BoxLayout(sudHaut, BoxLayout.Y_AXIS));
    JPanel dateProd = new JPanel();
    JLabel dateP = new JLabel("Date de lancement de la production: ");
    date = new JTextField(15);
    dateProd.add(dateP);
    dateProd.add(date);
    sudHaut.add(dateProd);
    JButton valider = new JButton("Valider");
    ControlJButtonOkProd controlValiderNouvelleFourniture =
        new ControlJButtonOkProd(cets, this, mere); // BOUTON
    valider.addActionListener(controlValiderNouvelleFourniture); // BOUTON
    valider.setAlignmentX(CENTER_ALIGNMENT);

    JPanel boutons = new JPanel(); // tableau
    JButton prec = new JButton("Accueil");
    ControlJButtonNext precedent = new ControlJButtonNext(this, mere); // BOUTON
    prec.addActionListener(precedent); // BOUTON
    prec.setAlignmentX(CENTER_ALIGNMENT);
    boutons.add(prec);
    boutons.add(Box.createRigidArea(new Dimension(10, 0)));
    boutons.add(valider);

    JPanel panneauBas = new JPanel();
    panneauBas.setLayout(new BoxLayout(panneauBas, BoxLayout.Y_AXIS));
    panneauBas.add(sudHaut);
    panneauBas.add(boutons);

    conteneur.add(panneauBas, BorderLayout.SOUTH);
  }
예제 #7
0
  // constructor of TextFrame
  public TextFrame() {
    // this.message = message;
    message = "Click to Edit Text";
    messageFont = new Font("Arial", Font.PLAIN, 30);
    foreground = Color.black;
    background = Color.white;

    // custom dialog (it's a private class inside TextFrame)
    cd = new CustomDialog(this);

    messageField = new JTextField();
    messageField.setPreferredSize(new Dimension(300, 200));
    messageField.setEditable(false);
    messageField.setHorizontalAlignment(SwingConstants.CENTER);
    messageField.setAlignmentX(Component.CENTER_ALIGNMENT);
    updateMessage();

    customize = new JButton("Customize");
    customize.setMaximumSize(customize.getPreferredSize());
    customize.setAlignmentX(Component.CENTER_ALIGNMENT);

    apply = new JButton("Apply");
    apply.setMaximumSize(customize.getPreferredSize());
    apply.setAlignmentX(Component.CENTER_ALIGNMENT);

    /*add the listeners*/
    customize.addActionListener(this);
    apply.addActionListener(this);
    messageField.addMouseListener(new PopUpClass());

    // customize
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(customize);
    p.add(Box.createRigidArea(new Dimension(0, 25)));
    p.add(messageField);
    p.add(Box.createRigidArea(new Dimension(0, 25)));
    p.add(apply);
    p.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 25));

    // make panel this JFrame's content pane

    this.setContentPane(p);
  }
예제 #8
0
파일: SourceCode.java 프로젝트: vaybar/RITA
  private void createHideCodeButton() {

    this.codeButton = new JButton(createImageIcon("/images/sourcecode/source_code_small.png"));
    codeButton.addActionListener(new SourceCodeEnlargerTimer());
    codeButton.addMouseListener(this);
    codeButton.setBounds(0, 0, MIN_WIDTH, BUTTON_HEIGHT);
    codeButton.setFont(smallButtonFont);
    codeButton.setAlignmentX(LEFT_ALIGNMENT);
    codeButton.setText(Language.get("codeButton.title.open"));
    codeButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.BLACK));
  }
예제 #9
0
  private void setButtons(JPanel bp) {
    bp.setLayout(new BoxLayout(bp, BoxLayout.Y_AXIS));
    JButton addRowButton = new JButton("Add Row");
    addRowButton.addActionListener(new addRowListener());
    addRowButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    JButton addColumnButton = new JButton("Add Column");
    addColumnButton.addActionListener(new addColListener());
    addColumnButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    JButton deleteColumnButton = new JButton("Delete Column(s)");
    deleteColumnButton.addActionListener(new deleteColListener());
    deleteColumnButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    JButton doneButton = new JButton("Done");
    doneButton.addActionListener(new doneListener());
    doneButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new cancelListener());
    cancelButton.setAlignmentX(Component.LEFT_ALIGNMENT);

    JTextArea info =
        new JTextArea(
            "Each column represents one type of annotation.\n\n"
                + "If you want to have a pull-down list of allowable entries\n"
                + "then place allowable values in the rows\n"
                + "otherwise leave blank and a text entry field will be presented\n");
    info.setEditable(false);
    info.setAlignmentX(Component.LEFT_ALIGNMENT);

    bp.add(info);
    bp.add(addRowButton);

    JPanel addColPanel = new JPanel();
    addColPanel.add(addColumnButton);
    colNameField = new JTextField("New column name", 20);
    addColPanel.add(colNameField);
    addColPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    bp.add(addColPanel);
    bp.add(deleteColumnButton);
    bp.add(doneButton);
    bp.add(cancelButton);
  }
예제 #10
0
  @Override
  protected void inicializarPantalla(JFrame pantalla) {

    // ~~----------------------------------------------------- Panel principal
    JPanel panel = new JPanel();
    panel.setOpaque(true);
    panel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("Pruebas"),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    // ~~----------------------------------------------------- Botón de avance
    JButton avanzar = new JButton("Avanzar Tiempo");
    avanzar.addActionListener(new AvanzarTiempo(this.jugador));
    avanzar.setAlignmentX(Component.CENTER_ALIGNMENT);

    JButton avanzarRapido = new JButton("Avanzar Tiempo Rápido");
    // ToDo hacer que el avanze sea configurable con un slider
    avanzarRapido.addActionListener(new AvanzarTiempo(this.jugador, FACTOR_DE_MULTIPLICACION));
    avanzarRapido.setAlignmentX(Component.CENTER_ALIGNMENT);

    JButton terremoto = new JButton("Terremoto");
    terremoto.addActionListener(new GenerarTerremoto(jugador.getMapa(), mensajero));
    terremoto.setAlignmentX(Component.CENTER_ALIGNMENT);

    JButton godzilla = new JButton("Godzilla Lineal");
    godzilla.addActionListener(
        new GenerarGodzilla(new GodzillaLineal(jugador.getMapa(), new AzarReal()), mensajero));
    godzilla.setAlignmentX(Component.CENTER_ALIGNMENT);

    JButton godzillaZigZag = new JButton("Godzilla ZigZag");
    godzillaZigZag.addActionListener(
        new GenerarGodzilla(new GodzillaZigZag(jugador.getMapa(), new AzarReal()), mensajero));
    godzillaZigZag.setAlignmentX(Component.CENTER_ALIGNMENT);

    JButton godzillaDiagonal = new JButton("Godzilla Diagonal");
    godzillaDiagonal.addActionListener(
        new GenerarGodzilla(new GodzillaDiagonal(jugador.getMapa(), new AzarReal()), mensajero));
    godzillaDiagonal.setAlignmentX(Component.CENTER_ALIGNMENT);

    JButton bomberos = new JButton("Bomberos");
    bomberos.addActionListener(new LlamarBomberos(jugador, mensajero));
    bomberos.setAlignmentX(Component.CENTER_ALIGNMENT);

    panel.add(avanzar);
    panel.add(avanzarRapido);
    panel.add(terremoto);
    panel.add(godzilla);
    panel.add(godzillaDiagonal);
    panel.add(godzillaZigZag);
    panel.add(bomberos);
    pantalla.getContentPane().add(panel);

    pantalla.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  }
  protected JToolBar createToolBar() {

    JToolBar jtoolbar = new JToolBar();

    jtoolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);

    // ---------------------------------------
    JButton jbuttonClear = new JButton("Clear SQL Statement");

    jbuttonClear.setToolTipText("Clear SQL Statement");
    jbuttonClear.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent actionevent) {
            clear();
          }
        });

    // ---------------------------------------
    JButton jbuttonExecute = new JButton("Execute SQL Statement");

    jbuttonExecute.setToolTipText("Execute SQL Statement");
    jbuttonExecute.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent actionevent) {
            execute();
          }
        });
    jtoolbar.addSeparator();
    jtoolbar.add(jbuttonClear);
    jtoolbar.addSeparator();
    jtoolbar.add(jbuttonExecute);
    jtoolbar.addSeparator();
    jbuttonClear.setAlignmentY(0.5F);
    jbuttonClear.setAlignmentX(0.5F);
    jbuttonExecute.setAlignmentY(0.5F);
    jbuttonExecute.setAlignmentX(0.5F);

    return jtoolbar;
  }
예제 #12
0
  /** Create the panel. */
  public BuyPropertyPanel(Game game) {
    super(game);
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    lblYouCanBuy = new JLabel("", SwingConstants.CENTER);
    lblYouCanBuy.setAlignmentX(Component.CENTER_ALIGNMENT);
    add(lblYouCanBuy);

    btnBuyProperty = new JButton("Buy Property");
    add(btnBuyProperty);
    btnBuyProperty.setAlignmentX(Component.CENTER_ALIGNMENT);
    btnBuyProperty.addActionListener(this);
    btnDontBuyProperty = new JButton("Don't Buy Property");
    add(btnDontBuyProperty);
    btnDontBuyProperty.setAlignmentX(Component.CENTER_ALIGNMENT);
    btnDontBuyProperty.addActionListener(this);

    Language lang = Language.getInstance();
    lang.addLanguageListener(this);
    languageChanged(lang);
  }
 /**
  * Gets the instance of the SlowButton
  *
  * @return The instance of the SlowButton
  */
 public static JButton getSlowButton() {
   if (slowButton == null) {
     slowButton = new JButton();
     slowButton.setText(Constants.STOP);
     slowButton.setHorizontalAlignment(SwingConstants.CENTER);
     slowButton.setFont(Constants.DEFAULT_BUTTON_FONT);
     slowButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     slowButton.setActionCommand(Constants.SLOW);
     slowButton.addActionListener(ButtonListener.getInstance());
   }
   return slowButton;
 }
 /**
  * Gets the instance of the CenterButton
  *
  * @return The instance of the CenterButton
  */
 public static JButton getCenterButton() {
   if (centerButton == null) {
     centerButton = new JButton();
     centerButton.setText(Constants.CENTER);
     centerButton.setHorizontalAlignment(SwingConstants.CENTER);
     centerButton.setFont(new Font("Dialog", Font.BOLD, 14));
     centerButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     centerButton.setActionCommand(Constants.CENTER);
     centerButton.addActionListener(ButtonListener.getInstance());
   }
   return centerButton;
 }
 /**
  * Gets the instance of the ConnectButton
  *
  * @return The instance of the ConnectButton
  */
 public static JButton getConnectButton() {
   if (connectButton == null) {
     connectButton = new JButton();
     connectButton.setText(Constants.CONNECT);
     connectButton.setHorizontalAlignment(SwingConstants.CENTER);
     connectButton.setFont(Constants.DEFAULT_BUTTON_FONT);
     connectButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     connectButton.setActionCommand(Constants.CONNECT);
     connectButton.addActionListener(ButtonListener.getInstance());
   }
   return connectButton;
 }
예제 #16
0
  public IntroWindow() {
    super("Management des Hommes");
    this.setSize(300, 300);
    this.setResizable(false);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel mainPanel = new JPanel();
    mainPanel.setBorder(new EmptyBorder(80, 30, 30, 30));
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));

    boutonJouer = new JButton("Jouer");
    boutonJouer.setEnabled(false);
    boutonJouer.setAlignmentX(JComponent.CENTER_ALIGNMENT);
    boutonJouer.addActionListener(this);
    mainPanel.add(boutonJouer);

    boutonAbout = new JButton("Charisme et Assertivité");
    boutonAbout.setAlignmentX(JComponent.CENTER_ALIGNMENT);
    boutonAbout.addActionListener(this);
    mainPanel.add(boutonAbout);

    chargementLabel = new JLabel("Chargement du Jeu...");
    chargementLabel.setAlignmentX(JComponent.CENTER_ALIGNMENT);
    mainPanel.add(chargementLabel);

    progress = new JProgressBar();
    progress.setAlignmentX(JComponent.CENTER_ALIGNMENT);
    mainPanel.add(progress);

    this.setIconImage(getToolkit().getImage(getClass().getResource("/icones/icone.png")));

    this.setContentPane(mainPanel);
    this.setVisible(true);

    textWindow = new TextWindow();

    mainWindow = new MainWindow(this, progress);
  }
 /**
  * Gets the instance of the ResetButton
  *
  * @return The instance of the ResetButton
  */
 public static JButton getResetButton() {
   if (resetButton == null) {
     resetButton = new JButton();
     resetButton.setText(Constants.RESET);
     resetButton.setHorizontalAlignment(SwingConstants.CENTER);
     resetButton.setFont(Constants.DEFAULT_BUTTON_FONT);
     resetButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     resetButton.setActionCommand(Constants.RESET);
     resetButton.addActionListener(ButtonListener.getInstance());
     resetButton.setEnabled(false);
   }
   return resetButton;
 }
예제 #18
0
 private JComponent createRequestButton() {
   createReqButton = new JButton(I18N.getString("FeatureResearchDialog.createWFSRequest"));
   createReqButton.setBounds(260, 20, 80, 20);
   createReqButton.setAlignmentX(0.5f);
   createReqButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           setRequestText(wfsPanel.createRequest());
           requestTextArea.setCaretPosition(0);
         }
       });
   return createReqButton;
 }
  public FeaturePaletteScrollPane() {
    this.setBorder(BorderFactory.createTitledBorder("Feature Palette"));
    panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    setViewportView(panel);
    componentName = new JLabel("Component: ");
    componentName.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    componentName.setMinimumSize(new Dimension(200, 20));
    componentName.setMaximumSize(new Dimension(200, 20));
    cmbFeatures = new JComboBox();
    cmbFeatures.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    cmbFeatures.setMinimumSize(new Dimension(200, 20));
    cmbFeatures.setMaximumSize(new Dimension(200, 20));
    cmbValues = new JComboBox();
    cmbValues.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    cmbValues.setMinimumSize(new Dimension(200, 20));
    cmbValues.setMaximumSize(new Dimension(200, 20));
    resetButton = new JButton("Set ALL Features to Default");
    resetButton.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    resetButton.setMinimumSize(new Dimension(200, 20));
    resetButton.setMaximumSize(new Dimension(200, 20));
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    double width = screenSize.getWidth();
    double height = screenSize.getHeight();
    int palettewidth = (int) (width * 0.4);
    int paletteheight = (int) (height * 0.25);
    this.setPreferredSize(new Dimension(palettewidth, paletteheight));
    JLabel blankLabel = new JLabel("");
    blankLabel.setMinimumSize(new Dimension(200, 20));
    blankLabel.setMaximumSize(new Dimension(200, 20));
    blankLabel.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    JLabel blankLabel2 = new JLabel("");
    blankLabel2.setMinimumSize(new Dimension(200, 20));
    blankLabel2.setMaximumSize(new Dimension(200, 20));
    blankLabel2.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    JLabel blankLabel3 = new JLabel("");
    blankLabel3.setMinimumSize(new Dimension(200, 10));
    blankLabel3.setMaximumSize(new Dimension(200, 10));
    blankLabel3.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    panel.add(componentName);
    panel.add(blankLabel);
    panel.add(cmbFeatures);
    panel.add(blankLabel3);
    panel.add(cmbValues);
    panel.add(blankLabel2);
    panel.add(resetButton);

    initComponents();
  }
  /**
   * Creates the main panel, with a menu bar and a container panel.
   *
   * @param menubar
   * @param contentPanel
   * @param frame
   * @return menu bar panel
   */
  private void fillMainPanel(JPanel menuBar, JPanel contentPanel, JFrame frame) {
    contentPanel.setLayout(new BorderLayout());
    // menu
    menuBar.setLayout(new BoxLayout(menuBar, BoxLayout.X_AXIS));

    // sensor simulator button
    JButton simulatorButton = createSimulatorButton(contentPanel, frame);
    menuBar.add(simulatorButton);

    // telnet simulator button
    JButton telnetButton = createTelnetButton(contentPanel, frame);
    menuBar.add(telnetButton);

    // settings button
    JButton settingsButton = createSettingsButton(contentPanel, frame);
    menuBar.add(Box.createHorizontalGlue());
    settingsButton.setAlignmentX(Component.RIGHT_ALIGNMENT);
    menuBar.add(settingsButton);

    // about button
    JButton aboutButton = createAboutButton();
    aboutButton.setAlignmentX(Component.RIGHT_ALIGNMENT);
    menuBar.add(aboutButton);
  }
예제 #21
0
  private void initAddContactButton() {
    addButton.setAlignmentX(JButton.CENTER_ALIGNMENT);

    addButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic("service.gui.ADD_CONTACT"));

    buttonPanel.add(addButton);

    addButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            AddContactDialog dialog = new AddContactDialog(parentWindow);

            dialog.setContactAddress(parentWindow.getCurrentSearchText());
            dialog.setVisible(true);
          }
        });
  }
예제 #22
0
  public void run(String arg) {
    String ijDir = System.getProperty("ij.dir");
    if (!ijDir.endsWith("/")) ijDir += "/";
    if (arg == null || "".equals(arg)) {
      OpenDialog dialog = new OpenDialog("Which Fiji component", ijDir + "plugins", "");
      if (dialog.getDirectory() == null) return;
      arg = dialog.getDirectory() + dialog.getFileName();
    }
    if (arg.startsWith(ijDir)) arg = arg.substring(ijDir.length());

    final JFrame frame = new JFrame("Building " + arg + "...");
    Container panel = frame.getContentPane();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    JTextArea textArea = new JTextArea("Calling Fiji Build\n", 25, 80);
    textArea.setFont(new Font("Courier", Font.PLAIN, 12));
    textArea.setEditable(false);
    panel.add(new JScrollPane(textArea));
    final JButton okay = new JButton("okay");
    okay.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            frame.dispose();
          }
        });
    okay.setEnabled(false);
    okay.setAlignmentX(Component.CENTER_ALIGNMENT);
    panel.add(okay);
    frame.pack();
    frame.setLocationRelativeTo(null);
    okay.requestFocus();
    frame.setVisible(true);

    try {
      Fake fake = new Fake();
      fake.out = fake.err = new PrintStream(new JTextAreaOutputStream(textArea));
      Parser parser = fake.parse(new FileInputStream(ijDir + "/Fakefile"), new File(ijDir));
      final Rule all = parser.parseRules(Arrays.asList(arg.split("\\s+")));
      all.make();
      fake.out.println("Finished.");
      frame.setTitle("Built " + arg);
      okay.setEnabled(true);
    } catch (Exception e) {
      IJ.handleException(e);
    }
  }
예제 #23
0
  /** Creates an instance of <tt>SkinManagerPanel</tt>. */
  public SkinManagerPanel() {
    super(new BorderLayout());

    JPanel selectorPanel = new TransparentPanel();
    selectorPanel.setLayout(new BoxLayout(selectorPanel, BoxLayout.Y_AXIS));

    skinSelector.setAlignmentX(Component.CENTER_ALIGNMENT);
    skinSelector.addItemListener(new EnableDisableListener());
    selectorPanel.add(skinSelector);

    rmButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    rmButton.addActionListener(new RemoveListener());
    selectorPanel.add(rmButton);

    enableDisableButton();

    add(selectorPanel, BorderLayout.NORTH);
  }
예제 #24
0
    private ResultsWindow(String displayText, File outputFile) {
      setTitle("Results");
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      setSize(500, 500);
      mOutputFile = outputFile;
      JPanel pan = new JPanel();
      pan.setLayout(new BoxLayout(pan, BoxLayout.Y_AXIS));
      add(pan);

      JTextArea text = new JTextArea(displayText);
      text.setEditable(false);
      JScrollPane scroll = new JScrollPane(text);
      pan.add(scroll);
      scroll.getVerticalScrollBar().setValue(0);
      scroll.getHorizontalScrollBar().setValue(0);

      JButton btn = new JButton("Save predictions");
      btn.setAlignmentX(0.5f);
      btn.addActionListener(new Saver(this));
      pan.add(btn);
    }
예제 #25
0
  /**
   * The StringAskWindow constructor.
   *
   * @param title -The Window's title.
   * @param labelText - The displayed information text.
   * @param buttonText - The button's text.
   */
  public StringAskWindow(String title, String labelText, String buttonText) {

    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

    setResizable(false);
    setLayout(new BoxLayout(this.getContentPane(), BoxLayout.PAGE_AXIS));
    setSize(360, 110);
    setLocationRelativeTo(null);
    setTitle(title);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    // Add the information label.
    JLabel infoLabel = new JLabel(labelText);
    infoLabel.setAlignmentX(CENTER_ALIGNMENT);
    add(infoLabel);

    // Add the text entry.
    this.textEntry = new JTextField();
    this.textEntry.setAlignmentX(CENTER_ALIGNMENT);
    add(this.textEntry);

    // Add the OK button.
    JButton okButton = new JButton(buttonText);

    okButton.addActionListener(
        new ActionListener() {

          /** On event on the button. */
          @Override
          public void actionPerformed(ActionEvent e) {
            dispose();
            SoundEngine.play(SoundType.CLICK2);
          }
        });

    okButton.setAlignmentX(CENTER_ALIGNMENT);

    add(okButton);
  }
예제 #26
0
  slideshow(String title) {
    super(title);

    next = new JButton("Next");
    next.addActionListener(new slideshowListener());
    next.setAlignmentX(Component.CENTER_ALIGNMENT);

    Info = new DefaultListModel();
    list = new JList(Info);
    list.setSelectionMode(1);

    JPanel slide = new JPanel();
    slide.add(next);

    JScrollPane show = new JScrollPane(list);
    show.setBorder(BorderFactory.createTitledBorder("Picture:"));

    JPanel header = new Borders("Project", "Slide Show");

    add(header, BorderLayout.NORTH);
    add(show, BorderLayout.CENTER);
    add(slide, BorderLayout.SOUTH);
  }
예제 #27
0
  /** Créer un pannel avec un bouton capâble de lançer la Proglet */
  private static JPanel createShortcut(
      ImageIcon icon, String name, String title, final Runnable start) {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(Box.createVerticalGlue());
    JButton label = new JButton(name, icon);
    // Affichage du titre dans le charset de l'ordinateur
    label.setToolTipText(title);
    label.setPreferredSize(new Dimension(160, 160));
    label.setVerticalTextPosition(JLabel.BOTTOM);
    label.setHorizontalTextPosition(JLabel.CENTER);
    label.setAlignmentX(Component.CENTER_ALIGNMENT);
    label.setAlignmentY(Component.CENTER_ALIGNMENT);
    panel.add(label);
    panel.add(Box.createVerticalGlue());
    label.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseClicked(MouseEvent e) {
            start.run();
          }

          @Override
          public void mousePressed(MouseEvent e) {}

          @Override
          public void mouseReleased(MouseEvent e) {}

          @Override
          public void mouseEntered(MouseEvent e) {}

          @Override
          public void mouseExited(MouseEvent e) {}
        });
    return panel;
  }
예제 #28
0
  void init() {

    /* ============
     *     Windows
     * ============ */

    this.setResizable(false);
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container con = this.getContentPane(); // inherit main frame
    con.add(panel); // add the panel to frame

    /* ============
     *     Menu
     * ============ */

    this.setIconImage(new ImageIcon("img/title_img.png").getImage());
    // Where the GUI is created:
    JMenuBar menuBar;
    JMenu menu;
    JMenuItem menuItem;

    // Create the menu bar.
    menuBar = new JMenuBar();

    // Build the first menu.
    menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_A);
    menuBar.add(menu);

    // a group of JMenuItems
    menuItem = new JMenuItem("About", new ImageIcon("img/about.png"));
    menu.add(menuItem);

    this.setJMenuBar(menuBar);

    /* ============
     *    Content
     * ============ */

    JLabel logo = new JLabel(new ImageIcon("img/title_img.png"));
    logo.setAlignmentX(CENTER_ALIGNMENT);
    final JTextField nickname = new JTextField();
    final Border defaultBorder = nickname.getBorder();

    nickname.setText("Enter a nickname");
    nickname.setPreferredSize(new Dimension(250, 30));
    nickname.setMaximumSize(nickname.getPreferredSize());
    nickname.setAlignmentX(CENTER_ALIGNMENT);

    // nickname.addFocusListener(this);
    nickname.addFocusListener(
        new FocusListener() {
          @Override
          public void focusLost(FocusEvent e) {
            // TODO Auto-generated method stub
            if (!nickname.getText().equals("Enter a nickname")) {
              nickname.setText(nickname.getText().replace(" ", ""));
            }

            if (nickname.getText().equals("") || nickname.getText().equals("Enter a nickname")) {
              nickname.setText("Enter a nickname");
              goodNickname = false;
            }
          }

          @Override
          public void focusGained(FocusEvent e) {
            // TODO Auto-generated method stub
            goodNickname = true;
          }
        });

    nickname.addMouseListener(
        new MouseListener() {

          @Override
          public void mouseReleased(MouseEvent arg0) {
            // TODO Auto-generated method stub

          }

          @Override
          public void mousePressed(MouseEvent arg0) {
            // TODO Auto-generated method stub
            if (nickname.getText().equals("Enter a nickname")) {
              nickname.setText("");
              nickname.setBorder(defaultBorder);
            }
          }

          @Override
          public void mouseExited(MouseEvent arg0) {
            // TODO Auto-generated method stub

          }

          @Override
          public void mouseEntered(MouseEvent arg0) {
            // TODO Auto-generated method stub

          }

          @Override
          public void mouseClicked(MouseEvent arg0) {
            // TODO Auto-generated method stub

          }
        });

    final JButton connect = new JButton("Connect");
    connect.setPreferredSize(new Dimension(250, 30));
    connect.setMaximumSize(connect.getPreferredSize());
    connect.setAlignmentX(CENTER_ALIGNMENT);

    connect.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            // TODO Auto-generated method stub
            if (goodNickname) {
              openChatGUI(nickname);
            } else {
              nickname.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.red));
            }
          }
        });

    nickname.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            // TODO Auto-generated method stub
            if (goodNickname) {
              openChatGUI(nickname);
            } else {
              nickname.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.red));
            }
          }
        });

    panel.add(Box.createRigidArea(new Dimension(0, 15)));
    panel.add(logo);
    panel.add(Box.createRigidArea(new Dimension(0, 30)));
    panel.add(nickname);
    panel.add(Box.createRigidArea(new Dimension(0, 10)));
    panel.add(connect);

    setVisible(true); // display this frame
  }
예제 #29
0
  private void setGraphic(Dimension preferredSize) {

    GridBagLayout gridbag = new GridBagLayout();

    TitledBorder titledBorder =
        new TitledBorder(Locale.getString("GP_PAGE_INITIAL_POPULATION_LONG"));
    this.setBorder(titledBorder);
    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    this.setPreferredSize(preferredSize);

    JPanel panelUp = new JPanel();
    JPanel panelDown = new JPanel();
    panelUp.setLayout(new BoxLayout(panelUp, BoxLayout.Y_AXIS));
    panelDown.setLayout(new BoxLayout(panelDown, BoxLayout.Y_AXIS));
    TitledBorder titledBorderSectionUp = new TitledBorder(Locale.getString("RULES_PAGE_TITLE"));
    TitledBorder titledBorderSectionDown = new TitledBorder(Locale.getString("GP_PAGE_PERCENTAGE"));
    panelUp.setBorder(titledBorderSectionUp);
    panelDown.setBorder(titledBorderSectionDown);

    // GPPageInitialPopulationModule is already declared as global variable
    GPPageInitialPopulationModule.setLayout(
        new BoxLayout(GPPageInitialPopulationModule, BoxLayout.Y_AXIS));

    JScrollPane upDownScrollPane = new JScrollPane(GPPageInitialPopulationModule);
    upDownScrollPane.setLayout(new ScrollPaneLayout());

    JButton addButton = new JButton(Locale.getString("ADD"));
    addButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            addRules();
          }
        });

    JButton editButton = new JButton(Locale.getString("EDIT"));
    editButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            editRules();
          }
        });

    JButton deleteButton = new JButton(Locale.getString("DELETE"));
    deleteButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            deleteRules();
          }
        });

    JPanel rulesButtons = new JPanel();
    rulesButtons.add(addButton);
    rulesButtons.add(editButton);
    rulesButtons.add(deleteButton);

    JButton fitAllButton = new JButton(Locale.getString("FIT"));
    fitAllButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            // Fit the percent values for each buy/sell rule
            GPPageInitialPopulationModule.fitAll();
            // Fit the percent values for random or not
            fitAll();
          }
        });

    JButton defaultButton = new JButton(Locale.getString("DEFAULT"));
    defaultButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            // Set the values to default, so the GP will work with random generation only
            setDefaultValues();
          }
        });

    JPanel innerPanel = new JPanel();
    GridBagConstraints c = new GridBagConstraints();
    innerPanel.setLayout(gridbag);

    // Add Generation number to fix the range of mutation
    // the beginning formulas will be modified n times with mutation mechanism
    // according to the number in the combo box (user defined).
    c.weightx = 1.0;
    c.ipadx = 5;
    c.anchor = GridBagConstraints.WEST;

    generateRandomPopTextRow =
        GridBagHelper.addTextRow(
            innerPanel,
            Locale.getString("GP_PAGE_GENERATE_RANDOM_PERC_TEXT_ROW"),
            "",
            gridbag,
            c,
            12);
    generateInitPopTextRow =
        GridBagHelper.addTextRow(
            innerPanel, Locale.getString("GP_PAGE_GENERATE_PERC_TEXT_ROW"), "", gridbag, c, 12);
    numberMutationTextRow =
        GridBagHelper.addTextRow(
            innerPanel,
            Locale.getString("GP_PAGE_GENERATE_NUMBER_MUTATION_TEXT_ROW"),
            "",
            gridbag,
            c,
            6);

    panelUp.add(upDownScrollPane);
    rulesButtons.setAlignmentX(CENTER_ALIGNMENT);
    panelUp.add(rulesButtons);

    panelDown.add(innerPanel);
    fitAllButton.setAlignmentX(CENTER_ALIGNMENT);
    defaultButton.setAlignmentX(CENTER_ALIGNMENT);
    panelDown.add(fitAllButton);
    panelDown.add(defaultButton);

    this.add(panelUp);
    this.add(panelDown);

    // Put the default values so that random initial population is the default behaviour
    this.setDefaultValues();
  }
  /** the GUI uses a GridBagLayout */
  void buildGUI() {
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    this.setLayout(gridbag);
    c.insets = new Insets(5, 5, 5, 5);

    // JHeaderList 'source'
    c.gridx = 0; // at left
    c.gridy = 0; // at top
    c.gridwidth = 1;
    c.gridheight = 3; // top to bottom
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0; // grow more than Buttons
    c.weighty = 1.0; // grow more than Buttons
    gridbag.setConstraints(source, c);
    add(source);

    // Middle Buttons
    JPanel middleButtonPanel = new JPanel();
    middleButtonPanel.setLayout(new BoxLayout(middleButtonPanel, BoxLayout.Y_AXIS));
    JButton toButton = new JButton(">>");
    toButton.addActionListener(new toListener());
    middleButtonPanel.add(toButton);
    JButton fromButton = new JButton("<<");
    fromButton.addActionListener(new fromListener());
    middleButtonPanel.add(fromButton);
    c.gridx = 1; // at center
    c.gridy = 1; // at cener
    c.gridwidth = 1;
    c.gridheight = 1;
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0; // don't grow
    gridbag.setConstraints(middleButtonPanel, c);
    add(middleButtonPanel);

    // JHeaderList 'dest'
    c.gridx = 2; // at left
    c.gridy = 0; // at top
    c.gridwidth = 1;
    c.gridheight = 3; // top to bottom
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0; // grow more than Buttons
    c.weighty = 1.0; // grow more than Buttons
    gridbag.setConstraints(dest, c);
    add(dest);

    // vertical Buttons
    JPanel verticalButtonPanel = new JPanel();
    verticalButtonPanel.setLayout(new BoxLayout(verticalButtonPanel, BoxLayout.Y_AXIS));
    JButton upButton = new JButton("UP");
    upButton.addActionListener(new upListener());
    upButton.setAlignmentX(CENTER_ALIGNMENT);
    verticalButtonPanel.add(upButton);
    JButton downButton = new JButton("DOWN");
    downButton.addActionListener(new downListener());
    downButton.setAlignmentX(CENTER_ALIGNMENT);
    verticalButtonPanel.add(downButton);
    c.gridx = 3; // at center
    c.gridy = 1; // at cener
    c.gridwidth = 1;
    c.gridheight = 1;
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0; // don't grow
    gridbag.setConstraints(verticalButtonPanel, c);
    add(verticalButtonPanel);
  }