/** Create the frame */ public DateTimer() { super(); setTitle("v14 CountDown"); getContentPane().setLayout(null); setBounds(100, 100, 500, 375); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JLabel finishtimeLabel = new JLabel(); finishtimeLabel.setText("CountDown Time"); finishtimeLabel.setBounds(10, 36, 119, 15); getContentPane().add(finishtimeLabel); finishtime = new JFormattedTextField( new DateFormatter(new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa", Locale.ENGLISH))); finishtime.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) {} }); finishtime.setValue(new Date()); finishtime.setBounds(135, 34, 187, 19); getContentPane().add(finishtime); final JButton startButton = new JButton(); startButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { startCount(); } }); startButton.setText("Start!!!"); startButton.setBounds(334, 31, 111, 25); getContentPane().add(startButton); countLabel = new JLabel(); countLabel.setHorizontalAlignment(SwingConstants.CENTER); countLabel.setHorizontalTextPosition(SwingConstants.CENTER); countLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 14)); countLabel.setBorder(new LineBorder(Color.black, 1, false)); countLabel.setText("Countdown not Started"); countLabel.setBounds(10, 162, 435, 47); getContentPane().add(countLabel); final JLabel credits = new JLabel(); credits.setHorizontalAlignment(SwingConstants.RIGHT); credits.setText(""); credits.setBounds(253, 328, 237, 15); getContentPane().add(credits); }
private void createZoomTextField() { mZoomTextField = new JFormattedTextField(new DecimalFormat("##0.00%")); mZoomTextField.setFocusLostBehavior(JFormattedTextField.REVERT); mZoomTextField.setHorizontalAlignment(SwingConstants.CENTER); mZoomTextField.setColumns(6); mZoomTextField.setMinimumSize(mZoomTextField.getPreferredSize()); mZoomTextField.addActionListener( (x) -> mImagePresentationModel.setZoom(((Number) mZoomTextField.getValue()).doubleValue())); mImagePresentationModel.addListener( new ImagePresentationModel.Listener() { @Override public void onVisibleImageContentUpdate() { mZoomTextField.setValue(mImagePresentationModel.getZoom()); } @Override public void onImageChange() { onVisibleImageContentUpdate(); } }); }