Example #1
0
  public MyDialog() {
    super();
    // "\u041e\u0448\u0438\u0431\u043a\u0430\u002e", true);
    setSize(200, 100);
    setLocation(350, 260);
    setBackground(new Color(0.77254903f, 0.015686275f, 0.12941177f, 1f));
    setVisible(false); // <html><body text="red"><h3><i> </i></h3></body>
    label = new JTextPane();
    label.setSize(196, 70);
    label.setLocation(2, 2);
    label.setBackground(new Color(0.77254903f, 0.015686275f, 0.12941177f, 1f));
    label.setFont(new Font("Serif", Font.PLAIN, 16));
    text = new String("");

    MenuButton continuer =
        new MenuButton(
            "\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c", 2, 75, 96, 20, 7f);
    continuer.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            setVisible(false);
          }
        });

    MenuButton more =
        new MenuButton(
            "\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435", 102, 75, 96, 20, 7f);
    more.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            label.setText(text);
          }
        });
    setLayout(null);
    add(label);
    add(continuer);
    add(more);
  }
Example #2
0
    @Override
    public void actionPerformed(ActionEvent e) {

      licence_text =
          new String(
              "This program is free software: you can redistribute it and/or modify\n"
                  + "it under the terms of the GNU General Public License as published by\n"
                  + "the Free Software Foundation, either version 3 of the License, or\n"
                  + "(at your option) any later version.\n"
                  + "\n"
                  + "This program is distributed in the hope that it will be useful,\n"
                  + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
                  + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
                  + "GNU General Public License for more details.\n"
                  + "\n"
                  + "You should have received a copy of the GNU General Public License\n"
                  + "along with this program.  If not, see <http://www.gnu.org/licenses/>.\n"
                  + "\n\n\n");

      try {
        InputStream ips = new FileInputStream(getClass().getResource("COPYING").getPath());
        InputStreamReader ipsr = new InputStreamReader(ips);
        BufferedReader br = new BufferedReader(ipsr);

        String line;
        while ((line = br.readLine()) != null) {
          licence_text += line + '\n';
        }
        br.close();
      } catch (Exception e1) {
      }

      Dimension dimension = new Dimension(600, 400);

      JDialog licence = new JDialog(memento, "Licence");

      JTextPane text_pane = new JTextPane();
      text_pane.setEditable(false);
      text_pane.setPreferredSize(dimension);
      text_pane.setSize(dimension);

      StyledDocument doc = text_pane.getStyledDocument();

      Style justified =
          doc.addStyle(
              "justified",
              StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE));
      StyleConstants.setAlignment(justified, StyleConstants.ALIGN_JUSTIFIED);

      try {
        doc.insertString(0, licence_text, justified);
      } catch (BadLocationException ble) {
        System.err.println("Couldn't insert initial text into text pane.");
      }
      Style logicalStyle = doc.getLogicalStyle(0);
      doc.setParagraphAttributes(0, licence_text.length(), justified, false);
      doc.setLogicalStyle(0, logicalStyle);

      JScrollPane paneScrollPane = new JScrollPane(text_pane);
      paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
      paneScrollPane.setPreferredSize(dimension);
      paneScrollPane.setMinimumSize(dimension);

      JPanel pan = new JPanel();
      LayoutManager layout = new BorderLayout();
      pan.setLayout(layout);

      pan.add(new JScrollPane(paneScrollPane), BorderLayout.CENTER);
      JButton close = new JButton("Fermer");
      close.addActionListener(new ButtonCloseActionListener(licence));
      JPanel button_panel = new JPanel();
      FlowLayout button_panel_layout = new FlowLayout(FlowLayout.RIGHT, 20, 20);
      button_panel.setLayout(button_panel_layout);

      button_panel.add(close);
      pan.add(button_panel, BorderLayout.SOUTH);

      licence.add(pan);

      licence.pack();
      licence.setLocationRelativeTo(memento);
      licence.setVisible(true);
    }
Example #3
0
  public WizardStep getStage(String stage) {

    final WhatsNew _this = this;

    WizardStep ws = new WizardStep();

    int ind = stage.indexOf(":");

    Version v = new Version(stage.substring(0, ind));

    int lind = Integer.parseInt(stage.substring(ind + 1));

    java.util.List<WhatsNewItem> its = this.items.get(v);

    if (its == null) {

      return null;
    }

    WhatsNewItem item = its.get(lind);

    if (item == null) {

      return null;
    }

    ws.title = item.title;
    ws.helpText = this.getFirstHelpText();

    if ((item.description != null) || (item.component != null)) {

      final Box b = new Box(BoxLayout.Y_AXIS);

      if (item.description != null) {

        JTextPane hp = UIUtils.createHelpTextPane(item.description, this.projectViewer);

        hp.setBorder(null);
        hp.setSize(new Dimension(UIUtils.getPopupWidth() - 25, 500));

        Box hpb = new Box(BoxLayout.Y_AXIS);
        hpb.add(hp);
        hpb.setMaximumSize(hpb.getPreferredSize());
        hpb.setBorder(UIUtils.createPadding(0, 5, 0, 0));
        b.add(hpb);
      }

      if (item.component != null) {

        if (item.description != null) {

          b.add(Box.createVerticalStrut(5));
        }

        item.component.setAlignmentY(Component.TOP_ALIGNMENT);
        item.component.setBorder(UIUtils.createPadding(5, 10, 0, 0));

        b.add(item.component);
      }

      b.add(Box.createVerticalGlue());

      ws.panel = b;
    }

    return ws;
  }