Exemplo n.º 1
0
    @Override
    public void installUI(JComponent c) {
      super.installUI(c);

      jtf = (JTextField) c;

      JTextField editor = jtf;

      UIDefaults uidefaults = XToolkit.getUIDefaults();

      String prefix = getPropertyPrefix();
      Font f = editor.getFont();
      if ((f == null) || (f instanceof UIResource)) {
        editor.setFont(uidefaults.getFont(prefix + ".font"));
      }

      Color bg = editor.getBackground();
      if ((bg == null) || (bg instanceof UIResource)) {
        editor.setBackground(uidefaults.getColor(prefix + ".background"));
      }

      Color fg = editor.getForeground();
      if ((fg == null) || (fg instanceof UIResource)) {
        editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
      }

      Color color = editor.getCaretColor();
      if ((color == null) || (color instanceof UIResource)) {
        editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
      }

      Color s = editor.getSelectionColor();
      if ((s == null) || (s instanceof UIResource)) {
        editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
      }

      Color sfg = editor.getSelectedTextColor();
      if ((sfg == null) || (sfg instanceof UIResource)) {
        editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
      }

      Color dfg = editor.getDisabledTextColor();
      if ((dfg == null) || (dfg instanceof UIResource)) {
        editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
      }

      Border b = editor.getBorder();
      if ((b == null) || (b instanceof UIResource)) {
        editor.setBorder(uidefaults.getBorder(prefix + ".border"));
      }

      Insets margin = editor.getMargin();
      if (margin == null || margin instanceof UIResource) {
        editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
      }
    }
Exemplo n.º 2
0
  /** @throws IOException */
  public void setting_panel() throws IOException {

    this.setTitle("Music World!!");

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    // the line that reads the image file
    //	BufferedImage image = ImageIO.read(new File("icon.jpg"));
    // BufferedImage image = ImageIO.read(new File("C:/Users/Marium
    // Ahmad/work/P2P/GUI/ui/P2P/CT/icon.jpg"));
    this.setBounds(20, 20, 479, 483);

    //	ImagePanel panel = new ImagePanel(new ImageIcon("C:/Users/Marium
    // Ahmad/work/P2P/GUI/ui/P2P/CT/background_image_music.jpg").getImage());
    //	ImagePanel panel = new ImagePanel(new ImageIcon("background_image_music.jpg").getImage());

    /**
     * ****************************************************************************************************************************************************
     * Menu Bar
     * ****************************************************************************************************************************************************
     */
    JMenuBar menuBar = new JMenuBar();
    menuBar.setBackground(new Color(240, 240, 240));
    setJMenuBar(menuBar);

    JMenu FileMenu = new JMenu("File");
    FileMenu.setMnemonic('F');
    menuBar.add(FileMenu);

    JMenuItem OpenMenuItem = new JMenuItem("Open...");
    OpenMenuItem.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.showOpenDialog(null);
            File file = chooser.getSelectedFile();
            // file.getName().toLowerCase().endsWith(".mp3");
            String filename = file.getName();
          }
        });

    FileMenu.add(OpenMenuItem);

    JMenuItem CloseMenu = new JMenuItem("Close");
    FileMenu.add(CloseMenu);

    JMenuItem RPIMenu = new JMenuItem("Recently played item");
    FileMenu.add(RPIMenu);

    JMenuItem ExitMenu = new JMenuItem("Exit");
    ExitMenu.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            System.exit(0);
          }
        });
    FileMenu.add(ExitMenu);

    JMenu HelpMenu = new JMenu("Help");
    HelpMenu.setMnemonic('H');
    menuBar.add(HelpMenu);

    JMenuItem AboutMenu = new JMenuItem("About");
    HelpMenu.add(AboutMenu);

    JMenuItem ContentsMenu = new JMenuItem("Help Contents");
    HelpMenu.add(ContentsMenu);

    /*
     * **************************************************************************************************************************************************
     */

    contentPane = new JPanel();
    contentPane.setBackground(new Color(240, 240, 240));
    contentPane.setBorder(UIManager.getBorder("MenuBar.border"));
    setContentPane(contentPane);

    /**
     * ***************************************************************************************************************************************************
     * Adding genre list choice
     * ****************************************************************************************************************************************************
     */
    /*
     * Setting Fonts
     */
    Font SansSerif = new Font("SansSerif", Font.PLAIN, 14);
    contentPane.setFont(SansSerif);

    JPanel panel_2 = new JPanel();
    contentPane.add(panel_2);

    textField_2 = new JTextField();
    textField_2.setColumns(10);

    JLabel lblAlbum = new JLabel("Album");
    lblAlbum.setFont(new Font("Showcard Gothic", Font.PLAIN, 11));
    GroupLayout gl_panel_2 = new GroupLayout(panel_2);
    gl_panel_2.setHorizontalGroup(
        gl_panel_2
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel_2
                    .createSequentialGroup()
                    .addGroup(
                        gl_panel_2
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_panel_2
                                    .createSequentialGroup()
                                    .addGap(45)
                                    .addComponent(lblAlbum))
                            .addGroup(
                                gl_panel_2
                                    .createSequentialGroup()
                                    .addGap(16)
                                    .addComponent(
                                        textField_2,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(17, Short.MAX_VALUE)));
    gl_panel_2.setVerticalGroup(
        gl_panel_2
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel_2
                    .createSequentialGroup()
                    .addGap(5)
                    .addComponent(
                        textField_2, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(lblAlbum)));
    panel_2.setLayout(gl_panel_2);

    JPanel panel_1 = new JPanel();
    contentPane.add(panel_1);

    textField = new JTextField();
    textField.setColumns(10);

    JLabel lblGenre = new JLabel("Genre");
    lblGenre.setFont(new Font("Showcard Gothic", Font.PLAIN, 11));

    textField_1 = new JTextField();
    textField_1.setColumns(10);

    JLabel lblArtist = new JLabel("Artist");
    lblArtist.setFont(new Font("Showcard Gothic", Font.PLAIN, 11));
    GroupLayout gl_panel_1 = new GroupLayout(panel_1);
    gl_panel_1.setHorizontalGroup(
        gl_panel_1
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel_1
                    .createSequentialGroup()
                    .addGroup(
                        gl_panel_1
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(45)
                                    .addComponent(lblGenre))
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(46)
                                    .addComponent(lblArtist))
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(16)
                                    .addComponent(
                                        textField_1,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(16)
                                    .addComponent(
                                        textField,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(17, Short.MAX_VALUE)));
    gl_panel_1.setVerticalGroup(
        gl_panel_1
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel_1
                    .createSequentialGroup()
                    .addGap(5)
                    .addComponent(
                        textField, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addComponent(lblGenre)
                    .addGap(5)
                    .addComponent(
                        textField_1, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(lblArtist)));
    panel_1.setLayout(gl_panel_1);
    // String genre = chooser.getSelectedItem();
    // logger.debug(genre);
    // chooser.addItemListener((ItemListener) this);

    /* Event.itemStateChanged(ItemEvent e)
      //  {
            String result = chooser.getSelectedItem();
            myTextField.setText("Your Choice: " + result);
            logger.debug(result);
        //}

    */
    /*
     * **************************************************************************************************************************************************
     */

    /**
     * **************************************************************************************************************************************************
     * Adding Button
     * *****************************************************************************************************************************************
     */
    Component glue_2 = Box.createGlue();
    contentPane.add(glue_2);

    Component glue_4 = Box.createGlue();
    contentPane.add(glue_4);

    Component glue_5 = Box.createGlue();
    contentPane.add(glue_5);

    Component glue_6 = Box.createGlue();
    contentPane.add(glue_6);

    Component glue_7 = Box.createGlue();
    contentPane.add(glue_7);
    txtTypeGenrealbumartistName = new JTextField("Enter Song");
    contentPane.add(txtTypeGenrealbumartistName);
    txtTypeGenrealbumartistName.setSelectionColor(SystemColor.controlLtHighlight);
    txtTypeGenrealbumartistName.setPreferredSize(new Dimension(100, 20));
    txtTypeGenrealbumartistName.setBackground(SystemColor.activeCaption);
    txtTypeGenrealbumartistName.setForeground(new Color(102, 0, 204));

    JButton Pause = new JButton();
    Pause.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) { // **********For pause Button
          }
        });
    // **************This whole is for progress bar***********************************
    // final LongTask task = new LongTask();
    // int length = 0;
    // final JProgressBar progressBar = new JProgressBar(0,task.getLengthOfTask());
    // progressBar.setValue(0);
    // progressBar.setStringPainted(true);
    // *********************************************************************************

    JButton Play = new JButton();
    Play.setAlignmentX(Component.RIGHT_ALIGNMENT);
    Play.setAlignmentY(Component.BOTTOM_ALIGNMENT);
    Play.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            // To Do from the recommender system

            if (txtTypeGenrealbumartistName.getText().equals("Enter Song"))
              JOptionPane.showMessageDialog(null, "Enter something in the textbox to play");
            else {
              String UserInput = txtTypeGenrealbumartistName.getText();
              logger.debug(UserInput);
              // TO DO "UserInput to the recommender system

              // **********************OBSERVABLE*****************************
              try {
                Thread.sleep(500);
              } catch (InterruptedException e2) {
                // TODO Auto-generated catch block
                e2.printStackTrace();
              } // waiting for the input

              ObservableValue Observing_String = new ObservableValue(null);

              TextObserver Update_Value = new TextObserver(Observing_String);
              Observing_String.addObserver(
                  Update_Value); /// *********************use as many observer as you want....If you
                                 // find difficulty just email me.

              // Debugging*****************************************************************
              // Observe observe = new Observe();
              // **************************************************************************

              /*
               * Creating a list for checking
               * Arrange the progressBar accordingly
               *
               */
              String[] Check = new String[6];
              Check[0] = "One";
              //	        progressBar.setValue(2);
              Check[1] = "Two";
              //	        progressBar.setValue(4);
              Check[2] = "Three";
              //	        progressBar.setValue(6);
              Check[3] = "Four";
              //	        progressBar.setValue(8);
              Check[4] = "Five";
              //	        progressBar.setValue(10);
              Check[5] = "Six";

              // logger.debug("here1");
              for (int i = 0; i < Check.length; i++) {
                //  logger.debug( Iter.next() );

                Observing_String.setSong(Check[i]);
                /*
                 * The updated value is shown in the text bars...here you will observe the same value as I took a single observer...rest of the thing is in email.
                 */
                textField.setText(Update_Value.GetValue());
                textField_1.setText(Update_Value.GetValue());
                textField_2.setText(Update_Value.GetValue());

                try {
                  Thread.sleep(2000);
                } catch (InterruptedException e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
                }
              }

              // DEBUGGING******************************************************************This is
              // used when you run it via Observe.java
              /*observe.startEngine();

              try
              {
                  Thread.sleep(3000);
              }
              catch (InterruptedException Check)
              {
                  Check.printStackTrace();
              }

              observe.stopEngine();*/
              // Debugging*******************************************************************
            }
          }
        });

    // contentPane.add(progressBar);             THE ADDITION OF PROGRESS BAR!

    // Play.setIcon(new ImageIcon("C:\\Users\\Marium
    // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\Button-Play-icon.png"));
    contentPane.add(Play);

    JButton Stop = new JButton();
    Stop.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) { // *************For stop button
          }
        });

    Component glue = Box.createGlue();
    contentPane.add(glue);
    Stop.setAlignmentX(Component.RIGHT_ALIGNMENT);
    Stop.setAlignmentY(Component.TOP_ALIGNMENT);
    // Stop.setIcon(new ImageIcon("C:\\Users\\Marium
    // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\Button-Stop-icon.png"));
    contentPane.add(Stop);
    Pause.setAlignmentX(Component.RIGHT_ALIGNMENT);
    Pause.setAlignmentY(Component.TOP_ALIGNMENT);
    // Pause.setIcon(new ImageIcon("C:\\Users\\Marium
    // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\Button-Pause-icon.png"));
    contentPane.add(Pause);

    JButton Skip = new JButton();
    Skip.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) { // *****For the Skip button
          }
        });

    Component glue_1 = Box.createGlue();
    contentPane.add(glue_1);
    // Skip.setIcon(new ImageIcon("C:\\Users\\Marium
    // Ahmad\\work\\P2P\\GUI\\ui\\P2P\\CT\\button_fast_forward_right_next_skip_button_bak_icon_go_arrow.png"));
    contentPane.add(Skip);

    /**
     * **************************************************************************************************************************************************
     * Message display
     * **************************************************************************************************************************************************
     */
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setForeground(Color.WHITE);
    scrollPane.setFont(new Font("Arial", Font.PLAIN, 12));
    scrollPane.setBackground(Color.WHITE);

    // panel.add(scrollPane, BorderLayout.CENTER);

  }
  /**
   * setDataIn
   *
   * @param title
   * @param atributos
   */
  public void setDataIn(String title, List<Atributo> atributos) {
    int condCount = 0;

    String stmp = null;
    String name = null;
    String value = null;

    Atributo atributo = null;
    for (int i = 0; i < atributos.size(); i++) {
      atributo = (Atributo) atributos.get(i);
      if (atributo == null) continue;
      name = atributo.getNome();
      if (name != null
          && name.length() >= varNames[1].length()
          && name.substring(0, varNames[1].length()).equals(varNames[1])) {
        condCount++;
      }
    }

    int nNumCols = columnNames.length;

    data = new Object[condCount][nNumCols];
    HashMap<String, String> hmTypes = new HashMap<String, String>();
    HashMap<String, String> hmCond = new HashMap<String, String>();
    HashMap<String, String> hmDestVar = new HashMap<String, String>();
    HashMap<String, String> hmProf = new HashMap<String, String>();
    HashMap<String, String> hmMsgs = new HashMap<String, String>();
    HashMap<String, String> hmOper = new HashMap<String, String>();
    HashMap<String, String> hmVals = new HashMap<String, String>();
    HashMap<String, String> hmCase = new HashMap<String, String>();

    for (int i = 0; i < atributos.size(); i++) {
      name = ((Atributo) atributos.get(i)).getNome();
      value = ((Atributo) atributos.get(i)).getValor();

      if (name.length() >= varNames[0].length()
          && name.substring(0, varNames[0].length()).equals(varNames[0])) {
        hmTypes.put(name, value);
      } else if (name.length() >= varNames[1].length()
          && name.substring(0, varNames[1].length()).equals(varNames[1])) {
        hmCond.put(name, value);
      } else if (name.length() >= varNames[2].length()
          && name.substring(0, varNames[2].length()).equals(varNames[2])) {
        if (value == null) value = "";
        hmDestVar.put(name, value);
      } else if (name.length() >= varNames[3].length()
          && name.substring(0, varNames[3].length()).equals(varNames[3])) {
        if (value == null) value = "";
        hmProf.put(name, value);
      } else if (name.length() >= varNames[4].length()
          && name.substring(0, varNames[4].length()).equals(varNames[4])) {
        if (value == null) value = "";
        hmMsgs.put(name, value);
      } else if (name.length() >= varNames[5].length()
          && name.substring(0, varNames[5].length()).equals(varNames[5])) {
        if (value == null) value = "";
        hmOper.put(name, value);
      } else if (name.length() >= varNames[6].length()
          && name.substring(0, varNames[6].length()).equals(varNames[6])) {
        if (value == null) value = "";
        hmVals.put(name, value);
      } else if (name.length() >= varNames[7].length()
          && name.substring(0, varNames[7].length()).equals(varNames[7])) {
        if (value == null) value = "";
        hmCase.put(name, value);
      }
    }

    for (int i = 0; i < condCount; i++) {
      data[i][0] = new JComboBox(saTYPES);
      stmp = (String) hmTypes.get(varNames[0] + i);
      if (stmp == null || stmp.equals("")) {
        // default type value
        hmTypes.put(varNames[0] + i, saTYPES[0]);
      }
      ((JComboBox) data[i][0]).setSelectedItem(hmTypes.get(varNames[0] + i));
      data[i][1] = (String) hmCond.get(varNames[1] + i);
      data[i][2] = (String) hmDestVar.get(varNames[2] + i);
      data[i][3] = new JComboBox(saFETCH_MODES);
      ((JComboBox) data[i][3]).setSelectedItem(hmProf.get(varNames[3] + i));
      data[i][4] = new JComboBox(saSEARCH_MODES);
      ((JComboBox) data[i][4]).setSelectedItem(hmMsgs.get(varNames[4] + i));
      data[i][5] = (String) hmOper.get(varNames[5] + i);
      data[i][6] = (String) hmVals.get(varNames[6] + i);
      data[i][7] = new JComboBox(saCASE_MODES);
      ((JComboBox) data[i][7]).setSelectedItem(hmCase.get(varNames[7] + i));

      if (data[i][2] == null) data[i][2] = "";
      if (data[i][5] == null) data[i][5] = "";
      if (data[i][6] == null) data[i][6] = "";
    }

    jTable1 = new MyJTableX(data, columnNames);

    jTable1.setModel(new MyTableModel(columnNames, data));

    jTable1.setRowSelectionAllowed(true);
    jTable1.setColumnSelectionAllowed(false);

    jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    MyColumnEditorModel rm = new MyColumnEditorModel();
    jTable1.setMyColumnEditorModel(rm);

    JComboBox jcb0 = new JComboBox(saTYPES);
    DefaultCellEditor ed0 = new DefaultCellEditor(jcb0);
    rm.addEditorForColumn(0, ed0);

    JTextField jtf1 = new JTextField();
    jtf1.setSelectionColor(Color.red);
    jtf1.setSelectedTextColor(Color.white);
    DefaultCellEditor cce = new DefaultCellEditor(jtf1);
    cce.setClickCountToStart(2);
    rm.addEditorForColumn(1, cce);

    JTextField jtf1_2 = new JTextField();
    jtf1_2.setSelectionColor(Color.red);
    jtf1_2.setSelectedTextColor(Color.white);
    DefaultCellEditor mce1_2 = new DefaultCellEditor(jtf1_2);
    mce1_2.setClickCountToStart(2);
    rm.addEditorForColumn(2, mce1_2);

    JComboBox jcb1 = new JComboBox(saFETCH_MODES);
    DefaultCellEditor ed = new DefaultCellEditor(jcb1);
    rm.addEditorForColumn(3, ed);

    JComboBox jcb2 = new JComboBox(saSEARCH_MODES);
    DefaultCellEditor ed2 = new DefaultCellEditor(jcb2);
    rm.addEditorForColumn(4, ed2);

    JTextField jtf3 = new JTextField();
    jtf3.setSelectionColor(Color.red);
    jtf3.setSelectedTextColor(Color.white);
    DefaultCellEditor mce3 = new DefaultCellEditor(jtf3);
    mce3.setClickCountToStart(2);
    rm.addEditorForColumn(5, mce3);

    JTextField jtf4 = new JTextField();
    jtf4.setSelectionColor(Color.red);
    jtf4.setSelectedTextColor(Color.white);
    DefaultCellEditor mce4 = new DefaultCellEditor(jtf4);
    mce4.setClickCountToStart(2);
    rm.addEditorForColumn(6, mce4);

    JComboBox jcb3 = new JComboBox(saCASE_MODES);
    DefaultCellEditor ed3 = new DefaultCellEditor(jcb3);
    rm.addEditorForColumn(7, ed3);

    try {
      jbInit();
      pack();
    } catch (Exception ex) {
      adapter.log("error", ex);
    }

    this.setSize(800, 250);
    setVisible(true);
  }
  protected void initComponents() {
    super.setLayout(null);
    super.setResizable(false);

    txtPassword =
        new JTextField() {
          public void paint(Graphics g) {
            Graphics2D g2 = (Graphics2D) g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            super.paint(g);
          }
        };
    txtPassword.setBackground(Color.BLACK);
    txtPassword.setForeground(Color.GREEN);
    txtPassword.setSelectionColor(Color.GREEN);
    txtPassword.setSelectedTextColor(Color.BLACK);
    txtPassword.setBounds(5, 5, 450, 30);
    txtPassword.setEditable(false);
    txtPassword.setFont(new Font("Courier New", Font.BOLD, 18));
    txtPassword.setHorizontalAlignment(JTextField.CENTER);
    txtPassword.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {

            if (generating) {
              e.consume();
              return;
            }

            txtPassword.selectAll();
            Clipboard clipboard = toolkit.getSystemClipboard();
            StringSelection selection = new StringSelection(txtPassword.getText());
            clipboard.setContents(selection, null);

            JOptionPane optionPane =
                new JOptionPane("クリップボードにコピーしました。", JOptionPane.INFORMATION_MESSAGE);
            final JDialog dialog = optionPane.createDialog(PasswordGeneratorGUI.this, "通知");
            SwingUtilities.invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    (new Timer())
                        .schedule(
                            new TimerTask() {
                              @Override
                              public void run() {
                                dialog.setVisible(false);
                              }
                            },
                            1000);

                    dialog.setVisible(true);
                  }
                });
          }
        });
    super.add(txtPassword);

    cbxNumber = new JCheckBox("数字");
    cbxNumber.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            validCheckBox();
          }
        });
    cbxNumber.setBounds(5, 40, 60, 25);
    cbxNumber.setSelected(true);
    cbxNumber.setToolTipText(PasswordGenerator.NUMBER.toString());
    super.add(cbxNumber);

    cbxAlphabet = new JCheckBox("英字");
    cbxAlphabet.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            validCheckBox();
          }
        });
    cbxAlphabet.setBounds(70, 40, 60, 25);
    cbxAlphabet.setSelected(true);
    cbxAlphabet.setToolTipText(PasswordGenerator.ALPHABET_S.toString());
    super.add(cbxAlphabet);

    cbxSymbol = new JCheckBox("記号");
    cbxSymbol.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            validCheckBox();
          }
        });
    cbxSymbol.setBounds(135, 40, 60, 25);
    cbxSymbol.setSelected(true);
    cbxSymbol.setToolTipText(SYMBOL.toString());
    super.add(cbxSymbol);

    spinnerModel = new SpinnerNumberModel(8, 1, 32, 1);
    spnLength = new JSpinner(spinnerModel);
    spnLength.setBounds(210, 40, 50, 25);
    super.add(spnLength);

    btnGenerate = new JButton("生成");
    btnGenerate.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            generate();
          }
        });
    btnGenerate.setBounds(275, 40, 174, 24);
    super.add(btnGenerate);
  }