public void outACharBaseType(ACharBaseType node) { mProductions.addLast(CharType.v()); }
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); }