()
| 42 | private JButton colorButton; |
| 43 | |
| 44 | public Test_Dialog2() { |
| 45 | super(); |
| 46 | this.setTitle("testing dialogs"); |
| 47 | |
| 48 | JPanel m = new JPanel(new GridLayout()); |
| 49 | status = new JLabel("testing"); |
| 50 | m.add(status, null); |
| 51 | add(m, BorderLayout.SOUTH); |
| 52 | |
| 53 | JPanel p = new JPanel(); |
| 54 | p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
| 55 | add(p, BorderLayout.CENTER); |
| 56 | this.setLocation(300, 300); |
| 57 | JButton b; |
| 58 | |
| 59 | b = new JButton("ConfirmDialog"); |
| 60 | final JPanel content = new JPanel(); |
| 61 | content.setLayout(new BorderLayout()); |
| 62 | content.add(new JLabel("this is the option panel"), BorderLayout.CENTER); |
| 63 | b.addActionListener(new ActionListener() { |
| 64 | @Override |
| 65 | public void actionPerformed(ActionEvent e) { |
| 66 | new AsyncDialog().showConfirmDialog(Test_Dialog2.this, |
| 67 | "<html>The frame is now " + (isResizable() ? "" : "<b>NOT</b> ") |
| 68 | + "resizable. Switch that?</html>", |
| 69 | "Testing JOptionPane", JOptionPane.YES_NO_OPTION, new ActionListener() { |
| 70 | |
| 71 | @Override |
| 72 | public void actionPerformed(ActionEvent e) { |
| 73 | switch (e.getID()) { |
| 74 | case JOptionPane.YES_OPTION: |
| 75 | setResizable(!isResizable()); |
| 76 | break; |
| 77 | case JOptionPane.NO_OPTION: |
| 78 | break; |
| 79 | case JOptionPane.CLOSED_OPTION: |
| 80 | System.out.println("Confirm canceled"); |
| 81 | return; |
| 82 | } |
| 83 | String msg = "this.isResizable() == " + isResizable(); |
| 84 | System.out.println(msg); |
| 85 | status.setText(msg); |
| 86 | } |
| 87 | |
| 88 | }); |
| 89 | } |
| 90 | |
| 91 | }); |
| 92 | p.add(b); |
| 93 | |
| 94 | b = new JButton("MessageDialog"); |
| 95 | final JPanel message = new JPanel(); |
| 96 | message.setLayout(new BorderLayout()); |
| 97 | message.add(new JLabel("this is the message panel"), BorderLayout.CENTER); |
| 98 | b.addActionListener(new ActionListener() { |
| 99 | |
| 100 | @Override |
| 101 | public void actionPerformed(ActionEvent e) { |
nothing calls this directly
no test coverage detected